function buscaProductos(formu,textoerror){if(document.getElementsByName("asoc")[0].value=="Todos"||document.getElementsByName("asoc")[0].value=="Tous"||document.getElementsByName("asoc")[0].value=="Alle"||document.getElementsByName("asoc")[0].value=="All")
alert(textoerror);else
{document.getElementsByName("buscoalojamientos")[0].value="0";document.getElementsByName("buscoproductos")[0].value="1";document.getElementsByName(formu)[0].submit();}}
function buscaTA(formu){var tipoa=document.getElementsByName("tipoactividades")[0].value;var acti=document.getElementsByName("actividades")[0].value;if(document.getElementById("buscomuseos").value==1)
{tipoa=document.getElementsByName("tipoactividadesMU")[0].value;acti=document.getElementsByName("actividadesMU")[0].value;}
document.getElementsByName("buscoalojamientos")[0].value="0";document.getElementsByName("buscoproductos")[0].value="0";document.getElementsByName("buscoTA")[0].value="1";window.location=location.href+"/index.php/resultadosta/?actividades="+acti+"&tipoactividades="+tipoa+"&zona_actividades="+document.getElementsByName("zona_actividades")[0].value+"&arrivalDateTA="+document.getElementsByName("arrivalDateTA")[0].value;}
function buscaAlojamientos(formu,textoerror){if((document.getElementsByName("zona_alrededores")[0].value==""||document.getElementsByName("zona_alrededores")[0].value.indexOf("...")!=-1)&&(document.getElementsByName("region")[0].value=="Todos"||document.getElementsByName("region")[0].value=="Tous"||document.getElementsByName("region")[0].value=="Alle"||document.getElementsByName("region")[0].value=="All"))
alert(textoerror);else
{document.getElementsByName("buscoalojamientos")[0].value="1";document.getElementsByName("buscoproductos")[0].value="0";document.getElementsByName(formu)[0].submit();}}
function isValueInArray(arr,val)
{inArray=false;for(i=0;i<arr.length;i++)
if(val==arr[i])
inArray=true;return inArray;}
function ocultacombos(){if(document.getElementsByName('ptype')[0].value=='1'||document.getElementsByName('ptype')[0].value=='13'||document.getElementsByName('ptype')[0].value=='Todos'||document.getElementsByName('ptype')[0].value=='All'||document.getElementsByName('ptype')[0].value=='Alle'||document.getElementsByName('ptype')[0].value=='Tous'||document.getElementsByName('ptype')[0].value=='9'||document.getElementsByName('ptype')[0].value=='11'
||document.getElementsByName('ptype')[0].value=='12')
{document.getElementById('personas').style.display='none';document.getElementById('personas').value='';document.getElementById('divhabitaciones').style.display='';document.getElementById('habits').style.display='';document.getElementsByName('people')[0].options[0].value='';}
else
{document.getElementById('habitacion-1').value='2';document.getElementById('habitacion-2').value='';document.getElementById('habitacion-3').value='';document.getElementById('habitacion-4').value='';document.getElementById('habits').style.display='none';document.getElementById('habitaciones').value='1';document.getElementById('personas').style.display='';document.getElementById('divhabitaciones').style.display='none';}}
function ocultacombosTR(){if(document.getElementsByName('ptypetr')[0].value=='1'||document.getElementsByName('ptypetr')[0].value=='13'||document.getElementsByName('ptypetr')[0].value=='12'||document.getElementsByName('ptypetr')[0].value=='Todos'||document.getElementsByName('ptypetr')[0].value=='All'||document.getElementsByName('ptypetr')[0].value=='Alle'||document.getElementsByName('ptypetr')[0].value=='Tous'||document.getElementsByName('ptypetr')[0]=='9'||document.getElementsByName('ptypetr')[0].value=='11')
{document.getElementById('personas').style.display='none';document.getElementById('personas').value='';document.getElementById('divhabitaciones').style.display='';document.getElementById('habits').style.display='';document.getElementsByName('people')[0].options[0].value='';}
else
{document.getElementById('habitacion-1').value='2';document.getElementById('habitacion-2').value='';document.getElementById('habitacion-3').value='';document.getElementById('habitacion-4').value='';document.getElementById('habits').style.display='none';document.getElementById('habitaciones').value='1';document.getElementById('personas').style.display='';document.getElementById('divhabitaciones').style.display='none';document.getElementById('ptype').value=document.getElementById('ptypetr').value;}}
function ocultacombosRT(){if(document.getElementById('ptypeRT')){if(document.getElementById('ptypeRT').value=='1'||document.getElementById('ptypeRT').value=='13'||document.getElementById('ptypeRT').value=='12'
||document.getElementById('ptypeRT').value=='Todos'
||document.getElementById('ptypeRT').value=='All'||document.getElementById('ptypeRT').value=='Alle'||document.getElementById('ptypeRT').value=='Tous'
||document.getElementById('ptypeRT').value=='9'
||document.getElementById('ptypeRT').value=='11')
{document.getElementById('personasRT').style.display='none';document.getElementById('divhabitacionesRT').style.display='';document.getElementById('habitsRT').style.display='';document.getElementsByName('peopleRT')[0].options[0].selected=true;document.getElementsByName('peopleRT')[0].options[0].value='';}
else
{document.getElementById('RThabitacion-1').value='2';document.getElementById('RThabitacion-2').value='2';document.getElementById('RThabitacion-3').value='2';document.getElementById('RThabitacion-4').value='2';document.getElementById('habitsRT').style.display='none';document.getElementById('personasRT').style.display='';document.getElementById('divhabitacionesRT').style.display='none';}}}
function trimBuscador(cadena){for(i=0;i<cadena.length;)
{if(cadena.charAt(i)==String.fromCharCode(160))
cadena=cadena.substring(i+1,cadena.length);else
break;}
for(i=cadena.length-1;i>=0;i=cadena.length-1)
{if(cadena.charAt(i)==String.fromCharCode(160))
cadena=cadena.substring(0,i);else
break;}
return cadena;}
function LTrim(value){var re=/\s*((\S+\s*)*)/;return value.replace(re,"$1");}
function RTrim(value){var re=/((\s*\S+)*)\s*/;return value.replace(re,"$1");}
function trim(value){return LTrim(RTrim(value));}
function yLength(y){y=(parseInt(y)<100?"20"+y:y);return y;}
function mLength(m){m=(m.length==1?"0"+m:m);return m;}
function combo(disp){for(var f=0;f<document.forms.length;f++){for(var e=0;e<document.forms[f].length;e++){if(disp=="none"){if(document.forms[f].elements[e].options)document.forms[f].elements[e].style.display="none";}else{if(document.forms[f].elements[e].options)document.forms[f].elements[e].style.visibility="visible";}}}}
function cambiarOcupacionRT(which,val)
{var n=val.split('-')[1];n=(n?parseInt(n):0);if(n==0)
{document.getElementById("RTedades"+which).style.display="none";document.getElementById("RTedades"+which).value="";for(var i=1;i<4;i++)
{document.getElementById("RTedad"+which+"-"+i).style.display="none";document.getElementById("RTedad"+which+"-"+i).value="";}}
else
{document.getElementById("RTedades"+which).style.visibility="visible";document.getElementById("RTedades"+which).style.display="";for(var i=1;i<4;i++)
{document.getElementById("RTedad"+which+"-"+i).style.display="none";document.getElementById("RTedad"+which+"-"+i).value="";}
for(i=1;i<=n;i++)
{document.getElementById("RTedad"+which+"-"+i).style.visibility="visible";document.getElementById("RTedad"+which+"-"+i).style.display="";}}}
function cambiarOcupacion(which,val)
{var n=val.split('-')[1];n=(n?parseInt(n):0);if(n==0)
{document.getElementById("edades"+which).style.display="none";document.getElementById("edades"+which).value="";for(var i=1;i<4;i++)
{document.getElementById("edad"+which+"-"+i).style.display="none";document.getElementById("edad"+which+"-"+i).value="";}}
else
{document.getElementById("edades"+which).style.visibility="visible";document.getElementById("edades"+which).style.display="";for(var i=1;i<4;i++)
{document.getElementById("edad"+which+"-"+i).style.display="none";document.getElementById("edad"+which+"-"+i).value="";}
for(i=1;i<=n;i++)
{document.getElementById("edad"+which+"-"+i).style.visibility="visible";document.getElementById("edad"+which+"-"+i).style.display="";}}}
function cambiarHabitaciones(val)
{for(var i=1;i<5;i++)
{document.getElementById("hab"+i).style.display="none";if(val<i)document.getElementById("habitacion-"+i).value="2";document.getElementById("edades"+i).style.display="none";document.getElementById("edades"+i).value="";}
for(i=1;i<=val;i++)
{document.getElementById("hab"+i).style.visibility="visible";document.getElementById("hab"+i).style.display="";}}
function cambiarHabitacionesRT(val)
{for(var i=1;i<5;i++)
{document.getElementById("RThab"+i).style.display="none";if(val<i)document.getElementById("RThabitacion-"+i).value="2";document.getElementById("RTedades"+i).style.display="none";document.getElementById("RTedades"+i).value="";}
for(i=1;i<=val;i++)
{document.getElementById("RThab"+i).style.visibility="visible";document.getElementById("RThab"+i).style.display="";}}
function VhPDYvfFNSpaq(arrivalDate,thisform){var dformat="%d-%m-%Y"
var newday=0
var day=0
var mon=0
var year=0
if(dformat=="%d/%m/%Y"){dateArray=arrivalDate.split("/")
day=dateArray[0]
mon=dateArray[1]
year=dateArray[2]}
if(dformat=="%Y/%m/%d"){dateArray=arrivalDate.split("/")
day=dateArray[2]
mon=dateArray[1]
year=dateArray[0]}
if(dformat=="%m/%d/%Y"){dateArray=arrivalDate.split("/")
day=dateArray[1]
mon=dateArray[0]
year=dateArray[2]}
if(dformat=="%d-%m-%Y"){dateArray=arrivalDate.split("-")
day=dateArray[0]
mon=dateArray[1]
year=dateArray[2]}
if(dformat=="%Y-%m-%d"){dateArray=arrivalDate.split("-")
day=dateArray[2]
mon=dateArray[1]
year=dateArray[0]}
if(dformat=="%m-%d-%Y"){dateArray=arrivalDate.split("-")
day=dateArray[1]
mon=dateArray[0]
year=dateArray[2]}
var d=new Date(year,mon-1,day);with(d)setDate(getDate()+1)
sday=String(d.getDate());smonth=String(d.getMonth()+1);if(sday.length==1)
fday="0"+sday;else
fday=sday;if(smonth.length==1)
fmonth="0"+smonth;else
fmonth=smonth;if(dformat=="%d/%m/%Y"){dd=fday+"/"+fmonth+"/"+String(d.getFullYear())}
if(dformat=="%Y/%m/%d"){dd=String(d.getFullYear())+"/"+fmonth+"/"+fday}
if(dformat=="%m/%d/%Y"){dd=fmonth+"/"+fday+"/"+String(d.getFullYear())}
if(dformat=="%d-%m-%Y"){dd=fday+"-"+fmonth+"-"+String(d.getFullYear())}
if(dformat=="%Y-%m-%d"){dd=String(d.getFullYear())+"-"+fmonth+"-"+fday}
if(dformat=="%m-%d-%Y"){dd=fmonth+"-"+fday+"-"+String(d.getFullYear())}
if (document.getElementById('departureDate')) document.getElementById('departureDate').value=dd;}
