function loadimage(nameimage){  
     document.images["boxfoto"].src = nameimage;  
}  

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 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_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_popup_email(form){
if (checkemail(form.txt_email.value)) {
 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 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 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=427,height=361,scrollbars=0,status=0");
	break;
 }
}

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";
                }
            }
        }
    }
}


 function retrieveCookie( cookieName ) {
	/* retrieved in the format
	cookieName4=value; cookieName3=value; cookieName2=value; cookieName1=value
	only cookies for this domain and path will be retrieved */
	var cookieJar = document.cookie.split( "; " );
	for( var x = 0; x < cookieJar.length; x++ ) {
		var oneCookie = cookieJar[x].split( "=" );
		if( oneCookie[0] == escape( cookieName ) ) { return unescape( oneCookie[1] ); }
	}
	return null;
}

function setCookie( cookieName, cookieValue, lifeTime, path, domain, isSecure ) {
	if( !cookieName ) { return false; }
	if( lifeTime == "delete" ) { lifeTime = -10; } //this is in the past. Expires immediately.
	/* This next line sets the cookie but does not overwrite other cookies.
	syntax: cookieName=cookieValue[;expires=dataAsString[;path=pathAsString[;domain=domainAsString[;secure]]]]
	Because of the way that document.cookie behaves, writing this here is equivalent to writing
	document.cookie = whatIAmWritingNow + "; " + document.cookie; */
	document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) +
		( lifeTime ? ";expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "" ) +
		( path ? ";path=" + path : "") + ( domain ? ";domain=" + domain : "") + 
		( isSecure ? ";secure" : "");
	//check if the cookie has been set/deleted as required
	if( lifeTime < 0 ) { if( typeof( retrieveCookie( cookieName ) ) == "string" ) { return false; } return true; }
	if( typeof( retrieveCookie( cookieName ) ) == "string" ) { return true; } return false;
}

	var hm = 0;var ns = 0;var ie = 0;var wc = 0;if (document.getElementById) {wc = 1; hm = 1;} else if (document.all) {ie = 1; hm = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1)
	&& (browserVersion == 4)) {ns = 1; hm = 1;}} function dm(oi,ws) {if (ws == 1) { if (wc) return (document.getElementById(oi).style); else if (ie) return (document.all[oi].style); else if (ns) return (document.layers[oi]);}
	else {if (wc) return (document.getElementById(oi)); else if (ie) return (document.all[oi]); else if (ns) return (document.layers[oi]);}} function wd() {if (window.innerWidth != null) return window.innerWidth; if (document.body.clientWidth != null)
	return document.body.clientWidth; return (null);} function showAd(oi,tm,al) {if (hm) {var wp = wd(); ds = dm(oi,1); dx = dm(oi,0); if (dx.offsetWidth) ew = dx.offsetWidth; else if (dx.clip.width) ew = dx.clip.width; st = ds.visibility;
	if (st == "visible" || st == "show") ds.visibility = "hidden"; else {wp -= ew; if (al) wp /=2; else wp -= 10;if (!ns) wp += 'px'; ds.visibility = "visible"; setTimeout("showAd('"+oi+"')",tm * 1500);}}}

function overlaymgt()
{
 var myCookie = retrieveCookie("coockioverlay");
 if (myCookie==null) {
  	showAd('a1',12,0);
  	setCookie('coockioverlay', 'ON', '');
	 } 
}


window.onload= function(){
    /* pass the function the id of the top level UL */

    /* remove one, when only using one menu */
    activateMenu('nav_orizzontal');
    //overlaymgt();
}