function goTo(){
	var aqui = document.forms['SearchHotel'].elements['Hotels'].options[document.forms['SearchHotel'].elements['Hotels'].selectedIndex].value;
	var aqui2 = document.forms['SearchHotel'].elements['Ciutats'].options[document.forms['SearchHotel'].elements['Ciutats'].selectedIndex].value;
	if ((aqui != null)&&(aqui != '')) {
		location.href = aqui;
	}
	else if ((aqui2 != null)&&(aqui2 != '')) {
		location.href = aqui2;
	}
}

function Destaca(urlIMG, id){
	document.images.fotodestacada.src = urlIMG;
	/*
	for (i=1; i<9; i++) {
		eval("document.images.b"+i).src = "../img/tour/boto0"+i+".jpg";
	}
	
	if (id < 10)	eval("document.images.b"+id).src = "../img/tour/boto0"+id+"m.jpg";
	else			eval("document.images.b"+id).src = "../img/tour/boto"+id+"m.jpg";^
	*/
}

function DestacaOLD(urlIMG, id){
	document.images.fotodestacada.src = urlIMG;
	for (i=1; i<9; i++) {
		eval("document.images.b"+i).src = "../img/tour/boto0"+i+".jpg";
	}
	
	if (id < 10)	eval("document.images.b"+id).src = "../img/tour/boto0"+id+"m.jpg";
	else			eval("document.images.b"+id).src = "../img/tour/boto"+id+"m.jpg";
}

function Destaca2(urlIMG, id){
	document.images.fotodestacada.src = urlIMG;
	for (i=1; i<10; i++) {
		eval("document.images.b"+i).src = "../img/tour/boto0"+i+".jpg";
	}
	for (i=10; i<17; i++) {
		eval("document.images.b"+i).src = "../img/tour/boto"+i+".jpg";
	}
	if (id < 10)	eval("document.images.b"+id).src = "../img/tour/boto0"+id+"m.jpg";
	else			eval("document.images.b"+id).src = "../img/tour/boto"+id+"m.jpg";
}

function openWindow(URL,Name,Properties){
	open(URL,Name,Properties);
}

function jump(URL){
	parent.location.href=URL;
}

function reloadOpener() {
 	// Recarga la ventana que abrió a la que ejecuta este javascript.
	if (self.opener) self.opener.location.reload();
}

function obreFoto (imatge){
			    planol = open("",'planol',"width=397,height=397,top=50,left=50,resizable=yes");
				planol.document.write("<html>");
				planol.document.write("<script>");
				planol.document.write("		setTimeout('redimensiona()', 2000);");
				planol.document.write("		function redimensiona()");
				planol.document.write("		{");
				planol.document.write("			width = self.document.imatge.width;");
				planol.document.write("			height = self.document.imatge.height;");
				planol.document.write("			window.resizeTo(width+6, height+32);");
				planol.document.write("		}");
				planol.document.write("</script>");
				planol.document.write("   <body lefmargin=0 topmargin=0 leftmargin=0 rightmargin=0 marginheight=0 marginwidth=0>");
	  			planol.document.write("      <img name=\"imatge\" src=index.html border=0>");
	  			planol.document.write("   </body>");
				planol.document.write("
<!-- Mirrored from www.eurostarshotels.com/js/utilitats.js by HTTrack Website Copier/3.x [XR&CO'2007], Tue, 23 Jan 2007 10:14:23 GMT -->
</html>");
				width = planol.document.images[0].width;
				height = planol.document.images[0].height;
				planol.resizeTo(width+6, height+32);
}

function newWin(){
	nova = open("","nw","scrollbars=yes,top=50,left=50,width=640,height=500,resizable=yes");
	nova.document.open();
	nova.document.write("<h1>.../...</h1>");
	nova.document.close();
	self.frm1.submit();
}

function fesGran(i){
	document.images.fotogran.src=eval("document.images.foto"+i+".src");
	document.images.fotogran.alt=eval("document.images.foto"+i+".alt");
	self.location.href="#inici";
}

function setDataAvui(){	
	var avui = new Date();
	self.frm2.fent_dia.value=avui.getDate();
	self.frm2.fent_mes.value=avui.getMonth()+1;
	self.frm2.fent_any.value=avui.getYear();
}

function descOn(){
	self.frm3.descfoto.value="hotusa";
}

function descOff(){
	self.frm3.descfoto.value="";
}

function comprueba_mail(dir)
{	
	var car='';
	var encon='no';
	var longi=dir.length;
	e=0;
	for (i=0;i<longi;i++)
	{
		car=dir.charAt(i);
		if (car=='@')
		{
			encon='si';
			posarroba=i;
		} 
    } 
	if (encon=='no')	
	{
		e=1;
	}  
	else
	{
		//existe la arroba, se comprueba que haya algo antes
		if (posarroba==0)
		{
			e=1;
		}
		else
		{
			//existe la arroba y no esta en la primera posicion
			//se comprueba que despues de la arroba hay algo
		    if (posarroba==dir.length - 1)
			{
				e=1;
			}
			else
			{	//existe la arroba y no esta en la primera posicion
				// y despues hay algo, se comprueba que no sea un punto    
				car=dir.charAt(posarroba+1)
				if (car=='.'){
					e=1;
				}
				else{
					//existe la arroba y no esta en la primera posicion
					// y despues hay algo distinto de punto
					//se comprueba que lo ultimo no sea un punto
					car=dir.charAt(dir.length - 1);
					if (car=='.'){
						e=1;
					} 
					else{
					 //finalmente se comprueba que haya un punto despues de la arroba
					 var ar2='';
					 encon2='no'
					 for(k=posarroba;k<dir.length;k++){ 
					  car2=dir.charAt(k);
					  if (car2=='.'){
					     encon2='si';
					   }  
					 }
					 if (encon2=='no'){
						e=1;
					  } 
					}
				}  	
			} 
		}	
	}
	return e;
}

function saveCookie(name,value,days) {
        if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000))
                var expires = "; expires="+date.toGMTString()
        }
        else expires = ""
        document.cookie = name+"="+value+expires+"; path=/"
}

function deleteCookie(name) {
         saveCookie(name,"",-1);
         location.href='index.html'; 

}

function readCookie(name) {
        var nameEQ = name + "="
        var ca = document.cookie.split(';')
        for(var i=0;i<ca.length;i++) {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length)
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
        }
        return null
}

function comprueba(){
	if (readCookie('lengua')){
	    x=readCookie('lengua')
		saveCookie('lengua',x,666)
   	    location=readCookie('lengua');
	}else{
		x=document.getElementById('capaIntro'); 
		x.style.display="block";
	}
}
		function abrirmenu(id){
	x = document.getElementById(id);
	x.style.display = 'block';
}

function cerrarmenu(id){
	x = document.getElementById(id);
	x.style.display = 'none';
}

function favoritos(){
   if ((navigator.appName=="Microsoft Internet Explorer") && 
         (parseInt(navigator.appVersion)>=4)) {
      var url="http://www.eurostarshotels.com"; 
      var titulo="Eurostars Hotels";
      window.external.AddFavorite(url,titulo);
   } else { 
      if(navigator.appName == "Netscape") 
         alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
   }
} 
