var distance = 115;

function invis(){
  var s_width ='';
  var s_height ='';
  s_width=screen.width;
  s_height=screen.height;
    
    
  if (s_width == "640"){
   document.getElementById("object1").style.display="none";
  } 
    
  if (s_width == "800"){
   document.getElementById("object1").style.display="none";
  } 
    
  if (s_width == "1024"){
  document.getElementById("object1").style.display="block";
  distance = 50;
  } 
    
  if (s_width == "1152"){
   document.getElementById("object1").style.display="block";
   distance = 115;
  } 
    
  if (s_width == "1280"){
   document.getElementById("object1").style.display="block";
   distance = 178;
  } 
  
  if (s_width == "1440"){
   document.getElementById("object1").style.display="block";
   distance = 260;
  } 

}

function setVariables(){
	px="+'px'";
	if (navigator.appName == "Netscape") {
		if (parseInt(navigator.appVersion) >= 5){
			v=".top=";
			h=".left=";
			dS="document.getElementById(\"";
			sD="\").style";
			y="window.pageYOffset";
			x="window.pageXOffset";
		}
		else {
			v=".top=";
			h=".left=";
			dS="document.";
			sD="";
			y="window.pageYOffset";
			x="window.pageXOffset";
			px="";
		}
	}
	else {
		var validDoc=(document.compatMode && document.compatMode != "BackCompat")?1:0;
		h=".left=";
		v=".top=";
		dS="";
		sD=".style";
		y=(validDoc)?"document.documentElement.scrollTop":"document.body.scrollTop";
		x=(validDoc)?"document.documentElement.scrollLeft":"document.body.scrollLeft";
	}
	checkLocationA()
}

  movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0

function checkLocation(){
	object="object1";
	yy=eval(y);
	xx=eval(x);
	ydiff=ystart-yy;
	xdiff=xstart-xx;
	if ((ydiff<(-1))||(ydiff>(1))) movey=Math.round(ydiff/10),ystart-=movey
	if ((xdiff<(-1))||(xdiff>(1))) movex=Math.round(xdiff/10),xstart-=movex
	if (ystart>=83){
		eval(dS+object+sD+v+(ystart+10)+px);
	} else {
		eval(dS+object+sD+v+120+px);
	}

	
	eval(dS+object+sD+h+distance+px);
	setTimeout("checkLocation()",10);
}

function checkLocationA(){
	ystart=eval(y);
	xstart=eval(x);
}

function toggleInline(t) {
	var x = document.getElementById(t).style;
	if (x.display == 'inline') x.display = 'none';
	else x.display = 'inline';
	return false;
}

var theTarget = "_self";

function goThere(){
if(!document.theForm.theMenu.selectedIndex==""){
window.open(document.theForm.theMenu.options[document.theForm.theMenu.selectedIndex].value,theTarget,"");}
}

