$(document).ready(function () {
		

/********************************************************************************************************************/
// FILE UPLOADER
/********************************************************************************************************************/	

			
		<!-- Upload profile picture -->	
		$(".change_profile").livequery(function(){ $(this).load(
					function() {
						if($(this).attr('id')!=''){
							//alert($(this).attr('id'));
							createFileUploader("uploader_"+$(this).attr('id'));
							
							$('.qq-upload-button').prepend('[Cambiar foto]');
						}
					}
				);
		});
		
		
		function createFileUploader(this_class){
			var uploader = new qq.FileUploader({
                element: document.getElementById(this_class),
                action: 'fileUploader.php',
				onComplete: function(id, fileName, responseJSON) {
					
					if(responseJSON['success']==true){
					
						str='resize_image=1&fileName=public/profiles/'+fileName.replace(/ /g,"_")+'&thumbName=public/profiles/100_'+fileName.replace(/ /g,"_")+'&height=100';
						$.ajax({
						  type: "GET",
						  url: "ajax_handler.php",
						  data: str,
						  success: function(msg_login){  
							  
							    if(fileName!='path of the saved file'){
									
									$('.shadowbox_'+this_class).attr('href','http://www.esteeselforo.com/dev/public/profiles/'+fileName.replace(/ /g,"_"));
									
									
									swapImage('http://www.esteeselforo.com/dev/public/profiles/100_'+fileName.replace(/ /g,"_"),'.change_profile');
									swapImage('http://www.esteeselforo.com/dev/public/profiles/100_'+fileName.replace(/ /g,"_"),'.thumb_own');
									
									Shadowbox.clearCache(); 
									Shadowbox.setup(); 
								}
								
								
							 }  
						 });
					}
					 
					
				}
            });   
		}
		
		function swapImage(url, class_img){
			 var i=new Image;
			 i.onload=function(){
				 
				  old_height=$(class_img).attr('height');
				  old_width=$(class_img).attr('width');
				  
				 
				  $(class_img).fadeOut(200);
				  $(class_img).attr('src',url);
				  
				  if(old_height>old_width){
					  
							new_width=old_height*this.width/this.height;
							new_height=old_height;
					  
				  }else{
					  
						    new_height=old_width*this.height/this.width;
							new_width=old_width;
					  
				  }
				  
				  $(class_img).attr('width',new_width);
				  $(class_img).attr('height',new_height);
				  $(class_img).fadeIn(200);
				 
			 }
			 i.src=url;
		}


		
			
/********************************************************************************************************************/
// LOAD WEBPAGE
/********************************************************************************************************************/			
			
			var cuantosTemas=7;
			$("body").data("temasLoaded", cuantosTemas);
			var dark=true;
			
			 $.ajax({
					type: "GET",
					url: "ajax_handler.php",
					data: 'get_acceso='+1,
					success: function(msg_load){  
						if(msg_load!=""){
								$('#div_new_tema').css('top',$(window).height()-100);
								var window_height=$(window).height();
								$('#skip_top').css('margin-top',window_height-60);
								
								
								$('input[nuevo_tema!=""]').hint();
								
								
								$("#list_temas_loading").Loadingdotdotdot({
									"speed": 400,
									"maxDots": 3
								});
								//$("#list_temas_loading").Loadingdotdotdot("Stop");
				
								findRecentTemas();
								
								
								
								<!-- Scroll script -->	
								$.localScroll.defaults.axis = 'x';
								$.localScroll();
								
								// Scroll initially if there's a hash (#something) in the url 
								/*
								$.localScroll.hash({
									target: '#content', // Could be a selector or a jQuery object too.
									queue:true,
									duration:1500
								});
								*/
								
								
								//TOP DIV
								//menuYloc = parseInt($('#skip_top').css("top").substring(0,$('#skip_top').css("top").indexOf("px")))
								
								$(window).scroll(function () { 
								
									if($(window).scrollTop()<115){
										
										$('.skip_top').css('margin-top',window_height-$(window).scrollTop()-60);
										
										$('.skip_top').css('position','fixed');
										
							}else{	
										//$('.skip_top').css('top',$(window).scrollTop()/2);
										//$('.skip_top').css('position','relative');
										
									}
									//$(name).animate({top:offset},{duration:500,queue:false});
									
								});
								
								//BIRTHDAY REMINDER
								$.get("ajax_handler.php", { get_birdthday: 1 }, function(data){
									if(data!=''){
										$.growl('', data); 
									}
								});
								
								
						}else{
							
								
								$('input[password!=""]').hint();
								$('input[login!=""]').hint();
								$('#login').focus();

						}
					}
				});
			
			
			
			
			Shadowbox.init();
			
			
				
			
/********************************************************************************************************************/
// SYSTEM
/********************************************************************************************************************/			
			<!-- Login form -->	
			/*
			$("#form_login").submit(function(){
				$("#message").html('<div align="center"><img src="images/loading.gif" /></div>');
				var str = $(this).serialize();

				 $.ajax({
					type: "POST",
					url: "ajax_handler.php",
					data: str,
					success: function(msg_login){  
					    
						$("#message").ajaxComplete(function(event, request, settings){  
							if(msg_login == 'OK'){ 
								result = " ";
								$.cookie('acceso','true');
								$(window.location).attr('href', 'index.php');
							}else{
								$.cookie('acceso','false');
								result = msg_login;
								
							}
							$(this).html(result);
						});
					 }  
				   });
				return false;
		
			}); <!-- submit ogin form -->	
			*/
			
			<!-- Submit login form -->	
			$("#form_login input").keypress(function (e) {
				
					if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
						if($('#login').val()!='' && $('#login').val()!='Username' && $('#password').val()!='' && $('#password').val()!='Password'){
							$("#message").html('<div align="center"><img src="images/loading.gif" /></div>');
							var str = 'login='+($('#login').val())+"&password="+($('#password').val());
			
							 $.ajax({
								type: "POST",
								url: "ajax_handler.php",
								data: str,
								success: function(msg_login){  
									
									$("#message").ajaxComplete(function(event, request, settings){  
										if(msg_login == 'OK'){ 
											result = " ";
											$.cookie('acceso','true');
											$(window.location).attr('href', 'index.php');
										}else{
											$.cookie('acceso','false');
											result = msg_login;
											
										}
										$(this).html(result);
									});
								 }  
							   });
						}
						return false;
					} else {
						return true;
					}
			});
			

			
			<!-- Autologout -->	
			/*
			$.timer(2000, function (timer) { //Actualiza el numero de comentarios nuevos de cada tema
				$.get("ajax_handler.php", { get_acceso: 1 }, function(loggedin){
						if(loggedin=="" && $.cookie('acceso')=='true'){
							$.cookie('acceso','false');
							$(window.location).attr('href', 'index.php?page=logout');
						}
				});
			});
			*/

/********************************************************************************************************************/
// DISCUSSION FORUM
/********************************************************************************************************************/		

			<!-- Form new tema -->	
			$("#form_new_tema").keypress(function (e) {
					if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
						var str=$('#nuevo_tema').val();
						
						if(str!=''){
							$("#message").html('<div align="center"><img src="images/loading.gif" /></div>');
							 
							 $.ajax({
								type: "POST",
								url: "ajax_handler.php",
								data: 'nuevo_tema='+str,
								success: function(msg_tema){  
									if(msg_tema!=''){
										$('#nuevo_tema').val('');
										$("#message").html('');
										
										var temasLoaded=$('body').data('temasLoaded');
										$("body").data("temasLoaded",(temasLoaded+1));
										
										insertTema(msg_tema, false, true);
										 $.scrollTo( {top:'0px', left:'920px'}, 800 );
									}
								 }  
							   });		
						
						}
						return false;
						
					}
					return true;
			}); 


			<!-- Appends recent temas -->	
			function findRecentTemas(){
					  $.ajax({
						  type: "GET",
						  url: "ajax_handler.php",
						  data: 'get_recent_temas=1',
						  success: function(msg_recent_temas){  
						  		//Which ones are new
								var nuevos=0;
								var str_recent_temas='';
								var recent_temas=msg_recent_temas.split(',');
								for(i=0;i<recent_temas.length;i++){	
									if(recent_temas[i].substring(0,1)=='*'){
										str_recent_temas+=(recent_temas[i].substring(1))+',';	
										nuevos++;
									}else{
										str_recent_temas+=recent_temas[i]+',';	
									}
								}
						  
							  	$("body").data("recentTemas",str_recent_temas);
							  	recentTemas(0,Math.max(cuantosTemas,nuevos));
						   }  
					  });	
			}
			
			function recentTemas(from, cuantos){
					var recent_temas=$("body").data("recentTemas").split(',');
					
					for(i=from;i<Math.min(recent_temas.length,(from+cuantos));i++){	
						  if(recent_temas[i]!=''){
							  if(from==0){
								insertTema(recent_temas[i], true, false);
							  }else{
								insertTema(recent_temas[i], false, false);
							  }
						  }
					  }	
			}
			
			
			<!-- Listener previous temas-->	
			$("#temas_previos").livequery(function(){
					$(this).click(
					function() {  
						var temasLoaded=$('body').data('temasLoaded');
						$("body").data("temasLoaded",(temasLoaded+cuantosTemas));
						recentTemas(temasLoaded,cuantosTemas);
						return false;
					}
					);
			});
			
			$('.next').livequery(function(){ $(this).click(
					function() {
						var pageScroll=getPageScroll(); 
						var nextContainer=918*Math.floor((pageScroll[0]/918)+1);
						$.scrollTo( {top:'0px', left:nextContainer+'px'}, 800 );
						
						return false;
					});
			});
			
			$('.prev').livequery(function(){ $(this).click(
					function() {
						var pageScroll=getPageScroll(); 
						var nextContainer=918*(Math.floor(pageScroll[0]/918)-1);
						$.scrollTo( {top:'0px', left:nextContainer+'px'}, 800 );
						
						return false;
					});
			});
			
			$('#top_link').livequery(function(){ $(this).click(
				function(){
					var pageScroll=getPageScroll(); 
					var nextContainer=918*(Math.round(pageScroll[0]/918));
					$.scrollTo( {top:'0px', left:nextContainer+'px'}, 800 );
					return false;
				});
			});
	
			<!-- Insert tema -->
			function insertTema(which_tema, firstTime, newTema){ 
				$('#site').css('width',(($("body").data("temasLoaded")+2)*1040)+'px');
			
				//Load tema
				var which_div='#memento_div'+which_tema;
				var container='<div class="container" id="container'+which_tema+'">'
				+ '<div id="space02"><a name="memento_div'+which_tema+'_link" id="film-link"></a><img src="images/dff-sidebar-tile.jpg"></div>'
				+ '<div id="mem">'
				+ '<div class="skip"><a class="prev" id="prev_link_'+which_tema+'" href="#"><<</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="next" id="next_link_'+which_tema+'" href="#">>></a></div>'
				+ '<div class="film-txt">'
				+'<div id="memento_div'+which_tema+'"></div>'
				+'</div>'
				+ '</div></div>';
				
				//Now insert link in menu
				$.get("ajax_handler.php", { get_titulo_tema: which_tema }, function(titulo){
					if(dark===true){
						dark=!dark;
						var class_tema='menu_light';
					}else{
						dark=!dark;
						var class_tema='menu_dark';	
					}
					var enmenu='<a href="'+which_div+'_link" class="'+class_tema+'">'+titulo+'</a>&nbsp;';
					
					if(newTema==true ){
						$(container).insertAfter('#container0');
					}else{
						$(container).insertBefore('#containerN');
					}
					
					if(newTema===true){
						$('#ultimos_temas').prepend(enmenu);
					}else{
						$('#ultimos_temas').append(enmenu);
					}
					
					//Saves title in DOM
					$('#div_foro_tema'+which_tema).data('titulo_tema',titulo);
					
					if(firstTime===true){ //Solo los recientes
						var recent_item='<a href="#memento_div'+which_tema+'_link">'+titulo+'</a>&nbsp;<a href="#memento_div'+which_tema+'_link" id="div_foro_nuevos'+which_tema+'"></a><br>';
						$('#menu_recent_activity_items').append(recent_item);
					}else if(newTema===true){
						var recent_item='<a href="#memento_div'+which_tema+'_link" >'+titulo+'</a>&nbsp;<a href="#memento_div'+which_tema+'_link" id="div_foro_nuevos'+which_tema+'"></a><br>';
						$('#menu_recent_activity_items').prepend(recent_item);
					}
					
					
					if($('#list_temas').css('display')=='none'){
						$('#list_temas').css('display','');
						$('#list_temas_loading').css('display','none');
						$('.menu_recent_activity').css('display','');
						$('#div_new_tema').css('display','');
						
						$('#list_temas_loading').Loadingdotdotdot("Stop");	
					}
					
					//Appends in recent menu
					$.localScroll();
					
					loadTema( which_tema, which_div);
					
				});
				
				
			}
			
			
			<!-- Load tema -->	
			function loadTema(which_tema, which_div){ 
				$(which_div).html('<img src="images/loading.gif" />');
				
				
				$.get("ajax_handler.php", { id_tema: which_tema }, function(data){
						$(which_div).html(data);  //Displays comentario
						
						var nuevos=get_recent(which_tema);
						if(nuevos>0){
							$('#div_foro_nuevos'+which_tema).html('&nbsp;('+nuevos+')');
						}
						
						
						<!-- Sync tema -->	
						$.PeriodicalUpdater('ajax_handler.php', {
							method: 'get',          // method; get or post
							data: 'sync_tema='+which_tema,
							minTimeout: Math.floor(600000+Math.random()*600000),       // starting value for the timeout in milliseconds
							maxTimeout: 1200000,       // maximum length of time between requests
							//minTimeout: Math.floor(1000+Math.random()*10000),       // starting value for the timeout in milliseconds
							//maxTimeout: 6000,       // maximum length of time between requests
							
							multiplier: 2,          // the amount to expand the timeout by if the response hasn't changed (up to maxTimeout)
							type: 'text',           // response type - text, xml, json, etc.  See $.ajax config options
							maxCalls: 0,            // maximum number of calls. 0 = no limit.
							autoStop: 0             // automatically stop requests after this many returns of the same data. 0 = disabled.
						}, function(remoteData, success, xhr, handle) {
							
							//recent_activity(which_tema);
							var syncData=remoteData.split('&');
							
							//Appends new comments
							if(syncData[0]!=''){
								 $.ajax({
									type: "POST",
									url: "ajax_handler.php",
									data: 'print_comenta='+syncData[0],
									success: function(msg_comenta){  
										$("#div_comentarios"+which_tema).ajaxComplete(function(event, request, settings){ 
											if(msg_comenta!=''){
												$(this).append(msg_comenta);
												msg_comenta='';
												
												$.get("ajax_handler.php", { get_growl_tema: which_tema }, function(data){
											    	$.growl('', data); 
												});
												notify_recent(which_tema);
												
											}
										});
									}  
								});
							}
							
							//Updates edited comments
							if(syncData[1]!=''){
								var edited=syncData[1].split(',');
								for(i=0;i<edited.length;i++){
									 var divi = '#comentario'+edited[i];
									 $.get("ajax_handler.php", { print_edited_comenta: edited[i] }, function(data){
										$(divi).html(data);
										if($(divi).css('background')=='#FFFFFF'){
											$(divi).css('background', '#E4F6F8');
											$(divi).animate({ backgroundColor: "#FFF" }, 500);
										}
										//$("#div_comentarios").append(" EDITING: "+divi);
									});
								}
							}
							
							//Removes deleted
							if(syncData[2]!=''){
								var deleted=syncData[2].split(',');
								for(i=0;i<deleted.length;i++){
									var divi = '#comentario'+deleted[i];
									$(divi).slideUp("normal", function() { $(this).remove(); } );
									//$("#div_comentarios").append(" DELETING: "+divi);
								}
							}
							
						});
						
						
										
					});
			} 
			
			<!-- New comentario -->	
			$( "#form_comenta" ).live(
					"submit",
					function( event ){
						var str = $(this).serialize();
						
						q = parseQuery(str);
						var this_tema=q.comenta_tema;
						
						 $.ajax({
							type: "POST",
							url: "ajax_handler.php",
							data: str,
							success: function(msg_forma){  
								var content=msg_forma.substring(strpos(msg_forma,'*****')+5);
								var id_comentario=msg_forma.substring(0,strpos(msg_forma,'*****'));
								
								$("#comentario"+id_comentario).data('viewed',true);
								notify_recent(this_tema);
								$("#div_comentarios"+this_tema).append(content);
								$('#content'+this_tema).val('');
								$("#comentario"+id_comentario).css('backgroundColor','#E4F6F8');
								$("#comentario"+id_comentario).animate({ backgroundColor: "#FFF" }, 500);
								
								msg_forma="";
								
								/*
								
								$("#div_comentarios"+this_tema).ajaxComplete(function(event, request, settings){ 
								 	
									$(div_id).data('viewed',true);
									$(this).append(content);
									$('#comentario'+this_tema).val('');
									$(div_id).animate({ backgroundColor: "#FFF" }, 500);
									msg_forma="";
									
									
								});
								*/
					 		}  
				   		});
						
						
						return false;
					}
			); 

 			<!-- Autoresize forma comentario -->	
			$('.input_content').livequery(function(){

				if ($(this).attr("class") != "resized"){
					$(this).attr("class","resized");
		
					$(this).autoResize({
					// On resize:
					onResize : function() {
						$(this).css({opacity:0.8});
					},
					// After resize:
					animateCallback : function() {
						$(this).css({opacity:1});
					},
					// Quite slow animation:
					animateDuration : 300,
					// More extra space:
					extraSpace : 40
					});
				}
			});
			
			
			<!-- Listener link for delete comentario-->	
			$(".delete_comment_link").livequery(function(){
					$(this).click(
					function() {  
						if (confirm('Are you sure to delete?')) {
							var str = 'delete_comentario='+$(this).attr('id');
							var divi = '#comentario'+$(this).attr('id');
							//$(divi).slideUp("normal", function() { $(this).remove(); } );
								$.ajax({
									type: "GET",
									url: "ajax_handler.php",
									data: str,
									success: function(msg_delete){  
										$(divi).ajaxComplete(function(event, request, settings){ 
											//$(this).remove();
											$(divi).slideUp("normal", function() { $(this).remove(); } );
										});
									}  
								});
						}
						return false; //Prevent the browser jump to the link anchor
					} 
				);
			});
			
			
			<!-- Edit-in-place comentario -->	
			$(".div_foro_item_comentario").livequery(function(){
				var id_comenta=$(this).attr('id').substring(16);
				if(id_comenta>0){
					$(this).data('id_comenta',id_comenta);
					
					$(this).editInPlace({
								params: "edit_comentario="+($(this).data('id_comenta')),
								url: "./ajax_handler.php",
								field_type: "textarea",
								use_html:false,
								textarea_rows: "5",
								textarea_cols: "35",
								bg_over: "#ffffee",
								show_buttons: false,
								saving_image: "images/loading.gif"
					});
				}
			});
			
			<!-- Autoresize forma comentario -->	
			$("#form_edit_comentario").livequery(function(){
				
				if ($(this).attr("class") != "resized"){
					$(this).attr("class","resized");
		
					$(this).autoResize({
						// On resize:
						onResize : function() {
							$(this).css({opacity:0.8});
						},
						// After resize:
						animateCallback : function() {
							$(this).css({opacity:1});
						},
						// Quite slow animation:
						animateDuration : 300,
						// More extra space:
						extraSpace : 40
					}).trigger('change');
				}
					
			});
			
			<!-- Boton de delete solo visible on hover -->	
			$(".div_foro_item").livequery(function(){
				var divitem='#'+$(this).attr('id');
				$(this).hover(
					function() {
						$(divitem+" .delete_comment_link").show();},
					function() {
						$(divitem+" .delete_comment_link").hide();}
						)
			});
			
			<!-- Boton de delete solo visible on hover -->	
			$(".div_foro_item_new").livequery(function(){
				var divitem='#'+$(this).attr('id');
				$(this).hover(
					function() {
						$(divitem+" .delete_comment_link").show();},
					function() {
						$(divitem+" .delete_comment_link").hide();}
						)
			});
			
			<!-- Boton de delete solo visible on hover -->	
			$(".delete_comment_link").livequery(function(){
				$(this).hide();
			});
			
			
			<!-- Hover color on new comentarios -->	
			$(".div_foro_item_new").livequery(function(){
				$(this).hover(function() {
					//var viewed=$(this).data('viewed');
					//if ( typeof viewed == "undefined" || !viewed) {
						
						$(this).data('viewed',true);
					//}
					$(this).animate({ backgroundColor: "#FFF" }, 500);
					notify_recent($(this).parent().attr('id').substring(15));
				});
			});

			<!-- Hides forma new comentario -->	
			$(".toggle_container").livequery(function(){
					$(this).hide();
			});

			<!-- Toggle forma new comentario -->	
			$(".div_foro_comenta").livequery(function(){
					var divitem_trigger='h2#trigger_'+$(this).attr('id');
					var div_comenta='#content'+$(this).attr('id').substr(16);
					
					
					$(this).hoverIntent( {
							over: function(){ 
									if($(divitem_trigger).attr('class')!='trigger active'){
										$(divitem_trigger).toggleClass("active").next().slideToggle("slow");
									}
								}, 
				 			timeout: 1000, // number = milliseconds delay before onMouseOut    
				 			out: function(){
								
									if($(div_comenta).val()==''){
										$(divitem_trigger).toggleClass("active").next().slideToggle("slow");
									}
								}     
					});
			});
			
			<!-- Regresa comentarios nuevos -->
			function get_recent(recent_tema){
				var nuevos=0;
				$("#div_comentarios"+recent_tema+" .div_foro_item_new").each(function (index, domEle) {
					var viewed=$(domEle).data('viewed');
					if (viewed=== undefined || !viewed) {
							nuevos++;
					}
				});
				return nuevos;
			}
			
			<!-- Actualiza el menu de actividad reciente -->
			function notify_recent(recent_tema){ 
				var div_id="#comentario"+recent_tema;
				var nuevos=get_recent(recent_tema);
				$(div_id).data('new_comentarios',nuevos);
				if(nuevos>0){
					var str_nuevos='&nbsp;('+nuevos+')';
				}else{
					var str_nuevos='';	
				}
				$('#div_foro_nuevos'+recent_tema).html(str_nuevos);
			} 
			
				
