//funzione che si occupa dell'effetto over
function IniPulsanti(){
	$(".btn").each(function() {
		var percorso = $(this).attr("src").split(".");
		$(this).hover(	function () {$(this).attr({src: "." + percorso[1] + "over." + percorso[2]});}, 
            			function () {$(this).attr({src: "." + percorso[1] + "." + percorso[2]}); });
	});
	
}

//funzione che si occupa delle png per IE6
function IniPng(){
	if ($.browser.msie) {
		if ($.browser.version < 7) {
			//alert($.browser.version);
			$("img[@src$=png],div").pngfix({sizingMethod: "scale"});
		}
					
	} 
	
}

//funzione che centra il sito orizontalmente
function IniMiddle(){
	var paddingTop = ($(this).height())-($('.nessuna').height());
		paddingTop= paddingTop/2;
		var cssObj = { 	"padding-top": paddingTop + "px" };
		$('#pagina').css(cssObj);
	$(window).resize(
		function(){
			var paddingTop = ($(this).height()-$('.nessuna').height())/2;
			var cssObj = { 	"padding-top": paddingTop + "px" };
			$('#pagina').css(cssObj);
		}
	);
}

//funzione che inizializza e gestisce il calendario in Ajax
var precedente = -1;
var successivo = 1;

function IniAjax(){
	$("#results").ajaxStart(function(){ InsData('<img src="./img/ajaxLoader.gif" width="43" height="43" style="margin-top: 50px;"/>'); });
	$.ajax( {url: "calendario.php", cache: false, success: function(html){InsData(html);} });
	$('#prec').click(function(){
						$.ajax( {url: "calendario.php?variazione=" + precedente , cache: false, success: function(html){InsData(html);}	});
						precedente -=1;
						successivo -=1;
					});
	$('#succ').click(function(){
						$.ajax( {url: "calendario.php?variazione=" + successivo , cache: false, success: function(html){InsData(html);}	});
						precedente +=1;
						successivo +=1;
					});
}

//funzione che inserisce la risposta Ajax del calendario
function InsData(html){
	$("#results").html(html);
}

//funzione che esegue la fotogallery
function fotografie(link){
document.getElementById('fotoprincipale').src = link;
return false;
}
