/*Funzioni Per Jquery*/
$(document).ready(
	function () {
		applicaAlLoad();
	}
);

//Funzioni richiamate direttamente al loading
function applicaAlLoad(idElemento){
	if(idElemento!=null&&idElemento!=undefined){
		if(idElemento.substr(0,1)!="#") idElemento="#"+ idElemento;
		idElemento+=" ";
	}
	else
		idElemento="";

	$("#cerca").focus(function(){
		if($(this).attr("value")=='Ricerca libera...')
			$(this).attr("value","");
	}).blur(function(){
		if($(this).attr("value")=='')
			$(this).attr("value","Ricerca libera...");
	});
	
	$("#formCerca input[type='button']").click(function(){
		if($("#cerca").val()!='' && $("#cerca").val()!='Ricerca libera...')
			$("#formCerca").submit();
	});
	
	$(".resetForm").click(function(){
		$(this).parents("form")[0].reset();
	});
	$(".inviaForm").click(function(){
		$(this).parents("form").submit();
	});	
	
	/*Abilito il Jtip*/
	$(".tooltip")
		   .hover(function(){
				idA=$(this).attr("id").replace(/img[0-9]+_/,"");
				
				JT_show(this.id,'Figura:','<img src=\'images/tooltip/'+ idA +'.gif\' alt=\'Crociera '+ idA +'\'>')},function(){$('#JT').remove()})
           .click(function(){return false});	   
}