/********************************************************************************************************************/
// PAGES
/********************************************************************************************************************/
			<!-- Load a given page in a given div -->	
			function loadPage(which_page, which_div){ 
				$(which_div).html('<img src="images/loading.gif" />');
	
				$.get("ajax_handler.php", { name_pag: which_page }, function(data){
						$(which_div).html(data);
				});
			} 
			
			<!-- Edit-in-place page -->	
			$("#pseudo").editInPlace({
				//callback: function(unused, enteredText) { alert(enteredText); return enteredText;  },
				params: "edit_pag=1",
				url: "./ajax_handler.php",
				//bg_over: "#cff",
				field_type: "textarea",
				textarea_rows: "5",
				textarea_cols: "35",
				show_buttons: true,
				//bg_out: "#ECF2F8",
				//saving_animation_color: "#ECF2F8",
				saving_image: "images/loading.gif"
			});
	
	
	
/********************************************************************************************************************/
// GROWL
/********************************************************************************************************************/
	
	
			<!-- Growl -->	
		
		  $('#cancelF1').click(function() {
			clearInterval(f1);
		  });
		
		  $('#cancelF2').click(function() {
			clearInterval(f2);
		  });
		
		  $('#cancelF3').click(function() {
			clearInterval(f3);
		  });
		
		  $.growl.settings.defaultImage ='images/growl.jpg';
		  $.growl.settings.displayTimeout = 10*180000;
		  $.growl.settings.dockCss.width = '225px';
		  $.growl.settings.noticeTemplate = ''
		
			+ '<div class="box-growl">'
			+ '<div class="close-growl"><a href="" onclick="return false;" rel="close"><img src="images/dm_close.png" border ="0" /></a></div>'
			+ '<div class="message-growl">%message%</div>'
			+ '</div>';
			
		  //$.growl.settings.noticeElement($('.notice'));
		  $.growl.settings.noticeCss = {
			position: 'relative'
		  };
		



			
}); <!-- when ready -->	




