var addressStart ="";function close_layers() {	if((document.getElementById("depFrameSal")) && (document.getElementById("depFrameSal").style.display=='block')) {		document.getElementById("depFrameSal").style.display='none';	}	if((document.getElementById("depFrameArr")) && (document.getElementById("depFrameArr").style.display=='block')) {		document.getElementById("depFrameArr").style.display='none';	}	if((document.getElementById("hotFrame")) && (document.getElementById("hotFrame").style.display=='block')) {		document.getElementById("hotFrame").style.display='none';	} 	if (document.getElementById("defCityBox")){ 		document.getElementById("defCityBox").style.display = 'none'; 	}	if (document.getElementById("defCityBoxShim")){		document.getElementById("defCityBoxShim").style.display = 'none';	}	if((document.getElementById("idFrameAirlines")) && (document.getElementById("idFrameAirlines").style.display=='block')){		document.getElementById("idFrameAirlines").style.display='none';	}	if((document.getElementById("idFrameCityDeparture")) && (document.getElementById("idFrameCityDeparture").style.display=='block')){		document.getElementById("idFrameCityDeparture").style.display='none';	}	if((document.getElementById("idFrameCityArrival")) && (document.getElementById("idFrameCityArrival").style.display=='block')){		document.getElementById("idFrameCityArrival").style.display='none';	}	if((document.getElementById("idFrameCityPicker")) && (document.getElementById("idFrameCityPicker").style.display=='block')){		document.getElementById("idFrameCityPicker").style.display='none';	}	if((document.getElementById("idFrameDynCityDeparture")) && (document.getElementById("idFrameDynCityDeparture").style.display=='block')){		document.getElementById("idFrameDynCityDeparture").style.display='none';	}	if((document.getElementById("idFrameDynCityArrival")) && (document.getElementById("idFrameDynCityArrival").style.display=='block')){		document.getElementById("idFrameDynCityArrival").style.display='none';	}}function findY(obj) {	var curtop = 0;	if (obj.offsetParent) {		while (obj.offsetParent) {			curtop += obj.offsetTop			obj = obj.offsetParent;		}	}	else if (obj.y)		curtop += obj.y;	return curtop;}function findX(obj) {	var curleft = 0;	if (obj.offsetParent) {		while (obj.offsetParent) {			curleft += obj.offsetLeft			obj = obj.offsetParent;		}	}	else if (obj.x)		curleft += obj.x;	return curleft;}function putCityValue(src,clr) {	document.hotelsSearch.city.value=src;}function cleanUp(obj, txt) {	if (obj.value == txt) {		obj.value='';	}	return;}var selectednum=0;var cellSelected='#F6FBFF';var rolloverout='#BBDBFE';var last=null;var theTable=null;function mOvr(src){	src.style.cursor="pointer"; }function mOut(src){}// vuelos search - select airlines function arl() {	var wAirline=window.frames.airlineFrame;	if(null==wAirline.airlineLoaded || false==wAirline.airlineLoaded){		alert("No se pueden mostrar las aerolineas.\nPor favor, actualiza la página.");		return;	}    wAirline.showAirline(window.document.abairline, 1);}function selecciona(src,num){	close_layers();	if(document.getElementById("flSearch")){	   hideLayerId("flSearch");	}	if(document.getElementById("hoSearch")){	   hideLayerId("hoSearch");	}	/*if(document.getElementById("dySearch")){           hideLayerId("dySearch");	}*/	if(document.getElementById("viSearch")){           hideLayerId("viSearch");	}	//document.searchSelector.radiomiddle[num].checked = true;	showLayerId(src);	if(num == 0){	   if(document.getElementById("flSearch")){	   	document.getElementById("flSel").className = "tab-vuelo-on";	   }	   if(document.getElementById("hoSearch")){	   	document.getElementById("hoSel").className = "tab-hotel-off";	   }	  /* if(document.getElementById("dySearch")){	   	document.getElementById("dySel").className = "tab-dynPack-off";	   }*/	   if(document.getElementById("viSearch")){	   	document.getElementById("viSel").className = "tab-viajes-off";	   }	}else if(num == 1){	   if(document.getElementById("flSearch")){	   	document.getElementById("flSel").className = "tab-vuelo-off";	   }	   if(document.getElementById("hoSearch")){	   	document.getElementById("hoSel").className = "tab-hotel-on";	   }	   /*if(document.getElementById("dySearch")){	   	document.getElementById("dySel").className = "tab-dynPack-off";	   }*/	   if(document.getElementById("viSearch")){	   	document.getElementById("viSel").className = "tab-viajes-off";	   }	}else if (num == 2){	   if(document.getElementById("flSearch")){	   	document.getElementById("flSel").className = "tab-vuelo-off";	   }	   if(document.getElementById("hoSearch")){	   	document.getElementById("hoSel").className = "tab-hotel-off";	   }	   /*if(document.getElementById("dySearch")){	   	document.getElementById("dySel").className = "tab-dynPack-on";	   }*/	   if(document.getElementById("viSearch")){	   	document.getElementById("viSel").className = "tab-viajes-on";	   }	}/*else if (num == 3){	   if(document.getElementById("flSearch")){	   	document.getElementById("flSel").className = "tab-vuelo-off";	   }	   if(document.getElementById("hoSearch")){	   	document.getElementById("hoSel").className = "tab-hotel-off";	   }	   if(document.getElementById("dySearch")){	   	document.getElementById("dySel").className = "tab-dynPack-off";	   }	   if(document.getElementById("viSearch")){	   	document.getElementById("viSel").className = "tab-viajes-on";	   }	}*/}function showLayerId(id) {		document.getElementById(id).style.display = "block";		document.getElementById(id).style.visibility = "visible";}function hideLayerId(id) {		document.getElementById(id).style.display = "none";}function setSearchtermDest2(){	var index = document.sopsSearch.selectDestination.selectedIndex;	document.sopsSearch.searchterm.value=document.sopsSearch.selectDestination.options[index].value;}function dcal(eTrig, dMin, dMax, campo, fr, isExt) {	var wCal=window.frames['calendarFrame'];	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.calendariLoaded || false==wCal.calendariLoaded){		alert("No se puede mostrar el calendario.\nPor favor, actualiza la página.");		return;	}	if(eTrig == 0){		if(fr=="sopsSearch"){			wCal.showCalendar(window.document.cal1via, dMin, dMax, campo, fr);		}else if(fr=="hotelsSearch"){			wCal.showCalendar(window.document.cal21hot, dMin, dMax, campo, fr);		}else{ 			wCal.showCalendar(window.document.cal1bt, dMin, dMax, campo, fr);		}	}else if(eTrig=="dynSrcDepDateHP"){		wCal.showCalendar("dynSrcDepDateHP", dMin, dMax, campo, fr);	}else if(eTrig=="dynSrcRetDateHP"){		wCal.showCalendar("dynSrcRetDateHP", dMin, dMax, campo, fr);	}else if(eTrig == 2){		wCal.showCalendar(window.document.cal3bt, dMin, dMax, campo, fr);	}else if(eTrig == 3){		wCal.showCalendar(window.document.cal4bt, dMin, dMax, campo, fr);	}else if(eTrig == 4){		wCal.showCalendar(window.document.cal5bt, dMin, dMax, campo, fr);	}else if(eTrig == "seoHot1"){		wCal.showCalendar(window.document.cal1bt, dMin, dMax, campo, fr);	}else if(eTrig == "seoHot2"){		wCal.showCalendar(window.document.cal2bt, dMin, dMax, campo, fr);	}	else{		if(fr=="hotelsSearch"){			wCal.showCalendar(window.document.cal2hot, dMin, dMax, campo, fr);		}else{			wCal.showCalendar(window.document.cal2bt, dMin, dMax, campo, fr);		}	}}function depAp() {	var wAirport = window.frames['depFrameSal'];	if(null==wAirport.airportDepLoaded || false==wAirport.airportDepLoaded){		alert("No se pueden mostrar las ciudades de origen.\nPor favor, actualiza la página.");		return;	}	wAirport.showCity(window.parent.frames['0'].dbCity, 0);} 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 arrAp() {	var wAirport=window.frames['depFrameArr'];	if(null==wAirport.airportDepLoaded || false==wAirport.airportDepLoaded){		alert("No se pueden mostrar las ciudades de destino.\nPor favor, actualiza la página.");		return;	}    wAirport.showCity(document.getElementById("adCity"), 1);}function takeYear(theDate){	x = theDate.getYear();	var y = x % 100;	y += (y < 38) ? 2000 : 1900;	return y;}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;}// -------------------------------------- BOOKMARK THIS PAGE ------------------------------------ //function bookmark(url, description){netscape="Netscape User's hit CTRL+D to add a bookmark to this site."if (navigator.appName=='Microsoft Internet Explorer'){window.external.AddFavorite(url, description);}else if (navigator.appName=='Netscape'){alert(netscape);}} // <a href="javascript:bookmark(' http://www.edreams.es ',' Edreams ');">Bookmark this Site</A>// -------------------------------------- FORM VALIDATION ------------------------------------ //// ----------------------------------- Validate Flights Search ------------------------------- //function checkSearchHomeForm(form, product) {// check passengers	var nadults = 0;	var nchilds = 0;	var ninfants = 0;    if(!product){        product = "vuelos";        if (form.id == "trainSearch"){            product = "trenes";        } else{           product = "vuelos";        }    }    if(form.adults){		nadults = parseInt(form.adults.value,"10");	}	if(form.childs){		nchilds = parseInt(form.childs.value,"10");	}	if(form.infants){		ninfants = parseInt(form.infants.value,"10");	}		var ntotpax=0;	ntotpax = nadults + nchilds+ninfants;		if (ntotpax > 9) {		alert("El número máximo de pasajeros es de 9.");		return false;	}		if (ntotpax < 1) {		alert("No ha seleccionado ningún pasajero");		return false;	}	if ((nchilds+ninfants) > (nadults*2)) {		alert("Máximo dos niños por adulto.");		return false;	}	if ((ninfants) > nadults) {		alert("Máximo un bebe por adulto.");		return false;	}	// check cities	if (form.departureCity.value == "" || form.departureCity.value == "Escribe tu ciudad") {		if(product=="vuelos"){            alert("Debe indicar un aeropuerto de origen.");        }else{            alert("Debe indicar una ciudad de origen.");        }		form.departureCity.focus();		return false;	}	if (form.departureCity.value.search(/\d/) != -1) {		alert("La ciudad de salida no puede contener números.");		form.departureCity.focus();		return false;	}		if (form.arrivalCity.value == "" || form.arrivalCity.value == "Escribe tu ciudad") {		alert("Por favor escribe la ciudad de destino.");		form.arrivalCity.focus();		return false;	}		if (form.arrivalCity.value.search(/\d/) != -1) {		alert("La ciudad de destino no puede contener números.");		form.arrivalCity.focus();		return false;	}// check datesif (form.depDate.value!="Soy flexible" && form.retDate.value!="Soy flexible") {	if (form.depDate.value == "") {		alert("Debe indicarnos la fecha de salida.");		return false;	}	if ((form.depDate.value.length != 10) || (form.depDate.value.charAt(2) !='/') || (form.depDate.value.charAt(5) != '/'))  {		alert("El formato de la fecha de salida correcto es dd/mm/aaaa. ej. 24/11/2004");		return false;	}	if (form.chkAirportsType)		if (form.chkAirportsType.checked) 			form.AirportsType.value='PRIMARY';	var diafecha, mesfecha, anyofecha;	var d = new Date();	var diasmes = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];	diafecha = form.depDate.value.substring(0, 2);	mesfecha = form.depDate.value.substring(3, 5);	anyofecha = form.depDate.value.substring(6);		idep = parseInt(anyofecha + mesfecha + diafecha);	if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {		alert("El formato de la fecha de salida correcto es dd/mm/aaaa. ej. 24/11/2004");		return false;	}		if (anyofecha < d.getYear()) {		alert("La fecha de salida debe ser posterior a la fecha de hoy.");		return false;	}		if ((mesfecha < 1) || (mesfecha > 12)) {		alert("El formato de la fecha de salida correcto es dd/mm/aaaa. ej. 24/11/2004");		return false;	}	if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {		alert("El formato de la fecha de salida correcto es dd/mm/aaaa. ej. 24/11/2004");		return false;	}	form.departureDate.value = diafecha + mesfecha + anyofecha;	form.isZapOff.value="0";	form.zapOffPercent.value = 0;	//Tijeretazo	if ((idep >= 20051021) && (idep <= 20051031)) {		if (form.isZapOffdates.value == "1") {			form.isZapOff.value="1";			form.zapOffPercent.value=30;		}	} else {		form.isZapOff.value="0";		form.zapOffPercent.value=0;	}		if (form.trip.value == 1) {		if (form.retDate.value == "") {			alert("Debe indicarnos la fecha de regreso.");			return false;		}			if (form.retDate.value.length != 10) {			alert("El formato de la fecha de regreso correcto es dd/mm/aaaa. ej. 24/11/2004");			return false;		}			if ((form.retDate.value.charAt(2) !='/') || (form.retDate.value.charAt(5) != '/'))  {			alert("El formato de la fecha de regreso correcto es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		diafecha = form.retDate.value.substring(0, 2);		mesfecha = form.retDate.value.substring(3, 5);		anyofecha = form.retDate.value.substring(6);		if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {			alert("El formato de la fecha de regreso correcto es dd/mm/aaaa. ej. 24/11/2004");			return false;		}			if (anyofecha < d.getYear()) {			alert("La fecha de regreso debe ser posterior a la fecha de hoy.");			return false;		}			if ((mesfecha < 1) || (mesfecha > 12)) {			alert("El formato de la fecha de regreso correcto es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {			alert("El formato de la fecha de regreso correcto es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		iret = parseInt(anyofecha + mesfecha + diafecha);		if (idep > iret) {			alert("La fecha de regreso debe ser posterior a la fecha de salida.");			return false;		}		form.returnDate.value = diafecha + mesfecha + anyofecha;				if (form.searchType.options != null) {			if (idep == iret) {				form.searchType.options[1].selected = true;			}				}		if  ((form.isZapOff.value == "1") && ((iret >= 20051021) && (iret <= 20051115))) {			if (form.isZapOffdates.value == "1") {				form.isZapOff.value="1";			} else {				form.isZapOff.value="0";form.zapOffPercent.value=0;			}					} else {			form.isZapOff.value="0";form.zapOffPercent.value=0;		}	}} else {    document.flightsSearch.action="/edreams/espanol/amadeus3/checkCitys.jhtml";}//dynamic swoosh ( script in shwoosh page)	setSwooshStep("paso1", product, form.id);// ---- Swoosh -- //   hideLayerId('edreamsScreen');	showLayerId('waitScreen');	window.scrollTo(1,1);	if(form.departureCityHd){		if (form.departureCityHd.value != ""){			form.departureCity.value = form.departureCityHd.value;		}	}	if(form.arrivalCityHd){		if (form.arrivalCityHd.value != ""){			form.arrivalCity.value = form.arrivalCityHd.value;		}	}	if(product=="trenes"){		form.departureCity.value = form.departureIata.value;		form.arrivalCity.value = form.arrivalIata.value;	}	if(product=="trenes"){		var outside = document.getElementById("trainOutside");		if((outside != null && outside.value=='true')){			document.flightsSearch.action="/edreams/espanol/tren/launchSearchOutside.jhtml";            document.flightsSearch.target="_blank";            hideLayer('waitScreen');			showLayer('edreamsScreen');        }	}		var searchCR14716 = document.getElementById("searchCR14716");	if(searchCR14716 != null && searchCR14716.value=='true'){		var depCode = form.departureCity.value;		var retCode = form.arrivalCity.value;		var depDay = form.depDate.value.substring(0, 2);		var depMonth = form.depDate.value.substring(3, 5);		var depYear = form.depDate.value.substring(6);		var retDay = depDay;		var retMonth = depMonth;		var retYear = depYear;		if (form.trip.value == 1) {			retDay = form.retDate.value.substring(0, 2);			retMonth = form.retDate.value.substring(3, 5);			retYear = form.retDate.value.substring(6);		}		var url = 'http://results.edreams.es/edreams/siteunder_ta.jsp?FROM=' + depCode + '&TO=' + retCode + '&DEPART_DD=' + depDay + '&DEPART_MM=' + depMonth + '&DEPART_YYYY=' + depYear + '&RETOUR_DD=' + retDay + '&RETOUR_MM=' + retMonth + '&RETOUR_YYYY=' + retYear;		var myWindow=window.open(url,'','width=650,height=415,scrollbars=yes');		window.self.focus();	}		return true;}// ----------------------------------- Validate Hotels Search ------------------------------- //function checkhotelsSearch() {	if (document.hotelsSearch.city.value=='Escribe la ciudad...'){		alert('Por favor, escribe tu ciudad de destino');		document.hotelsSearch.cityName.select();document.hotelsSearch.cityName.focus();		return false;	}	if (document.hotelsSearch.city.value=='') {		alert('Debe indicar la ciudad de destino');		return false;	}	if (document.hotelsSearch.city.value.search(/\d/) != -1) {		alert("La ciudad de destino no puede contener números.");		return false;	}		var numAdt = 0;	var numChd = 0;	if(document.hotelsSearch.numberOfAdults){		numAdt = parseInt(document.hotelsSearch.numberOfAdults.value, 10);	}	if(document.hotelsSearch.numberOfChilds){		numChd = parseInt(document.hotelsSearch.numberOfChilds.value, 10);	}		if ((numAdt + numChd) > 4) {		alert('El número máximo de pasajeros por habitación es de 4. Por favor revisa el número de pasajeros.');		return false;	}		if (document.hotelsSearch.arrivalDate.value=='') {		alert('Debe indicar la fecha de llegada');		return false;	}	if (document.hotelsSearch.arrivalDate.value.length!=10) {		alert("El formato de la fecha de llegada es incorrecto.");		return false;	}	if ((document.hotelsSearch.arrivalDate.value.charAt(2)!='/')||(document.hotelsSearch.arrivalDate.value.charAt(5)!='/')) {		alert("El formato de la fecha de llegada es incorrecto.");		return false;	}	if(document.hotelsSearch.departureDate.value=='') {		alert('Debe indicar la fecha de salida');		return false;	}	if(document.hotelsSearch.departureDate.value.length!=10) {		alert("El formato de la fecha de salida es incorrecto.");		return false;	}	if((document.hotelsSearch.departureDate.value.charAt(2)!='/')||(document.hotelsSearch.departureDate.value.charAt(5)!='/')) {		alert("El formato de la fecha de salida es incorrecto.");		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 = document.hotelsSearch.arrivalDate.value.substring(0, 2);	mesfecha = document.hotelsSearch.arrivalDate.value.substring(3, 5);	anyofecha = document.hotelsSearch.arrivalDate.value.substring(6);		idep = parseInt(anyofecha + mesfecha + diafecha);	if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {		alert("El formato de la fecha de llegada introducida tiene un formato incorrecto.\n El formato correcto es dd/mm/aaaa. ej. 24/11/2005");		return false;	}		if (anyofecha < d.getYear()) {		alert("La fecha de llegada introducida es anterior a la fecha de hoy.\nPor favor introduce una fecha de llegada posterior a la fecha de hoy");		return false;	}		if ((mesfecha < 1) || (mesfecha > 12)) {		alert("El formato de la fecha de llegada introducida tiene un formato incorrecto.\n El formato correcto es dd/mm/aaaa. ej. 24/11/2005");		return false;	}	if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {		alert("El formato de la fecha de llegada introducida tiene un formato incorrecto.\n El formato correcto es dd/mm/aaaa. ej. 24/11/2005");		return false;	}	diafecha = document.hotelsSearch.departureDate.value.substring(0, 2);	mesfecha = document.hotelsSearch.departureDate.value.substring(3, 5);	anyofecha = document.hotelsSearch.departureDate.value.substring(6);	if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {		alert("El formato de la fecha de salida introducida tiene un formato incorrecto.\n El formato correcto es dd/mm/aaaa. ej. 24/11/2005");		return false;	}		if (anyofecha < d.getYear()) {		alert("La fecha de salida introducida es anterior a la fecha de hoy.\nPor favor introduce una fecha de salida posterior a la fecha de hoy");		return false;	}		if ((mesfecha < 1) || (mesfecha > 12)) {		alert("El formato de la fecha de salida introducida tiene un formato incorrecto.\n El formato correcto es dd/mm/aaaa. ej. 24/11/2005");		return false;	}	if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {		alert("El formato de la fecha de salida introducida tiene un formato incorrecto.\n El formato correcto es dd/mm/aaaa. ej. 24/11/2005");		return false;	}	iret = parseInt(anyofecha + mesfecha + diafecha);			if (idep >= iret) {		alert("La fecha de salida introducida es anterior o igual a la fecha de llegada.\nPor favor introduce una fecha de salida posterior a la fecha de llegada.");		return false;	}		var today = new Date();	var maxDate = new Date(Date.parse((today.getFullYear()+1) + "/" +(parseInt(today.getMonth(),10))+ "/" + today.getDate()));	var md = parseInt(maxDate.getFullYear().toString() + ((maxDate.getMonth()+1)<10 ?("0"+(maxDate.getMonth()+1).toString()) : (maxDate.getMonth()+1).toString()) + (maxDate.getDate()<10?("0"+maxDate.getDate().toString()):maxDate.getDate().toString())); 	var em = anyadirDias(document.hotelsSearch.arrivalDate.value,30,'integer')	if (iret > em) {		alert("La estancia máxima es de 30 dias. Por favor revisa tu fecha de salida.");		return false;	}	if (iret > md) {		alert("La fecha de salida no puede ser posterior a " + maxDate.getDate() + "/" + (maxDate.getMonth()+1) + "/" + maxDate.getFullYear() + ". Por favor revisa la fecha de salida.");		return false;	}//dynamic swoosh ( script in shwoosh page)	setSwooshStep("paso1", "hoteles", document.hotelsSearch.id);// ---- Swoosh -- // 	top.frames.hideLayer('edreamsScreen');	top.frames.showLayer('waitScreen');	window.scrollTo(1,1);	return true;}// ----------------------------------- Validate Playas/Hotels Search ------------------------------- //function checkplayasSearch() {	// Check Destination	if (document.getElementById('destination').value==''){		alert('Por favor, selecciona tu destino');		return false;	}		// Check dates	var diafecha, mesfecha, anyofecha;	var d = new Date();	var diasmes = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];	diafecha = document.getElementById('arrivalDate').value.substring(0, 2);	mesfecha = document.getElementById('arrivalDate').value.substring(3, 5);	anyofecha = document.getElementById('arrivalDate').value.substring(6);		idep = parseInt(anyofecha + mesfecha + diafecha);		diafecha = document.getElementById('departureDate').value.substring(0, 2);	mesfecha = document.getElementById('departureDate').value.substring(3, 5);	anyofecha = document.getElementById('departureDate').value.substring(6);	iret = parseInt(anyofecha + mesfecha + diafecha);			if (idep > iret) {		alert("La fecha de salida introducida es anterior a la fecha de llegada.\nPor favor introduce una fecha de salida posterior a la fecha de llegada.");		return false;	}		var today = new Date();	var maxDate = new Date(Date.parse((today.getFullYear()+1) + "/" +(parseInt(today.getMonth(),10))+ "/" + today.getDate()));	var md = parseInt(maxDate.getFullYear().toString() + ((maxDate.getMonth()+1)<10 ?("0"+(maxDate.getMonth()+1).toString()) : (maxDate.getMonth()+1).toString()) + (maxDate.getDate()<10?("0"+maxDate.getDate().toString()):maxDate.getDate().toString())); 	var em = anyadirDias(document.getElementById('arrivalDate').value,30,'integer')	if (iret > em) {		alert("La estancia máxima es de 30 dias. Por favor revisa tu fecha de salida.");		return false;	}	if (iret > md) {		alert("La fecha de salida no puede ser posterior a " + maxDate.getDate() + "/" + (maxDate.getMonth()+1) + "/" + maxDate.getFullYear() + ". Por favor revisa la fecha de salida.");		return false;	}			// Check number of people per room (max 4 inc children)	numadults = parseInt(document.getElementById('idnumadults').value);	numchildren = parseInt(document.getElementById('idnumchildren').value);	numpeoplehab = numadults + numchildren;		if (numpeoplehab > 4)  { 		alert("Máxima de 4 personas por habitación incluso niños.");		return false;	}			if (document.hotelsSearch.msie != null) {		if (document.hotelsSearch.msie.value == '1') {		top.frames.hideLayer('edreamsScreen');		top.frames.showLayer('waitScreen');		window.scrollTo(1,1);		}}		return true;}// ----------------------------------- End FORM VALIDATION ------------------------------- //function fixElement(element, message) {	alert(message);	element.focus();}function isMailReady(form) {	var passed = false;	if (form.email.value.indexOf("@") == -1 || form.email.value.indexOf(".") == -1) {		fixElement(form.email, "El formato del email tiene que ser usuario@dominio.com.");	} else {		form.submit();	}}function readCookie(cookieName) {    var theCookie=""+document.cookie;    var ind=theCookie.indexOf(cookieName);    if (ind==-1 || cookieName=="") return "";    var ind1=theCookie.indexOf(';',ind);    if (ind1==-1) ind1=theCookie.length;    return unescape(theCookie.substring(ind+cookieName.length+1,ind1));}function deleteCookie(name) {	if (ReadCookie(name)) {    	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";	}}function setCookie(cookieName,cookieValue,nDays, path, domain) {	var today = new Date();	var expire = new Date();	if (nDays==null || nDays==0) nDays=1;	expire.setTime(today.getTime() + 3600000*24*nDays);	var cookieString = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();	if (domain) {    	cookieString += ";domain=" + domain;	}	if (path) {    	cookieString += ";path=" + path;	}	//alert(cookieString);	document.cookie = cookieString;}function defaultBox(obj) {	dCityBox = document.getElementById('defCityBox');	// suggest list    dCityBoxShim = document.getElementById('defCityBoxShim');	// workaround: msie div over select		dCityBox.width = '160px';	dCityBox.style.border = "#000 1px solid";        dCityBox.style.top = findOffsetTop(document.getElementById(obj)) - 235 + 'px';    dCityBox.style.left = findOffsetLeft(document.getElementById(obj)) + 50 + 'px';		dCityBoxShim.width = dCityBox.width;	//dCityBoxShim.height = dCityBox.height;	dCityBoxShim.style.top = dCityBox.style.top;	dCityBoxShim.style.left = dCityBox.style.left;	dCityBoxShim.style.zIndex = dCityBox.style.zIndex - 1;	dCityBox.style.display = 'inline';	if (_sbShowBGIframe()) {       	dCityBoxShim.style.display = 'inline';	}}function closeDefault() { 	if (document.getElementById("defCityBox")) document.getElementById("defCityBox").style.display = 'none';	if (document.getElementById("defCityBoxShim")) document.getElementById("defCityBoxShim").style.display = 'none';}function _sbShowBGIframe() {    return ( window.opera ) ? false : true;}function selectDef(des) {	setCookie('dfCityOffers', des, 30,'/');	closeDefault();	//window.location.href = window.location.href;	window.location.reload(true);}function findOffsetLeft(element) {    return findOffset(element, "offsetLeft");}function findOffsetTop(element) {    return findOffset(element, "offsetTop");}function findOffset(element, type) {    var os = 0;    while(element) {        os += element[type];        element = element.offsetParent;    }    return os;}//MARCO27: jscript present also in docs/edreams/shared/jscript/edreams_global.js INIfunction changeCssClass(theID, theClass){  document.getElementById(theID).className=theClass;}var no_city_orig = "No se pueden mostrar las ciudades de origen.\nPor favor, actualiza la página.";var no_city_dest = "No se pueden mostrar las ciudades de destino.\nPor favor, actualiza la página.";var no_aerolineas = "No se pueden mostrar las aerolineas.\nPor favor, actualiza la página.";var pulsas_boton_buscar = "Si pulsas sobre el boton buscar, el buscaprecios se encargara de mostrarte las fechas disponibles de retorno.";var no_calendario = "No se puede mostrar el calendario.\nPor favor, actualiza la página.";function showFrameAirlines(idPosition){  var theFrame=window.frames.idFrameAirlines;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_aerolineas);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), 1);}function showFrameCityPicker(idPosition, oFldDest){  var theFrame=window.frames.idFrameCityPicker;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_city_orig);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), oFldDest);}function showFrameCityDeparture(idPosition){  var theFrame=window.frames.idFrameCityDeparture;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_city_orig);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), 1);}function showFrameCityArrival(idPosition){  var theFrame=window.frames.idFrameCityArrival;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_city_dest);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), 1);}function showFrameCalendar(idPosition, dMin, dMax, campo, frame, isExt){  var theFrame=window.frames.idCalendarFrame;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_calendario);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), dMin, dMax, campo, frame);}//Dynamic Packagingfunction showFrameDynCityDeparture(idPosition, frameName, fieldName, train, arr){	if(train){		var aux = "";		if(!arr){			aux = "ALL";		}else{			if(document.getElementById('departureIata').value != ""){				aux = document.getElementById('departureIata').value;			}			if(aux==null || aux == "" ){				alert("Selecciona primero una estación de origen para tu trayecto en tren");				return;			}		}		if((window.frames.idFrameDynCityDeparture.location.href).indexOf("?dest=") == -1){			addressStart = window.frames.idFrameDynCityDeparture.location.href		}		window.frames.idFrameDynCityDeparture.location = addressStart + '?dest=' + aux + "&where=" +arr;	}	var theFrame=window.frames.idFrameDynCityDeparture;	  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_city_orig);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), frameName, fieldName);}function showFrameDynCityArrival(idPosition, frameName, fieldName, train){  var theFrame=window.frames.idFrameDynCityArrival;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_city_dest);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), frameName, fieldName);}//MARCO27: jscript present also in docs/edreams/shared/jscript/edreams_global.js ENDfunction showFrameCalendarOption(idPosition, dMin, dMax, campo, frame, isExt){  var theFrame=window.frames.idFrameCalendar;  var frameIsLoaded = theFrame.calendariLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_calendario);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), dMin, dMax, campo, frame);}function showFrameCityHotel(idPosition){  var theFrame=window.frames.idFrameCityHotel;  var frameIsLoaded = theFrame.frameIsLoaded;  if((frameIsLoaded==null) || (frameIsLoaded==false)){     alert(no_city_orig);     return;  }  theFrame.showTheFrame(document.getElementById(idPosition), 1);}// -------------------------------------- FORM VALIDATION ------------------------------------ //// ----------------------------------- Validate Flights Search ------------------------------- //function checkSearchMultiForm(form) {// check passengers	var nadults = 0;	var nchilds = 0;	var ninfants = 0;		if(form.adults){		nadults = parseInt(form.adults.value,"10");	}	if(form.childs){		nchilds = parseInt(form.childs.value,"10");	}	if(form.infants){		ninfants = parseInt(form.infants.value,"10");	}		var ntotpax=0;	ntotpax = nadults + nchilds+ninfants;		if (ntotpax > 9) {		alert("El número máximo de pasajeros es de 9.");		return false;	}		if (ntotpax < 1) {		alert("No ha seleccionado ningún pasajero");		return false;	}	if ((nchilds+ninfants) > (nadults*2)) {		alert("Máximo dos niños por adulto.");		return false;	}	if ((ninfants) > nadults) {		alert("Máximo un bebe por adulto.");		return false;	}	// check cities	if (form.departureCity.value == "" || form.departureCity.value == "Escribe tu ciudad") {		alert("Debe indicar un aeropuerto de origen para el primer vuelo");		form.departureCity.focus();		return false;	}	if (form.departureCity.value.search(/\d/) != -1) {		alert("La ciudad de salida del primer vuelo no puede contener números.");		form.departureCity.focus();		return false;	}		if (form.arrivalCity.value == "" || form.arrivalCity.value == "Escribe tu ciudad") {		alert("Por favor escribe la ciudad de destino para el primer vuelo.");		form.arrivalCity.focus();		return false;	}		if (form.arrivalCity.value.search(/\d/) != -1) {		alert("La ciudad de destino del primer vuelo no puede contener números.");		form.arrivalCity.focus();		return false;	}		if ((form.departureCity1.value != "") && (form.departureCity1.value.search(/\d/) != -1)) {		alert("La ciudad de salida del segundo vuelo no puede contener números.");		form.departureCity1.focus();		return false;	}		if ((form.arrivalCity1.value != "") && (form.arrivalCity1.value.search(/\d/) != -1)) {		alert("La ciudad de destino del segundo vuelo no puede contener números.");		form.arrivalCity1.focus();		return false;	}		if ((form.departureCity1.value == "") && (form.arrivalCity1.value != "")) {		alert("Por favor escribe la ciudad de origen para el segundo vuelo.");		form.departureCity1.focus();		return false;	}		if ((form.departureCity1.value != "") && (form.arrivalCity1.value == "")) {		alert("Por favor escribe la ciudad de destino para el segundo vuelo.");		form.arrivalCity1.focus();		return false;	}		if ((form.departureCity2.value != "") && (form.departureCity2.value.search(/\d/) != -1)) {		alert("La ciudad de salida del tercer vuelo no puede contener números.");		form.departureCity2.focus();		return false;	}		if ((form.arrivalCity2.value != "") && (form.arrivalCity2.value.search(/\d/) != -1)) {		alert("La ciudad de destino del tercer vuelo no puede contener números.");		form.arrivalCity2.focus();		return false;	}		if ((form.departureCity2.value == "") && (form.arrivalCity2.value != "")) {		alert("Por favor escribe la ciudad de origen para el tercer vuelo.");		form.departureCity2.focus();		return false;	}		if ((form.departureCity2.value != "") && (form.arrivalCity2.value == "")) {		alert("Por favor escribe la ciudad de destino para el tercer vuelo.");		form.arrivalCity2.focus();		return false;	}		if (((form.departureCity2.value != "") && (form.arrivalCity2.value != "")) && ((form.departureCity1.value == "") || (form.arrivalCity1.value == ""))) {		if (form.departureCity1.value == "") {			alert("Por favor escribe la ciudad de origen para el segundo vuelo.");			form.departureCity1.focus();		} else {			alert("Por favor escribe la ciudad de destino para el segundo vuelo.");			form.arrivalCity1.focus();		}		return false;	}// check dates	if (form.depDate.value == "") {		alert("Debe indicarnos la fecha de salida del primer vuelo.");		return false;	}	if ((form.depDate.value.length != 10) || (form.depDate.value.charAt(2) !='/') || (form.depDate.value.charAt(5) != '/'))  {		alert("El formato correcto de la fecha de salida del primer vuelo es dd/mm/aaaa. ej. 24/11/2004");		return false;	}	if (form.chkAirportsType.checked) form.AirportsType.value='PRIMARY';	var diafecha, mesfecha, anyofecha;	var d = new Date();	var diasmes = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];	diafecha = form.depDate.value.substring(0, 2);	mesfecha = form.depDate.value.substring(3, 5);	anyofecha = form.depDate.value.substring(6);		idep = parseInt(anyofecha + mesfecha + diafecha);	if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {		alert("El formato correcto de la fecha de salida del primer vuelo es dd/mm/aaaa. ej. 24/11/2004");		return false;	}		if (anyofecha < d.getYear()) {		alert("La fecha de salida del primer vuelo debe ser posterior a la fecha de hoy.");		return false;	}		if ((mesfecha < 1) || (mesfecha > 12)) {		alert("El formato correcto de la fecha de salida del primer vuelo es dd/mm/aaaa. ej. 24/11/2004");		return false;	}	if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {		alert("El formato correcto de la fecha de salida del primer vuelo es dd/mm/aaaa. ej. 24/11/2004");		return false;	}	form.departureDate.value = diafecha + mesfecha + anyofecha;	if ((form.departureCity1.value != "") && (form.arrivalCity1.value != "")) {		if (form.retDate.value == "") {			alert("Debe indicarnos la fecha de salida del segundo vuelo.");			return false;		}			if (form.retDate.value.length != 10) {			alert("El formato correcto de la fecha de salida del segundo vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}			if ((form.retDate.value.charAt(2) !='/') || (form.retDate.value.charAt(5) != '/'))  {			alert("El formato correcto de la fecha de salida del segundo vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		diafecha = form.retDate.value.substring(0, 2);		mesfecha = form.retDate.value.substring(3, 5);		anyofecha = form.retDate.value.substring(6);		if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {			alert("El formato correcto de la fecha de salida del segundo vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}			if (anyofecha < d.getYear()) {			alert("La fecha de salida del segundo vuelo debe ser posterior a la fecha de hoy.");			return false;		}			if ((mesfecha < 1) || (mesfecha > 12)) {			alert("El formato correcto de la fecha de salida del segundo vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {			alert("El formato correcto de la fecha de salida del segundo vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		iret = parseInt(anyofecha + mesfecha + diafecha);				if (idep > iret) {			alert("La fecha de salida del segundo vuelo debe ser posterior a la fecha de salida del primer vuelo.");			return false;		}		form.returnDate.value = diafecha + mesfecha + anyofecha;	}		if ((form.departureCity2.value != "") && (form.arrivalCity2.value != "")) {		if (form.seg3Date.value == "") {			alert("Debe indicarnos la fecha de salida del tercer vuelo.");			return false;		}			if (form.seg3Date.value.length != 10) {			alert("El formato correcto de la fecha de salida del tercer vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}			if ((form.seg3Date.value.charAt(2) !='/') || (form.seg3Date.value.charAt(5) != '/'))  {			alert("El formato correcto de la fecha de salida del tercer vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		diafecha = form.seg3Date.value.substring(0, 2);		mesfecha = form.seg3Date.value.substring(3, 5);		anyofecha = form.seg3Date.value.substring(6);		if (isNaN(diafecha) || isNaN(mesfecha) || isNaN(anyofecha)) {			alert("El formato correcto de la fecha de salida del tercer vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}			if (anyofecha < d.getYear()) {			alert("La fecha de salida del tercer vuelo debe ser posterior a la fecha de hoy.");			return false;		}			if ((mesfecha < 1) || (mesfecha > 12)) {			alert("El formato correcto de la fecha de salida del tercer vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {			alert("El formato correcto de la fecha de salida del tercer vuelo es dd/mm/aaaa. ej. 24/11/2004");			return false;		}		idep3 = parseInt(anyofecha + mesfecha + diafecha);				if (iret > idep3) {			alert("La fecha de salida del tercer vuelo debe ser posterior a la fecha de salida del segundo vuelo.");			return false;		}				if ((idep == iret) && (iret == idep3)) {			alert("No es posible realizar la búsqueda de vuelos para las fechas seleccionadas. No se permite realizar 3 vuelos en el mismo dia.");			return false;		}		form.segment3Date.value = diafecha + mesfecha + anyofecha;	}	// ---- Swoosh -- // 	setSwooshStep("paso1", "multidestino", form.id);	top.frames.hideLayer('edreamsScreen');	top.frames.showLayer('waitScreen');	window.scrollTo(1,1);	return true;}