
/*
funzione apertura popup,
copyrights: Erik Henchoz - info@webnetstudio.it
vietato l'uso non autorizzato dello script
*/


function PrevFoto(img){
foto1= new Image();
foto1.src=(img);
Controllafoto(img);
}

function Controllafoto(img){
if((foto1.width!=0)&&(foto1.height!=0)){
vediFoto(img);
}
else{
funzione="Controllafoto('"+img+"')";
intervallo=setTimeout(funzione,20);
}
}

function vediFoto(img){
largh=foto1.width;
altez=foto1.height;
LeftPosition = (screen.width) ? (screen.width-largh)/2 : 0; 
TopPosition = (screen.height) ? (screen.height-altez)/2 : 0; 


	newWindow = window.open("","newWindow","width="+largh+",height="+altez+",left="+LeftPosition+",top="+TopPosition);
	newWindow.document.open();
	newWindow.document.write('<html><head><meta http-equiv="content-type" content="text/html;charset=iso-8859-1"><title>Hotel Italia</title>'); 
	
	newWindow.document.write('<style type="text/css" media="screen"><!--.opacity25{ filter:alpha(opacity=75); -moz-opacity:.75; opacity:.25;}}--></style></head>'); 
	newWindow.document.write('<style type="text/css" media="screen"><!--#livello { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; visibility: visible; display: block }--></style></head>'); 
	newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF" tracingopacity="47" tracingsrc="<http://www.gransanbernardo.it/js/wm.gif" tracingx="16" tracingy="8" onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<div id="livello"><table width='+largh+' border="0" cellspacing="0" cellpadding="0" align="center" height='+altez+' ><tr><td valign="bottom" background="'+img+'">');
	newWindow.document.write('<img class="opacity25" src="http://www.gransanbernardo.it/js/wm.gif" alt="" height="30" width="162" align="right alt=\"Clic per chiudere la finestra\" />'); 
	newWindow.document.write('</td></tr></table></div></body></html>');
	newWindow.document.close();
	newWindow.focus();




}




/*
funzione apertura popup senza wm,
copyrights: Erik Henchoz - info@webnetstudio.it
vietato l'uso non autorizzato dello script
*/


function PrevFotov(imgv){
foto1v= new Image();
foto1v.src=(imgv);
Controllafotov(imgv);
}

function Controllafotov(imgv){
if((foto1v.width!=0)&&(foto1v.height!=0)){
vediFotov(imgv);
}
else{
funzionev="Controllafotov('"+imgv+"')";
intervallov=setTimeout(funzionev,20);
}
}

function vediFotov(imgv){
larghv=foto1v.width;
altezv=foto1v.height;
LeftPositionv = (screen.width) ? (screen.width-larghv)/2 : 0; 
TopPositionv = (screen.height) ? (screen.height-altezv)/2 : 0; 


	newWindow = window.open("","newWindow","width="+larghv+",height="+altezv+",left="+LeftPositionv+",top="+TopPositionv);
	newWindow.document.open();
	newWindow.document.write('<html><head><meta http-equiv="content-type" content="text/html;charset=iso-8859-1"><title>Hotel Italia</title>'); 
	
	newWindow.document.write('<style type="text/css" media="screen"><!--.opacity25{ filter:alpha(opacity=75); -moz-opacity:.75; opacity:.25;}}--></style></head>'); 
	newWindow.document.write('<style type="text/css" media="screen"><!--#livello { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; visibility: visible; display: block }--></style></head>'); 
	newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF"  onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<div id="livellov"><table width='+larghv+' border="0" cellspacing="0" cellpadding="0" align="center" height='+altezv+' ><tr><td valign="bottom" background='+imgv+'>');
	
	newWindow.document.write('</td></tr></table></div></body></html>');
	newWindow.document.close();
	newWindow.focus();

}



/*
funzione controllo campi modulo email
copyrights: Erik Henchoz - info@webnetstudio.it
vietato l'uso non autorizzato dello script
*/


