function apri_finestra(percorso,modalita){
switch (modalita){
 case 1 : //popup opzioni email
	window.open(percorso,"email","width=420,height=410,scrollbars=0,status=0");
	break;	
 case 2 : //popup stampa
	window.open(percorso,"stampa","width=450,height=410,scrollbars=1,status=0");
	break;	
case 3 : //popup mappa
	window.open(percorso,"","width=419,height=335,scrollbars=0,status=0");
	break;
 }
}

function openwin(url)
	{
	var temp=open(url,"","width=450,height=500,statusbar=no,scrollbars=yes")
	}

function verifica_popup_email(form){
if ((form.txt_nome_mittente.value=="") || (form.txt_nome_destinatario.value=="") || (form.txt_email.value=="")){
 alert("ATTENZIONE: Occorre riempire tutti i campi per inviare l'email");}
else{
 form.submit();
 }

}

function verifica_richiesta_info(form){
if (checkemail(form.txtemail.value)) {
 if (((form.txtnomecognome.value=="") || (form.txttelefono.value=="") || (form.txtemailvalue=="") || (form.txtrichiesta.value==""))){
  alert("ATTENZIONE: Occorre riempire tutti i campi !!!");}
 else{
  form.submit();
 }
 }
}


function verifica_semplice_textbox(form, element){
var elemento = eval('form.' + element);
if (elemento.value==""){
 alert("ATTENZIONE: Occorre che il campo non sia vuoto!!!");}
else{
 form.submit();
 }
}

function verifica_semplice_textbox_numero_carattere(form, element){
var elemento = eval('form.' + element);
if ((elemento.value=="") || (elemento.value.length < 3)){
 alert("ATTENZIONE: Occorre che il campo non sia vuoto e vi siano almeno tre caratteri!!!");}
else{
 form.submit();
 }
}

function combo_pagina(val){
if (val!=""){window.location.href=val;}
}

function checkemail(emailAddress) { 
 emailAddress=emailAddress 
 if (emailAddress.indexOf ('@',0) == -1 || emailAddress.indexOf ('.',0) == -1) { 
  alert("\nL' E-mail deve contenere \"@\" e uno o pił \".\"") 
  return false; 
 } 
 else
 { 
 return true;
 } 
} 

function stampadata(){
 var days=new Array('Domenica','Luned&igrave;','Marted&igrave;','Mercoled&igrave;','Gioved&igrave;','Venerd&igrave;','Sabato');
 var months=new Array('Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre');
 var dateObj=new Date();
 var lmonth=months[dateObj.getMonth()];
 var anno=dateObj.getFullYear();
 var date=dateObj.getDate();
 var wday=days[dateObj.getDay()];
 document.write(' ' + wday + ' ' + date + ' ' + lmonth + ' ' + anno);
}

function verifica_login(form, element1, element2){
var login = eval('form.' + element1);
var password = eval('form.' + element2);
if ((login.value=="") || (password.value=="")){
 alert("ATTENZIONE: Occorre che il campo non sia vuoto!!!");}
else{
 form.submit();
 }
}

function changemonth(moveby) { 
document.calform.calmonth.value = document.calform.calmonth.value - 0 + moveby;
document.calform.submit(); 
}
function changeyear(moveby) { 
document.calform.calyear.value = document.calform.calyear.value - 0 + moveby; 
document.calform.submit(); 
}

activateMenu = function(nav) {

/* currentStyle restricts the Javascript to IE only */
	if (document.all &&
 document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */

        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