function commenti(str) {
   var w = 600;
   var h = 400;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
var searchWin = window.open(str,"commenti","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",scrollbars=yes" + ",resizable=yes");
searchWin.focus();
} 

function offerte_last_minute(str) {
   var w = 850;
   var h = 800;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
var searchWin = window.open(str,"offerte_last_minute","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",scrollbars=yes" + ",resizable=yes");
searchWin.focus();
} 

function offerte_manzi(str) {
   var w = 930;
   var h = 700;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
var searchWin = window.open(str,"offerte_last_minute","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",scrollbars=yes" + ",resizable=yes");
searchWin.focus();
} 

function come_prenoto() {
   var w = 720;
   var h = 460;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
      window.open("http://www.ischiahotel.net/prenotazioni_hotel_ischia.htm","","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
 }
 
 function miglior_prezzo() {
   var w = 720;
   var h = 460;
   var l = Math.floor((screen.width-w)/2);
   var t = Math.floor((screen.height-h)/2);
      window.open("http://www.ischiahotel.net/miglior_prezzo.php","","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
 }
 
 function apri_mappa(indirizzo) {
windowHandle = window.open('http://www.ischiahotel.net/mappa_hotel.php' + '?' + indirizzo,'mappa_hotel','resizable=no,width=830,height=530,left='+parseInt((screen.availWidth-700)/2)+',top='+parseInt((screen.availHeight-530)/2));
windowHandle.focus();
}

function apertura_mappa(indirizzo) {
windowHandle = window.open('http://www.ischiahotel.net/mappa_hotel.php' + '?' + indirizzo,'mappa_hotel','resizable=no,width=830,height=530,left='+parseInt((screen.availWidth-800)/2)+',top='+parseInt((screen.availHeight-530)/2));
windowHandle.focus();
}

function  campiobbligatori(){ 
var f = document.sampleform; 
if(f.nome.value == ""){ 
alert("Il campo \"nome\" non \è stato compilato") 
f.nome.focus(); 
return false; 
} 
if(f.cognome.value == ""){ 
alert("Il campo \"cognome\" non \è stato compilato") 
f.cognome.focus(); 
return false; 
}
if(f.email.value == ""){ 
alert("Il campo \"email\" non \è stato compilato") 
f.email.focus(); 
return false; 
} 
if(f.telefono.value == ""){ 
alert("Il campo \"telefono\" non \è stato compilato") 
f.telefono.focus(); 
return false; 
}
if(f.cellulare.value == ""){ 
alert("Il campo \"cellulare\" non \è stato compilato") 
f.cellulare.focus(); 
return false; 
} 
return true; 
}


function  motore(){ 
var f = document.sampleform; 
if(f.data_arrivo.value == ""){ 
alert("Devi indicare una data di arrivo") 
f.data_arrivo.focus(); 
return false; 
} 
if(f.data_partenza.value == ""){ 
alert("Devi indicare una data di partenza") 
f.data_partenza.focus(); 
return false; 
}
//if (!(f.trattamento_camera.checked)||(f.trattamento_camera_colazione.checked)||(f.trattamento_mezza_pensione.checked)||(f.trattamento_pensione_completa.checked)) {
//alert("Seleziona almeno un tipo di trattamento.");
//return false;
//}
return true; 
} 


function  controllo_recensioni(){ 
var f = document.recensioni; 
if(f.soddisfatto.value == ""){ 
alert("Non hai indicato se sei soddisfatto o meno dell'hotel") 
f.soddisfatto.focus(); 
return false; 
} 
if(f.gia_cliente_travelledia.value == ""){ 
alert("Non ha indicato se è un vecchio cliente della nostra agenzia") 
f.gia_cliente_travelledia.focus(); 
return false; 
}
if(f.scelta_hotel.value == ""){ 
alert("Indichi se l'hotel gliel'abbiamo proposto noi o l'ha scelto lei fin dall'inizio") 
f.scelta_hotel.focus(); 
return false; 
} 

if(f.prossima_vacanza.value == ""){ 
alert("Pensa che per la prossima vacanza prenderà contatti con noi nuovamente?") 
f.prossima_vacanza.focus(); 
return false; 
}

if(f.voto_hotel.value == ""){ 
alert("Non ha votato l'hotel") 
f.voto_hotel.focus(); 
return false; 
}

if(f.tipo_vacanza.value == ""){ 
alert("Non hai indicato con chi hai viaggiato") 
f.tipo_vacanza.focus(); 
return false; 
}

if(f.recensione.value == ""){ 
alert("Scrivi una piccola recensione sull'hotel") 
f.recensione.focus(); 
return false; 
}
return true; 
}



function faiApparire(){
document.getElementById('pulsante').style.display="none";
document.getElementById("campo").style.display="block";
}

function PopupPic(sPicURL) {
windowHandle = window.open("../immagini.php?"+sPicURL, "","resizable=1,height=200,widtht=200");
windowHandle.focus();
}




function  seleziona_pagamento(){ 
var f = document.modulo; 
if(!document.modulo.metodo_pagamento[0].checked && !document.modulo.metodo_pagamento[1].checked && !document.modulo.metodo_pagamento[2].checked){
alert("Seleziona un metodo di pagamento");
return false;
}
if(f.nome.value == ""){ 
alert("Il campo \"nome\" non \è stato compilato") 
f.nome.focus(); 
return false; 
} 
if(f.cognome.value == ""){ 
alert("Il campo \"cognome\" non \è stato compilato") 
f.cognome.focus(); 
return false; 
}
if(f.telefono1.value == ""){ 
alert("Il campo \"telefono 1\" non \è stato compilato") 
f.telefono1.focus(); 
return false; 
}
if(f.telefono2.value == ""){ 
alert("Il campo \"telefono 2\" non \è stato compilato") 
f.telefono2.focus(); 
return false; 
}
if(f.email.value == ""){ 
alert("Il campo \"email\" non \è stato compilato") 
f.email.focus(); 
return false; 
} 
if(f.campo_codice.value == ""){ 
alert("Il campo \"antispam\" non \è stato compilato") 
f.campo_codice.focus(); 
return false; 
}
if (f.conferma.checked == false) { 
alert("E' necessario spuntare il campo per l'accettazione per conferma di voler prenotare il pacchetto")
f.conferma.focus(); 
return false; 
}
return true; 
}
