jQuery(document).ready(function() {
//JQuery ready is quicker than onload
jQuery('input.stdinput,textarea.stdinput').focus(function() {jQuery(this).addClass("stdinput-sel");}).blur(function() {jQuery(this).removeClass("stdinput-sel");});
jQuery('#sidebar ul li ul li,a.head,.links-list li').mouseover(function() {jQuery(this).addClass("over");}).mouseout(function() {jQuery(this).removeClass("over");}).click(function() {window.location = jQuery(this).find("a").get()});
jQuery('.easy-form').EasyForms();
jQuery('.entry p a').addClass('thickbox');
jQuery('#tile-view').ChangeView('tile');
jQuery('#list-view').ChangeView('list');
});

// Products View Changer
jQuery.fn.ChangeView=function(mode){
this.click( function() {
		//jQuery.blockUI();			
		var loading = $("body").append('<div id="loading">Loading...</div>');		
		jQuery.get("/prodotti_ajax.php", { action: mode}, function(data){			
		var response = jQuery('#gallery-products').html(data);		
		jQuery('#loading').remove();
			//alert("Data Loaded: " + data);
		});
		
	});	
}

// More usable Forms V 2.2  By Oliver Astrologo
jQuery.fn.EasyForms=function(){
this.submit( function() {
			var submitForm = this;
			jQuery(submitForm).find("label").not(".radiolabel").each(function(){
				var current=jQuery(this);
				var targetForm =  jQuery('#'+current.attr("for"));				
				if (targetForm.val() == current.html()){
				targetForm.val('');
				};																			  
			});
		return true;
	});	
	this.find("label").not(".radiolabel").each(function(){
		var current=jQuery(this);		
		var targetForm = jQuery('#'+current.attr("for"));
		if (targetForm.val() == ''){targetForm.val(current.html());}			
	    targetForm.click(function(){		
		if (jQuery(this).val() == current.html()){
			jQuery(this).val('');			
			}
		});
		targetForm.blur(function(){		
		if (jQuery(this).val() == ''){
			jQuery(this).val(current.html());			
			}
		});
		current.hide();	
	});			
}

