/*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="";

	//Funzione per lo scroll top
	$(".gotop").click(function(){
		$().scrollTo($("#colonnaDue"), 800);					   
	});
	
	//Funzione per la stampa della pagina
	$(".print").click(function(){
		window.open('print.asp','_new');
	});
	
	if($("body").is(".stampa")){
		window.print();
	}

	//Verifico i form
	$("form.verificaForm").verificaForm({tipoVisualizzazione:3});
	
	$("input[class^='styled']").custCheckBox();
	
	
	$("#internoLogin .input").bind("focus",function(){
		$(this).css("background-image","url(../images/assets/bg-inputSel.jpg)");
	}).bind("blur",function(){
		$(this).css("background-image","url(../images/assets/bg-input.jpg)");
	});
	
	$(".chiediConferma").click(function(){
		return chiediConferma(this);
	});
	
	altezzaBase=$(".espandibile").css("height");
	$(".linkEspandi").click(function(){
		if($(".espandibile").css("height")==altezzaBase){
			var currentHeight = $(".espandibile").height();
			$(".espandibile").css('height', 'auto');
			var height = $(".espandibile").height();
			$(".espandibile").css('height', currentHeight + 'px');
			
			$(".espandibile").animate({'height': height}, "slow");
			$(this).html("<span>Riduci</span>");
		}
		else{
			$(".espandibile").animate({'height': altezzaBase}, "slow");
			$(this).html("<span>Espandi</span>");
		}
	});
}

function chiediConferma(anchor){
	if (confirm("Sei sicuro? L'operazione non potra' essere annullata")){
		anchor.href += '&conferma=1';
		return true;
	}
	return false;
}
