function encenderLayer(tipo) {	posX = findPosX(document.getElementById('helpCell'));	posY = findPosY(document.getElementById('helpCell'));	switch(tipo) { 			case 1: 			document.getElementById('divHelpSecondary').style.visibility='visible';			document.getElementById('divHelpSecondary').style.posLeft=posX+10;			document.getElementById('divHelpSecondary').style.posTop=posY+25;			break;        case 2:			document.getElementById('divHora').style.visibility='visible';			document.getElementById('divHora').style.posLeft=posX+6;			document.getElementById('divHora').style.posTop=posY-33;			break;        case 3:			document.getElementById('divCiudad').style.visibility='visible';			document.getElementById('divCiudad').style.posLeft=posX+6;			document.getElementById('divCiudad').style.posTop=posY-33;			break; 		case 4: 			document.getElementById('divVuelosDirectos').style.visibility='visible';			document.getElementById('divVuelosDirectos').style.posLeft=posX+5;			document.getElementById('divVuelosDirectos').style.posTop=posY-33;			break; 		default:			document.getElementById('divMssSoyFlexible').style.visibility='visible';			document.getElementById('divMssSoyFlexible').style.posLeft=posX+6;			document.getElementById('divMssSoyFlexible').style.posTop=posY-33;			break;	}    if(document.getElementById('tipo-pasajero')){        document.getElementById('tipo-pasajero').style.visibility='hidden';    }		}function apagarLayer(tipo) {	switch(tipo) { 			case 1:document.getElementById('divHelpSecondary').style.visibility='hidden';break;        case 2:document.getElementById('divHora').style.visibility='hidden';break;        case 3:document.getElementById('divCiudad').style.visibility='hidden';break;		case 4:document.getElementById('divVuelosDirectos').style.visibility='hidden';break; 		default:document.getElementById('divMssSoyFlexible').style.visibility='hidden';	}    if(document.getElementById('tipo-pasajero')){        document.getElementById('tipo-pasajero').style.visibility='visible';    }// document.getElementById('divOpts').style.display='block';}function findPosY(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 findPosX(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 switchObjects(tipo,action) {	switch(tipo) { 			case 2:	document.getElementById('divAdults').style.visibility = action;				document.getElementById('divInfants').style.visibility = action;				document.getElementById('divChilds').style.visibility = action;					break;		default:document.getElementById('divDepartureTime').style.visibility = action;	}}function putCityValue(src,clr) {	document.hotelsSearch.city.value=src;}function clearCities(){	for(var x=0;x<document.hotelsSearch.citySelector.length;x++) {		document.hotelsSearch.citySelector[x].checked=false;	}}function checkhotelsSearch() {    if (document.hotelsSearch.city.value == 'Scrivi la città...'){        alert('Scrivi la città in cui vuoi cercare un hotel.');        document.hotelsSearch.cityName.select();		document.hotelsSearch.cityName.focus();        return false;    }	if (document.hotelsSearch.city.value=='') {		alert('Scrivi la città in cui vuoi cercare un hotel.');		return false;	}	if (document.hotelsSearch.city.value.search(/\d/) != -1) {		alert("Il nome della città non può contenere numeri.");		return false;	}		var numAdt = parseInt(document.hotelsSearch.numberOfAdults.value, 10);	var numChd = parseInt(document.hotelsSearch.numberOfChilds.value, 10);		if ((numAdt + numChd) > 4) {		alert('Il numero massimo di persone per camera è 4. Per favore controlla il numero di persone.');		return false;	}			if (document.hotelsSearch.arrivalDate.value=='') {		alert('Devi indicare la data di arrivo.');		return false;	}	if (document.hotelsSearch.arrivalDate.value.length!=10) {		alert("Il formato della data di arrivo è incorretto.");		return false;	}	if ((document.hotelsSearch.arrivalDate.value.charAt(2)!='/')||(document.hotelsSearch.arrivalDate.value.charAt(5)!='/')) {		alert("Il formato della data di arrivo è incorretto.");		return false;	}	if(document.hotelsSearch.departureDate.value=='') {		alert('Devi indicare la data di partenza.');		return false;	}	if(document.hotelsSearch.departureDate.value.length!=10) {		alert("Il formato della data di partenza è incorretto.");		return false;	}	if((document.hotelsSearch.departureDate.value.charAt(2)!='/')||(document.hotelsSearch.departureDate.value.charAt(5)!='/')) {		alert("Il formato della data di partenza è incorretto.");		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("Il formato della data di arrivo è incorretto. \n Il formato corretto è gg/mm/aaaa. es. 24/11/2005");		return false;	}		if (anyofecha < d.getYear()) {		alert("La data di arrivo è anteriore alla data odierna.\n Per favore inserisci una data di arrivo corretta.");		return false;	}		if ((mesfecha < 1) || (mesfecha > 12)) {		alert("Il formato della data di arrivo è incorretto. \n Il formato corretto è gg/mm/aaaa. es. 24/11/2005");		return false;	}	if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {		alert("Il formato della data di arrivo è incorretto. \n Il formato corretto è gg/mm/aaaa. es. 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("Il formato della data di partenza è incorretto. \n Il formato corretto è gg/mm/aaaa. es. 24/11/2005");		return false;	}		if (anyofecha < d.getYear()) {		alert("La data di partenza è anteriore alla data odierna.\n Per favore inserisci una data di arrivo corretta.");		return false;	}		if ((mesfecha < 1) || (mesfecha > 12)) {		alert("Il formato della data di partenza è incorretto. \n Il formato corretto è gg/mm/aaaa. es. 24/11/2005");		return false;	}	if ((diafecha < 1) || (diafecha > diasmes[mesfecha])) {		alert("Il formato della data di partenza è incorretto. \n Il formato corretto è gg/mm/aaaa. es. 24/11/2005");		return false;	}	iret = parseInt(anyofecha + mesfecha + diafecha);			if (idep >= iret) {		alert("La data di partenza è anteriore o uguale alla data di arrivo.\nPer favore inserisci una data di partenza corretta.");		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("Il pernottamento massimo è 30 giorni. Per favore controlla la data di partenza.");		return false;	}			if (iret > md) {		alert("La data di partenza non può essere posteriore a " + maxDate.getDate() + "/" + maxDate.getMonth() + "/" + maxDate.getFullYear() + ". Per favore controlla la data di partenza.");		return false;	}	setSwooshStep("paso1", "hoteles", document.hotelsSearch.id);	return true;}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;}// Fin *************************************************************