/********************************************************************************************************************/
// AUXILIARY FUNCTIONS
/********************************************************************************************************************/

function strpos (haystack, needle, offset) {
	  var i = (haystack+'').indexOf(needle, (offset || 0));
	  return i === -1 ? false : i;
}

function parseQuery(qs,options) {
	  var q = (typeof qs === 'string'?qs:window.location.search), o = {'f':function(v){return unescape(v).replace(/\+/g,' ');}}, options = (typeof qs === 'object' && typeof options === 'undefined')?qs:options, o = jQuery.extend({}, o, options), params = {};
	  jQuery.each(q.match(/^\??(.*)$/)[1].split('&'),function(i,p){
		  p = p.split('=');
		  p[1] = o.f(p[1]);
		  params[p[0]] = params[p[0]]?((params[p[0]] instanceof Array)?(params[p[0]].push(p[1]),params[p[0]]):[params[p[0]],p[1]]):p[1];
	  });
	  return params;
}

// getPageScroll() by quirksmode.com
function getPageScroll() {
	  var xScroll, yScroll;
	  if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	  } else if (document.documentElement && document.documentElement.scrollTop) {
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	  } else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;
	  }
	  return new Array(xScroll,yScroll)
}


/********************************************************************************************************************/
// INPUT HINTS
/********************************************************************************************************************/

jQuery.fn.hint = function (blurClass) {
  if (!blurClass) { 
    blurClass = 'blur';
  }

  return this.each(function () {
    // get jQuery version of 'this'
    var $input = jQuery(this),

    // capture the rest of the variable to allow for reuse
      title = $input.attr('title'),
      $form = jQuery(this.form),
      $win = jQuery(window);

    function remove() {
      if ($input.val() === title && $input.hasClass(blurClass)) {
        $input.val('').removeClass(blurClass);
      }
    }

    // only apply logic if the element has the attribute
    if (title) { 
      // on blur, set value to title attr if text is blank
      $input.blur(function () {
        if (this.value === '') {
          $input.val(title).addClass(blurClass);
        }
      }).focus(remove).blur(); // now change all inputs to title

      // clear the pre-defined text when form is submitted
      $form.submit(remove);
      $win.unload(remove); // handles Firefox's autocomplete
    }
  });
  
  
 
};