function verifica(form)
	{ if(form.nome.value  == "")   
		{alert("Introdurre il nome e cognome, grazie.");  
   form.nome.focus();
	return false;   
	} else if(form.email.value == "")                             
		{ alert("Introdurre una email come recapito di posta elettronica, grazie.");      
     form.email.focus();        
	return false; 
	}  else if(form.oggetto.value == "")                                      
		{alert("Introdurre l'oggetto del Messaggio, grazie.");        
       form.oggetto.focus();                  
	return false; 
	} else if(form.testo.value == "")            
		{alert("Scrivere il  vostro messaggio, grazie.");  
   form.testo.focus();         
	return false;                                  
	}
	 <!-- Controlla che sia un indirizzo di e-mail valido -->
  var pattern = form.email.value.match(/\S+@\S+\.\S+/);
  if (!pattern)
  { 
   	alert("Per favore controlla l'indirizzo email che hai inserito. Non sembra corretto.");
	form.email.focus();
    return (false);
}
 if (form.privacy.checked==false)
  {
    alert("Non hai dato l'autorizzazione per la privacy, leggi la mia informativa.");
    form.privacy.focus();
    return (false);
}



}


/*
funzione blocco tasto destro ed avvertimento
copyrights: Erik Henchoz - info@webnetstudio.it
vietato l'uso non autorizzato dello script
*/


function noRightClick() { 
if (event.button==2) { 
alert('Tutte le immagini ed i testi contenuti in questo sito web sono protetti da copyright, grazie.') 
} 
}
document.onmousedown=noRightClick 


/*
funzione apertura mappe google earth panoramio
copyrights: Erik Henchoz - info@webnetstudio.it
vietato l'uso non autorizzato dello script
*/


var stile = "top=20, left=20, width=500, height=500, status=no, menubar=no, toolbar=no scrollbar=no";
     function Popupmap(apri) {
        window.open(apri, "", stile);
     }



/*
funzione invio prenotazione
copyrights: Erik Henchoz - info@webnetstudio.it
vietato l'uso non autorizzato dello script
*/

function sendpre(form)
	{ if(form.nome.value  == "")   
		{alert("Introdurre il  Vostro nome e cognome.");  
   form.nome.focus();
	return false;  
	} else if(form.nazione.value == "")            
		{alert("Introdurre la vostra nazionalitą.");  
   form.nazione.focus();         
	return false;
	} else if(form.indirizzo.value == "")            
		{alert("Introdurre il vostro indirizzo.");  
   form.indirizzo.focus();         
	return false;     
	} else if(form.citta.value == "")            
		{alert("Introdurre la cittą o il paese di residenza.");  
   form.citta.focus();         
	return false;    
	} else if(form.email.value == "")                             
		{ alert("Introdurre la Vostra email.");      
     form.email.focus();        
	return false;     
	} else if(form.telefono.value == "")            
		{alert("Introdurre un recapito telefonico.");  
   form.telefono.focus();         
	return false;             
	}  else if(form.arrivo.value == "")                                      
		{alert("Introdurre la data di arrivo.");        
       form.arrivo.focus();                  
	return false; 
	} else if(form.partenza.value == "")            
		{alert("Introdurre la data di partenza.");  
   form.partenza.focus();         
	return false; 
	} else if(form.ospiti.value == "")                             
		{ alert("Introdurre lil numero di ospiti.");      
     form.ospiti.focus();        
	return false;      
	
	 
     	}      
     	
    <!-- Controlla che sia un indirizzo di e-mail valido -->
  var pattern = form.email.value.match(/\S+@\S+\.\S+/);
  if (!pattern)
  { 
   	alert("Per favore inserisci un'email valida!");
	form.email.focus();
    return (false);
  }

 if (form.privacy.checked==false)
  {
    alert("Non hai dato l'autorizzazione per la privacy. Per poterti iscrivere devi leggere l'informativa sulla privacy e dare il tuo consenso al trattamento dei dati.");
    form.privacy.focus();
    return (false);
}
}

