//popup privacy

var usescroll='no'
function loadwindow(url,wid,hei,wtit){
var sW = (window.screen.width-wid)/2;
var sH = (window.screen.height-hei)/2;
	var miawin=window.open(url,wtit,
"toolbar=no,menubar=no,location=no,scrollbars="+usescroll+",resizable=no,height="+hei+",width="+wid+",top="+sH+",left="+sW);
miawin.focus();
}

//correggiPNG

function correggiPNG() 
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

//convalida form contatti

function formValidate() {
	if(document.forms[1].nome.value == ""){
		alert("Il campo 'Nome' è obbligatorio");
		document.forms[1].nome.focus();
		return false;		
	}
		else if(document.forms[1].cognome.value == ""){
		alert("Il campo 'Cognome' è obbligatorio");
		document.forms[1].cognome.focus();
		return false;		
	}
		else if(document.forms[1].mail.value == ""){
		alert("Il campo 'E-mail' è obbligatorio");
		document.forms[1].mail.focus();
		return false;		
	}
	else { return true }
}

function formValidate2() {
	if(document.prenotazione.cognome_camere.value == ""){
		alert("Il campo 'Cognome' è obbligatorio");
		document.prenotazione.cognome_camere.focus();
		return false;		
	}
		else if(document.prenotazione.mail_camere.value == ""){
		alert("Il campo 'E-mail' è obbligatorio");
		document.forms[1].mail_camere.focus();
		return false;		
	}
	else { return true }
}

function formValidate3() {
	if(document.prenotazione.data_ristorante.value == ""){
		alert("Il campo 'Giorno' è obbligatorio");
		document.prenotazione.data_ristorante.focus();
		return false;		
	}
		else if(document.prenotazione.orario_ristorante.value == ""){
		alert("Il campo 'Orario' è obbligatorio");
		document.forms[1].orario_ristorante.focus();
		return false;		
	}
		else if(document.prenotazione.persone_ristorante.value == ""){
		alert("Il campo 'Numero di persone' è obbligatorio");
		document.forms[1].persone_ristorante.focus();
		return false;		
	}
		else if(document.prenotazione.nome_ristorante.value == ""){
		alert("Il campo 'Nome' è obbligatorio");
		document.forms[1].nome_ristorante.focus();
		return false;		
	}
		else if(document.prenotazione.telefono_ristorante.value == ""){
		alert("Il campo 'telefono' è obbligatorio");
		document.forms[1].telefono_ristorante.focus();
		return false;		
	}
	else { return true }
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		menu_01_over = newImage("img/menu_01-over.gif");	
		menu_02_over = newImage("img/menu_02-over.gif");		
		menu_03_over = newImage("img/menu_03-over.gif");		
		menu_04_over = newImage("img/menu_04-over.gif");
		menu_05_over = newImage("img/menu_05-over.gif");
		menu_06_over = newImage("img/menu_06-over.gif");
		preloadFlag = true;
	}
}



