// JavaScript Document

//Funzione per la visualizzazione a scorrimento dell'agenda

	var intervalID;
	var var_top;
	function vis_agenda(var1) {
		//if(var1 == 300 && var_left == 0) return false; //Non fa ripetere la funzione se il suggerimento è già aperto
		var_top = var1;
		intervalID = setInterval("scorri(" + var1 + ")",15);
	} 
	function scorri(var1) {
		if (var1 <= -150) {
			var_top = var_top + 10;
			document.getElementById("agenda").style.top = var_top + "px";
			if (var_top >= -40) clearInterval(intervalID);
		} else {
			var_top = var_top - 10;
			document.getElementById("agenda").style.top = var_top + "px";
			if (var_top <= -150) clearInterval(intervalID);
		}
	}

//

//Funzione per la visualizzazione del Modal popup

function revealModal(divID,vocemenu)
{
    window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; };
    document.getElementById(divID).style.display = "block";
	//setup iniziale dei campi del form
		document.getElementById("evento").value = vocemenu;
		document.getElementById("nominativo").value = "";
		document.getElementById("ente").value = "";
		document.getElementById("email").value = "";
		document.getElementById("telefono").value = "";
		document.getElementById("sel_richiesta").selectedIndex = 0;
		document.getElementById("messaggio").value = "";
		document.getElementById("privacy").checked = false;
	//
    document.getElementById(divID).style.top = document.body.scrollTop;
}

function hideModal(divID)
{
    document.getElementById(divID).style.display = "none";
}

//Ricarica le foto per la nuova sezione

function ricarica_foto(n) {
	strHTML = "";
	strHTML += "<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" title=\"visualizzatore foto\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"620\" height=\"300\">";
	strHTML += "<param name=\"movie\" value=\"foto.swf?n=" + n + "\"> ";
	strHTML += "<param name=\"quality\" value=\"high\"> ";
	strHTML += "<param name=\"wmode\" value=\"transparent\"> ";
	strHTML += "<param name=\"allowScriptAccess\" value=\"always\"> ";
	strHTML += "<embed title=\"visualizzatore foto\" src=\"foto.swf?n=" + n + "\" quality=\"high\" wmode=\"transparent\" allowscriptaccess=\"always\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"620\" height=\"300\">";
	strHTML += "</object>";
	document.getElementById("foto").innerHTML = strHTML;
	//document.getElementById("ffoto").Play();
}

function controllo() {
	obj1 = document.getElementById("privacy");
	if(!obj1.checked) {
		alert("Confermare l'accettazione della privacy");
	}else{
		if(document.getElementById("nominativo").value == "" || document.getElementById("email").value == "" || document.getElementById("telefono").value == ""){
			alert("I campi Nominativo, E-mail e Telefono sono obbligatori!");
		}else{
			hideModal('modalPage');
			document.form1.submit();
		}
	}
}

function cambia_blocknotes(var1,n) {
	for(x=1; x<=n; x++) {
		document.getElementById("blocknotes_contenuto" + x).style.display = "none";
	}
	document.getElementById("blocknotes_contenuto" + var1).style.display = "block";
}