
var mesesDimDays = new Array (31,28,31,30,31,30,31,31,30,31,30,31);

function nav_search() {
    index = document.getElementById('visit').nav.selectedIndex;
    if (index>0) {
        window.top.location=document.getElementById('visit').nav[index].value;
    }
}

function avanthotel(idioma) {
	
	if(idioma=='cat')
		idioma='ca';
    mes = document.getElementById('visit').mes[document.getElementById('visit').mes.selectedIndex].value;
    var today_date= new Date()
    any = today_date.getFullYear();
    if (mes>12) {
        mes = mes-12;
        any = any+1;
    }
    url = "http://www.mallorcahotelguide.com/maFront/cercaDisponibilitat.svr?"+
          "pasoDestino=resultados&campOrdenacio=preu&ordre=ASC&sql_max_records=10"+
          "&lang="+idioma+
          "&diaLlegada="+(document.getElementById('visit').dia.selectedIndex+1)+
          "&mesLlegada="+mes+"/"+any+
          "&noches="+(document.getElementById('visit').noches.selectedIndex+1)+
          "&zona="+document.getElementById('visit').zona[document.getElementById('visit').zona.selectedIndex].value+
          "&numHabitacions="+"1"+
          "&adultos_1="+(document.getElementById('visit').adultos.selectedIndex+1)+
          "&nins_1="+document.getElementById('visit').nins.selectedIndex+
          "&bebes_1="+document.getElementById('visit').bebes.selectedIndex;

  
    window.open(url);
}

function tablon(id,folder) {
   var url = "/vm/Impr";
   if (folder=="zonas") url = "/vm/ImprZona"; 
   url = url+"?itemId="+id+"&folder="+folder;
   var titulo = "visitmallorca"; 
   var finestra = window.open(url,titulo,"width=840,height=300,resizable=yes,scrollbars=yes");
   finestra.moveTo(200,100)
}


function writit(zonaId,zonaNom) {
            id = "nom_zona";
            text = zonaNom;
            if (document.getElementById) {
                x = document.getElementById(id);
                x.innerHTML = '';
                x.innerHTML = text;
            } else if (document.all) {
                x = document.all[id];
                x.innerHTML = text;
            } else if (document.layers) {
                x = document.layers[id];
                x.document.open();
                x.document.write(text);
                x.document.close();
            }
            
         }
  
function validarEmail(valor)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
	{
		return (true);
	}
	else
	{
	   return (false);
	}
}  
  
  
 function enviarForm(formulario,mensajeDeError){
  
  if (validarEmail(document.getElementById('email').value))
    	document.getElementById(formulario).submit();
    	else
    	alert(mensajeDeError);
      
}


