
	/* form functions */
	function FirstDep(ThisForm,List)  	{
		return true;
		}
		
	function FirstArr(ThisForm,List)    {
		return true;
		}


	function GetAirport(objLink, strItem) {
		var lst;
		
		lst = document.SearchForm.CA1;
		
		if (lst) {
			objLink.search = '?code=' + lst.value + '&item=' + strItem;
		}
		popupAirports();
	}


	function popup(url, title, width, height, scroll) {
		var s = 'menubar=no,toolbar=no,location=yes,resizable=yes,status=yes'
		s += ',scrollbars=' + scroll
		s += ',width=' + width + ',height=' + height;
		s += ',top=' + (screen.availHeight - height) / 2 + ',left=' + (screen.availWidth - width) / 2;

		//close existing window
		if (navigator.newwindow) navigator.newwindow.close();
		
		//save new window object in navigator object and activate
		navigator.newwindow = self.open(url, title, s);
		navigator.newwindow.focus();
	
		}

	function popup1(URL,winwidth,winheight)  {
		day = new Date();
		id = day.getTime();
		pleft=(screen.width-winwidth)/2;
		ptop=(screen.height-winheight)/2;
		eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+winwidth+",height="+winheight+",left="+pleft+",top="+ptop+"');");
		}


	function popupAirports() {
		return popup('', 'Airports', 500, 300, 'yes')
		}

	function popupExplain() {
		return popup('', 'Explain', 400, 250, 'yes')
		}


	function ShowHide(strID, blnShow) {
		var objItem;
		objItem = document.getElementById(strID);
		
		if (objItem) {
			objItem.style.display = (blnShow) ? '' : 'none';
			}
		}



	function SetAirport(strCountry, strCity, strAirport, strCode) {
		var objOpener;

	
		objOpener = window.opener;
		
		if (!objOpener) {
			alert('There has been an error selecting an airport.\nPlease close this window and try again.')
		} else if (objOpener.closed) {
			alert('The main search window is no longer available.\nPlease close this window and try again.')
		} else {
			strItem = document.airports.Item.value;
			objOpener.SetReturnAirport(strItem, strCountry, strCity, strAirport, strCode);
			CloseWindow();
		}
	}

	function SetReturnAirport(strItem, strCountry, strCity, strAirport, strCode) {
		var lst, strValue;

		if (strItem != '')
			lst = document.SearchForm[strItem];
		
		if (lst) {
			lst.value = strCode;
			
			if (lst.selectedIndex == -1) {
				var opt;
				
				strValue = strCity + ((strCountry != '') ? ', ' + strCountry : '') + ' -' + strCode

				opt = new Option;
				opt.text = strValue;
				opt.value = strCode;
				opt.selected = true;
				lst.options[lst.length] = opt;
			}
		}
	}




function CloseWindow() {
	window.close();
	if (window.opener)
		if (!window.opener.closed)
			window.opener.focus();
}

function addPopupEvents() {
	document.onkeydown = KeyDown;
}

function KeyDown(e) {
	if (e && e.which == 27) CloseWindow(); //Netscape
	else if (event && event.keyCode == 27) CloseWindow(); //IE
}



function GenerateBookDate(intDaysOffset)
{
	// Get the current date

	var dateBook = new Date;
	
	// Add 7 days to the date
	g_intDay = dateBook.getDate() + 7 + intDaysOffset;
	dateBook.setDate(g_intDay);
	
	// Get the booking date
	g_intDay = dateBook.getDate();
	g_strMonthYear = arrMonth[dateBook.getMonth()].substring(0, 3) + " " + dateBook.getFullYear();
	return dateBook;
}

var arrMonth = ["January", "February", "March", "April",
						 "May", "June", "July", "August", "September",
						 "October", "November", "December"];

var g_intDay, g_strMonthYear;

function GenerateDayList(strID, intDaysOffset, strSelected)
{

	GenerateBookDate(intDaysOffset);

	if (strSelected) g_intDay = strSelected;

	document.write('<select name="' + strID + '" onSubmit="CheckDate()">');
	
	var intCount;
	for(intCount=1; intCount <= 31; intCount++)
	{
		document.write('<option value="' + intCount + '"');
		if (g_intDay == intCount)
			document.write(' selected');
		document.write('>' + intCount + '</option>');
	}
	
	document.write('</select> ');
}


function GenerateMonthList(strID, intDaysOffset, strSelected)
{

	document.write('<select name="' + strID + '" onSubmit="CheckDate()">');
	GenerateBookDate(intDaysOffset);

	if (strSelected) g_strMonthYear = strSelected;

	var dateCurrent = new Date();
	dateCurrent.setDate(1);
	var intCount, strCurMonthYear, strMonthYearValue;
	for(intCount=0; intCount < 11; intCount++)
	{
		strCurMonthYear = arrMonth[dateCurrent.getMonth()].substring(0, 3) + " " + dateCurrent.getFullYear();
		if (dateCurrent.getMonth() < 9)
			strCurMonthYearValue = "0" + (dateCurrent.getMonth()+1) + dateCurrent.getFullYear();
		else
			strCurMonthYearValue = "" + (dateCurrent.getMonth()+1) + dateCurrent.getFullYear();
		document.write('<option value="' + strCurMonthYearValue + '"');
		if (strCurMonthYear == g_strMonthYear || strCurMonthYearValue == g_strMonthYear)
			document.write(' selected');
		document.write('>' + strCurMonthYear + '</option>');
		
		// Add a month to the current date
		dateCurrent.setMonth(dateCurrent.getMonth()+1);
	}
	
	document.write('</select>');
}


	function submitformRHSnormal(selbox)   {
		if (selbox.selectedIndex>0)    {
			URL=selbox.options[selbox.selectedIndex].value + "&WL=" + readCookie("WL");		
			window.location=URL; 
			}
		}


	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

