// JavaScript Document

	
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


var popup="";

function apriPOPUP(url,width,height) { 
	 if (popup!="")
	 {
	 popup.close();
	 } 
	var centX=screen.availWidth/2-width/2;
	var centY=screen.availHeight/2-height/2;
	popup=window.open(url,"popup","resizable=no,scrollbars=no,height="+height+",width="+width+",location=no,menubar=no,screenX=0,screenY=0,status=no,toolbar=no,top="+centY+",left="+centX);
	  popup.document.write('<html>\n<head>\n<title></title>\n</head>\n<body style="margin=0; padding=0" bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000" onload="preloadImages()">\n<a href="javascript:close()"><img style="margin=0; padding=0; border:none" src="'+url+'" alt="Clicca per chiudere"></a><br>\n</body>\n</html>\n');
	  popup.focus();
}



function close_div(id) {
	
	var elem = document.getElementById(id);
	
	if (elem.style.display == "block") {
		elem.style.display = (elem.style.display == "none")?"":"none";
		
		/*div_n.style.background = (div_n.style.background == "gray")?"":"gray";*/
	}
}



function toggle(id) {

	var elem = document.getElementById(id);
	
	if (elem.style.display == "block") {
		elem.style.display = (elem.style.display == "none")?"":"none";

	}
	
	else if (elem.style.display == "none") {
		elem.style.display = (elem.style.display == "block")?"":"block";
		
	}
	
}




function validate_prop() {
// Variabili associate ai campi del modulo
	 var nome = document.modulo.nome.value;
	 var cognome = document.modulo.cognome.value;
	 var tel = document.modulo.tel.value;
	 var email = document.modulo.email.value;
	 var conf_email = document.modulo.conf_email.value;
	 
	 // Espressione regolare dell\'email
	 var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	
		var err="Inserire i Dati Mancanti:\n\n";
		
		if ((nome == "") || (nome == "undefined")){
			   err+="Nome.\n";
			}
		if ((cognome == "") || (cognome == "undefined")){
			   err+="Cognome.\n";
			}
		if ((tel == "") || (tel == "undefined")){
			   err+="Telefono.\n";
			}
		if ((email == "") || (email == "undefined")){
			   err+="Indirizzo e-mail.\n";
			}
		if (!email_reg_exp.test(email) && email!=""){
			err+="L'indirizzo e-mail inserito non è valido.\n";
		}
		if ((arrivo == "") || (arrivo == "undefined")){
			   err+="Data di Inizio Soggiorno.\n";
			}
			
		if (err != "Inserire i Dati Mancanti:\n\n"){
			alert(err);
			return false;
		} else {
		   document.modulo.action = "./inviodati.php";
		   document.modulo.submit();
		}
}
