/* -------------------------------------------------------------- *  * ------------------------------------------------------------*/function createPopUpRate () {	var mainForm = document.mainForm	var ix = mainForm.currency.selectedIndex;		if (ix == 0) {return false}		var currencyCode = mainForm.currency.options[ix].value;	currencyCode = eval (currencyCode);		var ct = 0;	var ctlengthRate =  mainForm.rate.options.length;		// empty the popup region first	for (var i = 0; i < ctlengthRate; i++) {		mainForm.rate.options[0] = null;	}		// iterate in a associative array, but increment by two	// the array is like this :	// var BEF = ["-Pick", "Pick", "-<20", "<20"]	// we need to set the first element as value (arg 2 in new Option), and the second element as text (arg 1 in new Option)	var ctOneRate = currencyCode.length	for (var i = 0; i <  ctOneRate; i = i + 2) {		mainForm.rate.options[ct] = new Option (currencyCode[i + 1], currencyCode[i]);		ct++;	}			return true}/* -------------------------------------------------------------- * Called from the day, month, year popup menus. * Check first if the date is valid, and then check if the date * is not in the past, then check if the date is not more than * one year. * ------------------------------------------------------------*/function obligeValidDate (popUpMenuDay, popUpMenuMonth, popUpMenuYear) {/*	var msgDatePassed 			= "Error: You cannot search for a date that starts before today's date.";	var msgDateMoreThanOneYear	= "Error: You cannot search for a date that is more than one year from now.";		// oblige valid date	if (obligeValidDay (popUpMenuDay, popUpMenuMonth, popUpMenuYear)){return true};	// oblige no past dates	var dateDay		= parseInt (popUpMenuDay.options[popUpMenuDay.selectedIndex].value);	var dateMonth	= parseInt (popUpMenuMonth.options[popUpMenuMonth.selectedIndex].value);	var dateYear	= popUpMenuYear.options[popUpMenuYear.selectedIndex].value;	if (dateYear.length != 4) {dateYear = "20" + dateYear}	var thisDate	= new Date (dateYear, dateMonth - 1, dateDay);		var now 		= new Date ();	var nowYear		= parseInt (now.getFullYear ());	var nowMonth	= now.getMonth ();	var nowDay 		= now.getDate ();	now 			= new Date (nowYear, nowMonth, nowDay)		function setPopUp () {		popUpMenuDay.options.selectedIndex		= nowDay - 1;		popUpMenuMonth.options.selectedIndex	= nowMonth;		popUpMenuYear.options.selectedIndex		= 0;	}		if ( now.getTime () > thisDate.getTime ()) {		alert (msgDatePassed);		setPopUp ()		return true;	}		// oblige no date that is more than one year from now.	if (!isLessThanOneYear (thisDate)) {alert (msgDateMoreThanOneYear); setPopUp ()}	*/	return true}/* -------------------------------------------------------------- *  * ------------------------------------------------------------*/function userSite () {	var mainForm = document.mainForm;//	var msgErrorChooseCityAndRegion	= "Error: You can't choose a city and a region.";//	var msgChooseCityOrRegion		= "Error: You did not choose a city or a region.";//	var msgChooseCity				= "Error: You did not choose a city.";//	var msgLengthOfStay				= "Error: The number for the Length of Stay is not valid.";//	var msgNumOfRooms				= "Error: The number for the Number of Rooms is not valid.";//	var msgNumOfAdults				= "Error: The number for the Number of Adults per Room is not valid.";//	var msgChooseCurrency			= "Error: You did not choose a currency.";//	var msgChooseRate				= "Error: You did not choose a rate.";		// if true, then the user CAN'T search altogether a city and a region, see below	if (typeof mainForm.region != "undefined") {		if (mainForm.city.selectedIndex != 0 && mainForm.region.selectedIndex != 0) {			alert (msgErrorChooseCityAndRegion);			return false;		}				if (mainForm.city.selectedIndex == 0 && mainForm.region.selectedIndex == 0) {			alert (msgChooseCityOrRegion);			return false;		}	}			// there is no popup menu for regions, only one for cities	if (typeof mainForm.region == "undefined") {		if (mainForm.city.selectedIndex == 0) {alert (msgChooseCity); return false;}	}		// length of stay	var lengthOfStay = mainForm.lengthOfStay.value; 	if (lengthOfStay == 0 || lengthOfStay == "") {alert (msgLengthOfStay); lengthOfStay = 1; return false;}	if (!isInt (lengthOfStay)) {alert (msgLengthOfStay); mainForm.lengthOfStay.value = 1; return false;}		// num of rooms	var numberOfRooms = mainForm.numberOfRooms.value;	if (numberOfRooms == 0 || numberOfRooms == "") {alert (msgNumOfRooms); numberOfRooms = 1; return false;}	if (!isInt (numberOfRooms)) {alert (msgNumOfRooms); mainForm.numberOfRooms.value = 1; return false;}			// num of adults	var numberOfAdults = mainForm.numberOfAdults.value;	if (numberOfAdults == 0 || numberOfAdults == "") {alert (msgNumOfAdults); numberOfAdults = 1; return false;}	if (!isInt (numberOfAdults)) {alert (msgNumOfAdults); mainForm.numberOfAdults.value = 1; return false;}		// currency	if (mainForm.currency.selectedIndex == 0) {alert (msgChooseCurrency); return false;}		// rate	var ix = mainForm.rate.selectedIndex	if (ix < 1) {alert (msgChooseRate); return false;}		return true;} /* -------------------------------------------------------------- *  * ------------------------------------------------------------*/function makeHotelInfoWindow (hotelID) {	var myUrl = "http://www.iwant2go2.com/usersite/hotelInfo?" + hotelID;	var newWin = "";	newWin = window.open (myUrl,'hotelInfoWindow', winConfig);	newWin.focus ();	}	/* -------------------------------------------------------------- *  * ------------------------------------------------------------*///var msgEmailNotValid	= "Error: This is not a valid email address:";	function checkThisEmail (s) {	if  (!checkEmail (s)) {alert (msgEmailNotValid); return false;}	return true;}/* -------------------------------------------------------------- * check the GIF fields * --------------------------------------------------------------*/function gifSite () {var mainForm = document.mainForm;if (!checkThisEmail (mainForm.email.value)) {return false}return true;}/* -------------------------------------------------------------- * check the Confirm Request page * --------------------------------------------------------------*/var hasClickedSubmitButton 	= false;function confirmRequest () {	hasClickedSubmitButton = false; // if we came back		var mainForm			= document.mainForm;//	var msgPleaseWait		= "Please do not press the submit button more than once.";//	var msgEmpty			= "Error: This required field is empty: ";//	var msgNotValidNum		= "Error: This is not a valid number: ";//	var msgChooseCountry	= "Error: You have to pick a country.";		// check for empty fields	if (!alertEmptyField (mainForm.nameLast, msgEmpty + nameLast + ".")) {return false;}	if (!alertEmptyField (mainForm.nameFirst, msgEmpty + nameFirst + ".")) {return false;}	if (!alertEmptyField (mainForm.email, msgEmpty + email + ".")) {return false;}	if (!alertEmptyField (mainForm.city, msgEmpty + city + ".")) {return false;}	//	if (!alertEmptyField (mainForm.nameLast, msgEmpty + "Last Name.")) {return false;}//	if (!alertEmptyField (mainForm.nameFirst, msgEmpty + "First Name.")) {return false;}//	if (!alertEmptyField (mainForm.email, msgEmpty + "e-mail Address.")) {return false;}//	if (!alertEmptyField (mainForm.city, msgEmpty + "City.")) {return false;}		// check for a valid email	if (!checkThisEmail (mainForm.email.value)) {return false;}		// check for the accompagning children	var childrenField 	= "Field Number of Accompaning Children.";	if (!isInteger (mainForm.numOfAccChildren.value, msgEmpty + childrenField, msgNotValidNum + childrenField)){		mainForm.numOfAccChildren.value = "0"; return false;}		//window.status = mainForm.country.selectedIndex;		if (mainForm.country.selectedIndex < 1) {alert (msgChooseCountry); return false;}		if (hasClickedSubmitButton) {		alert (msgPleaseWait);		return false;	} else {		hasClickedSubmitButton = true;	}	/*	if (!mainForm.depositAgreed.checked) {*//*		alert (msgNeedToAgreeBeforeProceed);*//*		return false;*/

/*	}*/	return true;}/* -------------------------------------------------------------- * set today's date if var setDate is true (will be in the calling page * --------------------------------------------------------------*/function setTodayDate () {	if (typeof setDate != "undefined") {		if (setDate) {			var d = new Date ()			var thisDate = d.getDate ()			var thisMonth = d.getMonth ()			var thisYear = d.getFullYear ()			if (thisYear == 2000) {				thisYear = 0;			} else {				thisYear = 1;			}			document.mainForm.dateMonthFrom.options[thisMonth].selected = true			document.mainForm.dateDayFrom.options[thisDate - 1].selected = true			document.mainForm.dateYearFrom.options[thisYear].selected = true		}	}	return true}function transit () {	// can't have named form element here (see protocol shopla)	var mainForm = document.mainForm;	var elem_lt = mainForm.elements.length;		// will catch every checkbox that are unchecked		for (i = 0; i < elem_lt; i++) {		if (mainForm.elements[i].type == "checkbox" && mainForm.elements[i].checked == false) {			alert (msgNeedToAgreeBeforeProceed);			return false;		}	}			return true;}