function popup(url, width, height)
{
settings="toolbar=no,location=no,directories=no,"+"status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height;
MyNewWindow=window.open(url,name,settings);
}

function popup_image(chemin)
{
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML>\n<HEAD>\n<TITLE>Image</TITLE>\n</HEAD>\n<BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)"></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()

}



function addPage() {
			if ((navigator.appName=="Microsoft Internet Explorer")&&(parseInt(navigator.appVersion)>=4)) {
			window.external.addFavorite(document.location.href, document.title);
			} else {
			var msg = "Your browser don't support this script '" + 	document.location.href + "' to bookmark!";
				if (navigator.appName=="Netscape") msg += " (CTRL-D)";
			alert(msg);
			}
}

function trim(x) 
		{
			return x.toString().replace(/^[ \t\r\n]+/,'').replace(/[ \t\r\n]+$/,'');
		}


//controlla il form nel campo contatti
function checkform(Form) 
{
   var descrErrore="";
   var errore = false;

   // Controllo sul Periodo
  if (trim(Form.periodosele.value).length==0) 
   {
   descrErrore += "\n- Please select the period of stay";
   errore = true
   }

   
   // Controllo sul campo name
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Please insert your \"Name\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }
   
    
   // Controllo sul campo e-mail
   if (trim(Form.email.value).length==0) 
   {
      descrErrore += "\n- Please insert your \"E-Mail\"";
      if (!errore) Form.email.focus();
      errore = true;
   }
   else 
   {
      // controllo forma dell'email
      if (Form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) 
      {
         descrErrore += "\n- Please insert your \"E-Mail\" like name@domain.ext";
         if (!errore) 
	 {
            Form.email.select();
            Form.email.focus();
         }
      errore = true;
      }
   }
   
   if (errore) 
   {
      window.alert(descrErrore);
      return false;
   }
   else 
   {
      return true;
   }

}



function readExtraRoom(nomeid) 
	{
	var nomediv=''+nomeid;
	
	ildiv=document.getElementById(nomediv);
		
	if (ildiv.style.display=="none")
			{
			ildiv.style.display = "block";
			} 
			else
					if (ildiv.style.display=="")
						{
								ildiv.style.display = "block";
								} 
									else
										{
										ildiv.style.display = "none";
										}
	}






function idhide(nomeid) 
{
	var menu;
	var nomeillink=nomeid+'link'

	if(document.getElementById) {
	menu=document.getElementById(nomeid);
	illink=document.getElementById(nomeillink);
	
 	menu.style.display = "none";
	illink.style.display = "block";
 		}
		return false;
}

function idshow(nomeid) 
{
	var menu;
	var nomeillink=nomeid+'link'

	if(document.getElementById) {
	menu=document.getElementById(nomeid);
	illink=document.getElementById(nomeillink);
	
   	menu.style.display = "block";
	illink.style.display = "none";

 		}
		return false;
}


function sign(nomeform,nometextarea,nometextareahidden)
	{
	var ilform=window.document.forms[nomeform];
	var lenform=ilform.elements.length;
	var contenuti='';
	
		if(document.getElementById) {			
		var areatesto=document.getElementById(nometextarea);
		var areatesto2=document.getElementById(nometextareahidden);
		
			for (var i=0;i<lenform;i++)
				{
				if (ilform.elements[i].type=="checkbox")
					{
						if (ilform.elements[i].checked==true)
							{
							var elemento=document.getElementById(ilform.elements[i].id);
							var ilnome=elemento.name;
							var idpres=ilnome.substring(6);
							
							var nomeid=prezzario['nome_'+idpres];
							var prezzoid=prezzario['prezzo_'+idpres];
							var trattamento=prezzario['trattamento_'+idpres];
							var tipoprezzo=prezzario['tipoprezzo_'+idpres];
														
							contenuti+=nomeid+': '+prezzoid+' / '+trattamento+' / '+tipoprezzo+'\n'; 
							}
					}
				}
				areatesto.value=contenuti;
				areatesto2.value=contenuti;
			}
	}
	
	
	
	
	
//controlla il form nel campo contatti nei dettagli lastminute
function checkform_lm(Form) 
{
   var descrErrore="";
   var errore = false;
   

   // Controllo sul campo name
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Please insert your \"Name\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }
   
    
   // Controllo sul campo e-mail
   if (trim(Form.email.value).length==0) 
   {
      descrErrore += "\n- Please insert your \"E-Mail\"";
      if (!errore) Form.email.focus();
      errore = true;
   }
   else 
   {
      // controllo forma dell'email
      if (Form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) 
      {
         descrErrore += "\n- Please insert your \"E-Mail\" like name@domain.ext";
         if (!errore) 
	 {
            Form.email.select();
            Form.email.focus();
         }
      errore = true;
      }
   }
   
     // Controllo sul campo camereselected
   if (trim(Form.camereselected.value).length==0) 
   {
      descrErrore += "\n- Please select a Lastminute Offer ";
    /*  if (!errore) Form.camereselected.focus();*/
      errore = true;
   }
   
   
   
   if (errore) 
   {
      window.alert(descrErrore);
      return false;
   }
   else 
   {
      return true;
   }

}
