  function searchHotelsFormSubmit(){    if(checkForm()){       document.hotelsSearch.submit();    }  }  function putCityValue(src,clr){    document.hotelsSearch.city.value=src;  }  function cleanUp(obj, txt){    if(obj.value == txt){       obj.value='';    }    return;  }  function hotAp(){    var wAirport=window.frames['hotFrame'];    if(null==wAirport.airportDepLoaded || false==wAirport.airportDepLoaded){       alert("No se pueden mostrar los Hoteles.\nPor favor, actualiza la página.");       return;    }    wAirport.showCity(window.parent.frames['0'].abCity, 1);  }  function dcal(eTrig, dMin, dMax, campo, fr, isExt) {    var wCal=window.frames['idCalendarFrame'];    if((document.flightsSearch) && (document.flightsSearch.depDate.value=='Soy flexible' && campo!='depDate')){        alert("Si pulsas sobre el boton buscar, el buscaprecios se encargara de mostrarte las fechas disponibles de retorno.");        return;    }    if(isExt=='true'){       wCal=window.frames['calendarFrameExt'];    }    if(null==wCal.frameIsLoaded || false==wCal.frameIsLoaded){       alert("No se puede mostrar el calendario.\nPor favor, actualiza la página.");       return;    }    if(eTrig==0){       if("sopsSearch"==fr){          wCal.showTheCalendarFrame(window.document.cal1via, dMin, dMax, campo,fr);       }else{          if("hotelsSearch"==fr){             wCal.showTheCalendarFrame(window.document.cal21hot, dMin, dMax, campo,fr);          }else{             wCal.showTheCalendarFrame(window.document.cal1bt, dMin, dMax, campo,fr);          }       }    }else{       if("hotelsSearch"==fr){          wCal.showTheCalendarFrame(window.document.cal2hot, dMin, dMax, campo,fr);       }else{          wCal.showTheCalendarFrame(window.document.cal2bt, dMin, dMax, campo,fr);       }    }  }  function anyadirDias(pDate,pTotalDias,ptipo){    fecha = new Date(pDate.substring(3,5) + "/" + pDate.substring(0,2)+ "/" + pDate.substring(6));    fecha.setTime(fecha.getTime()+(pTotalDias*24*60*60*1000));    dia = fecha.getDate();    if(dia<10){       dia = "0" + dia;    }    mes = fecha.getMonth()+1;    if(mes<10){       mes = "0" + mes;    }    return (ptipo=='data') ? dia+"/"+mes+"/"+takeYear(fecha) : takeYear(fecha)+""+mes+""+dia;  }  function takeYear(theDate){    x = theDate.getYear();    var y = x % 100;    y += (y < 38) ? 2000 : 1900;    return y;  }  function checkForm(){    //Check Destination    if(document.hotelsSearch.city.value==''){       alert("Please choose a city");       document.hotelsSearch.city.focus();       return false;    }    if(!parseDate(document.hotelsSearch.arrivalDate.value)){        alert("Invalid Arrival Date");        document.hotelsSearch.arrivalDate.focus();        return false;    }    if(!parseDate(document.hotelsSearch.departureDate.value)){        alert("Invalid Departure Date");        document.hotelsSearch.departureDate.focus();        return false;    }    //Check number of people per room (max 4 inc children)    var numadults = parseInt(document.getElementById('idnumadults').value);    var numchildren = parseInt(document.getElementById('idnumchildren').value);    var numpeoplehab = numadults + numchildren;    if(numpeoplehab > 4){       alert("Max 4 persons for room");       return false;    }    //Converting the two dates from gg/mm/aaaa to ggmmaaaa for the search-engine    var gg_mm_aaaa = document.hotelsSearch.arrivalDate.value;    var ggmmaaaa   = gg_mm_aaaa.substr(0, 2)                   + gg_mm_aaaa.substr(3, 2)                   + gg_mm_aaaa.substr(6, 4);    document.hotelsSearch.checkInDate.value = ggmmaaaa;        gg_mm_aaaa     = document.hotelsSearch.departureDate.value;    ggmmaaaa       = gg_mm_aaaa.substr(0, 2)                   + gg_mm_aaaa.substr(3, 2)                   + gg_mm_aaaa.substr(6, 4);    document.hotelsSearch.checkOutDate.value = ggmmaaaa;    return true;  }  function parseDate(dateString){    if(dateString.length != 10){       return false;    }    if((dateString.charAt(2) !='/') || (dateString.charAt(5) != '/')){        return false;    }    var diafecha, mesfecha, anyofecha;    var d       = new Date();    var diasmes = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];    diafecha    = dateString.substring(0, 2);    mesfecha    = dateString.substring(3, 5);    anyofecha   = dateString.substring(6);    if(isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)){       return false;    }    if(anyofecha < d.getYear()){       return false;    }    if((mesfecha < 1) || (mesfecha > 12)){        return false;    }    if((diafecha < 1) || (diafecha > diasmes[mesfecha])){        return false;    }    return true;  }