	var win = null;

	function calendar_window(NewPage, Version)
	{  var vd = '';
	   var vm = '';
	   var vy = '';
	   for (i=0; i<document.forms[0].elements.length; i++) {if (document.forms[0].elements[i].name == 'Menu1:'+Version+':d') {vd=document.forms[0].elements[i].value}
							 if (document.forms[0].elements[i].name == 'Menu1:'+Version+':m') {vm=document.forms[0].elements[i].value}
							 if (document.forms[0].elements[i].name == 'Menu1:'+Version+':y') {vy=document.forms[0].elements[i].value}     }
							 if (win && win.open && !win.closed) win.close();
							 win = window.open(NewPage+'?DepDate='+vd+'/'+vm+'/'+vy+'&Version='+Version,'calendar_window','width=270,height=210');
	}

function DoCallback(url, param1, param2, param3, param4, param5, param6){
   <!-- url:    URL to invoke  -->
   <!-- params: string object to pass to the remote URL -->
   <!-- Add some parameters to the query string  -->
   var pageUrl = url + "?callback=true&param1=" + param1 + "&param2=" + param2 + "&param3=" + param3 + "&param4=" + param4 + "&param5=" + param5 + "&param6=" + param6;

   <!-- Initialize the XmlHttp object -->
	try {
		<!--Mozilla Browsers-->
		xmlRequest = new XMLHttpRequest();
	}
	catch (e) {
		try {
			<!--IE -->
			xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) {
			<!--Something else that won't work with this code... -->
			xmlRequest=false;
		}
	}
	<!-- Post our XmlRequest and get our desired string -->
	try {
		xmlRequest.open("GET", pageUrl, false);
		xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlRequest.send(null);}
	catch(e) {xmlRequest=false;}

	<!-- Return the XmlHttp object -->
	return xmlRequest;

}

function ShowDeparturesVillas(){
	try {
	for (x = document.frmMain.Menu1_DepartureAirports.length; x >= 0; x = x - 1) {
		document.frmMain.Menu1_DepartureAirports[x] = null;
	}
		}
	catch (err00) {var ErrX = ""}

	try {
	var Resort = document.frmMain.Menu1_Resorts.value;}
	catch (err0) {var Resort = "WLD";}

	try {
	var xml = DoCallback("CallBack.aspx", "VillaDepartures", "", "", Resort, "", "");
	var Result = xml.responseText;
	var resultArray = Result.split(";")
	var splitArray = new Array();
	for(var i=0; i < resultArray.length; i++){
		splitArray = resultArray[i].split("|");
		document.frmMain.Menu1_DepartureAirports.options[document.frmMain.Menu1_DepartureAirports.length]
		= new Option(splitArray[1], splitArray[0]); }
		}
	catch (err1) {var Result = ""}

	SetDepartureAirport();

	ShowVillaDates();
					  }

function SetDepartureAirport(){
	try {
	var xml = DoCallback("CallBack.aspx", "SetDepartureAirport", "", "", "", "", "");
	var Result = xml.responseText;

	document.frmMain.Menu1_DepartureAirports.value = Result;
		}
	catch (err0) {Result = ""}	
					  }

function ShowDepartures(){
	for (x = document.frmMain.Menu1_DepartureAirports.length; x >= 0; x = x - 1) {
		document.frmMain.Menu1_DepartureAirports[x] = null;
	}
	var xml = DoCallback("CallBack.aspx", "", "", "", "", "", "");
	var Result = xml.responseText;
	var resultArray = Result.split(";")
	var splitArray = new Array();
	for(var i=0; i < resultArray.length; i++){
		splitArray = resultArray[i].split("|");
		document.frmMain.Menu1_DepartureAirports.options[document.frmMain.Menu1_DepartureAirports.length]
		= new Option(splitArray[1], splitArray[0]); }

	ShowRegions();				  }

function ShowRegions(){
	try {
	for (x = document.frmMain.Menu1_Regions.length; x >= 0; x = x - 1) {
		document.frmMain.Menu1_Regions[x] = null;
	}
	var Airport = document.frmMain.Menu1_DepartureAirports.value;
	var xml = DoCallback("CallBack.aspx", Airport, "", "", "", "", "");
	var Result = xml.responseText;
	var resultArray = Result.split(";")
	var splitArray = new Array();
	for(var i=0; i < resultArray.length; i++){
		splitArray = resultArray[i].split("|");
		document.frmMain.Menu1_Regions.options[document.frmMain.Menu1_Regions.length]
		= new Option(splitArray[1], splitArray[0]); }
		}
	catch(err) {
		for (x = document.frmMain.Menu1_Destinations.length; x >= 0; x = x - 1) {
			document.frmMain.Menu1_Destinations[x] = null;
		}
		try {
		var Airport = document.frmMain.Menu1_DepartureAirports.value;}
		catch (err0) {var Airport = "";}

		try {
		var Region  = document.frmMain.Menu1_Regions.value;}
		catch(err1) {var Region  = "WLD";}

		var xml = DoCallback("CallBack.aspx", Airport, Region, "", "", "", "");
		var Result = xml.responseText;
		var resultArray = Result.split(";")
		var splitArray = new Array();
		for(var i=0; i < resultArray.length; i++){
			splitArray = resultArray[i].split("|");
			document.frmMain.Menu1_Destinations.options[document.frmMain.Menu1_Destinations.length]
			= new Option(splitArray[1], splitArray[0]); }

	}
	ShowDestinations();				  }

function ShowDestinations(){
	for (x = document.frmMain.Menu1_Destinations.length; x >= 0; x = x - 1) {
		document.frmMain.Menu1_Destinations[x] = null;
	}
	try {
	var Airport = document.frmMain.Menu1_DepartureAirports.value;}
	catch (err0) {var Airport = "";}

	try {
	var Region  = document.frmMain.Menu1_Regions.value;}
	catch(err1) {var Region  = "WLD";}

	var xml = DoCallback("CallBack.aspx", Airport, Region, "", "", "", "");
	var Result = xml.responseText;
	var resultArray = Result.split(";")
	var splitArray = new Array();
	for(var i=0; i < resultArray.length; i++){
		splitArray = resultArray[i].split("|");
		document.frmMain.Menu1_Destinations.options[document.frmMain.Menu1_Destinations.length]
		= new Option(splitArray[1], splitArray[0]); }
   ShowResorts();						   }

function ShowResorts(){
	for (x = document.frmMain.Menu1_Resorts.length; x >= 0; x = x - 1) {
		document.frmMain.Menu1_Resorts[x] = null;
	}
	try {
	var Airport = document.frmMain.Menu1_DepartureAirports.value;}
	catch (err0) {var Airport = "";}

	try {
	var Region  = document.frmMain.Menu1_Regions.value;}
	catch(err1) {var Region  = "WLD";}

	var Destination  = document.frmMain.Menu1_Destinations.value;
	var Destination1  = document.frmMain.Menu1_Destinations[document.frmMain.Menu1_Destinations.selectedIndex].text;
	var xml = DoCallback("CallBack.aspx", Airport, Region, Destination+ "|"+Destination1, "", "", "");
	var Result = xml.responseText;
	var resultArray = Result.split(";")
	var splitArray = new Array();
	for(var i=0; i < resultArray.length; i++){
		splitArray = resultArray[i].split("|");
		document.frmMain.Menu1_Resorts.options[document.frmMain.Menu1_Resorts.length]
		= new Option(splitArray[1], splitArray[0]); }
					  }

function ShowVillaDates(){
	for (x = document.frmMain.Menu1_VillaDates.length; x >= 0; x = x - 1) {
		document.frmMain.Menu1_VillaDates[x] = null;
	}
	try {
	var Resort = document.frmMain.Menu1_Resorts.value;}
	catch (err0) {var Resort = "";}

	try {
	var VillaMonth = document.frmMain.Menu1_VillaMonths.value;}
	catch (err1) {var VillaMonth = "";}

	var xml = DoCallback("CallBack.aspx", "VillaMonth", "VillaMonth", VillaMonth, Resort, "", "");
	var Result = xml.responseText;
	var resultArray = Result.split(";")
	var splitArray = new Array();
	for(var i=0; i < resultArray.length; i++){
		splitArray = resultArray[i].split("|");
		document.frmMain.Menu1_VillaDates.options[document.frmMain.Menu1_VillaDates.length]
		= new Option(splitArray[1], splitArray[0]); }

					   }

function ShowNothing(){

					   }


function ShowRooms(){
	if (document.frmMain.Menu1_CallbackType.value == "Callback") {
	try {
		var NoRooms  = document.frmMain.Menu1_Rooms.value;
		for(var i=1; i <= 5; i++){
					 hideThisRoom(i);
								  }

		for(var i=1; i <= NoRooms; i++){
						 showThisRoom(i);
								  }

		}
	catch(err) {

				for(var i=1; i <= 5; i++){
					 hideThisRoom(i);
								  }

				showThisRoom(1);
			   }
						   }
							  }

function loader(){
		 ShowRooms();
							  }

function SendFinalRequest(){
	try {
	var Airport = document.frmMain.Menu1_DepartureAirports.value;
	Airport = Airport.replace(/\//g, "+");}
	catch (err0) {var Airport = "";}

	try {
	var Region  = document.frmMain.Menu1_Regions.value;
	Region = Region.replace(/\//g, "+");}
	catch(err1) {var Region  = "WLD";}

	try {
	var Destination  = document.frmMain.Menu1_Destinations.value;
	Destination = Destination.replace(/\//g, "+");}
	catch(err2) {var Destination  = "WLD";}

	try {
	var Resort  = document.frmMain.Menu1_Resorts.value;
	Resort = Resort.replace(/\//g, "+");}
	catch(err3) {var Resort  = "WLD";}

	try {
	var VMonth  = document.frmMain.Menu1_VillaMonths.value;
	VMonth = VMonth.replace(/\//g, "+");}
	catch(err4) {var VMonth  = "";}

	try {
	var VDate  = document.frmMain.Menu1_VillaDates.value;
	VDate = VDate.replace(/\//g, "+");}
	catch(err4) {var VDate  = "";}

	var xml = DoCallback("CallBack.aspx", Airport, Region, Destination, Resort, VMonth, VDate);
	var Result = xml.responseText;

							  }

function hideThisRoom(ID){
	hideElement('Menu1_PanelRoom'+ID);
	hideElement('TableRoom'+ID);
	hideElement('Menu1_AdultsRoom'+ID);
	hideElement('Menu1_ChildRoom'+ID);
	hideElement('Menu1_InfantsRoom'+ID);
	hideElement('R'+ID+'ChildAgesSpan');
	hideElement('Menu1_R'+ID+'ChildAge9');
	hideElement('Menu1_R'+ID+'ChildAge8');
	hideElement('Menu1_R'+ID+'ChildAge7');
	hideElement('Menu1_R'+ID+'ChildAge6');
	hideElement('Menu1_R'+ID+'ChildAge5');
	hideElement('Menu1_R'+ID+'ChildAge4');
	hideElement('Menu1_R'+ID+'ChildAge3');
	hideElement('Menu1_R'+ID+'ChildAge2');
	hideElement('Menu1_R'+ID+'ChildAge1');
	hideElement('R'+ID+'ChildAgesSpan');
							}
function showThisRoom(ID){
	var NoChild  = document.getElementById('Menu1_ChildRoom'+ID).value;

	showElement('Menu1_PanelRoom'+ID);
	showElement('TableRoom'+ID);
	showElement('Menu1_AdultsRoom'+ID);
	showElement('Menu1_ChildRoom'+ID);
	showElement('Menu1_InfantsRoom'+ID);

	hideElement('R'+ID+'ChildAgesSpan');
		for(var i=1; i <= 9; i++){hideElement('Menu1_R'+ID+'ChildAge'+i);}


	if (NoChild > 0) {
		showElement('R'+ID+'ChildAgesSpan');
			for(var i=1; i <= NoChild; i++){showElement('Menu1_R'+ID+'ChildAge'+i);}
			  }
						  }

function ShowChild(ID){
	var NoChild  = document.getElementById('Menu1_ChildRoom'+ID).value;

	hideElement('R'+ID+'ChildAgesSpan');
		for(var i=1; i <= 9; i++){hideElement('Menu1_R'+ID+'ChildAge'+i);}

	if (NoChild > 0) {
		showElement('R'+ID+'ChildAgesSpan');
			for(var i=1; i <= NoChild; i++){showElement('Menu1_R'+ID+'ChildAge'+i);}
			  }
						  }

function showElement(IDName){
	if (document.layers)
	{
		document.layers[IDName].visibility = 'show';
		document.layers[IDName].display = 'block';
	}
	else if (document.all)
	{
		document.all[IDName].style.visibility = 'visible';
		document.all[IDName].style.display = 'block';
	}
	else if (document.getElementById)
	{
		document.getElementById(IDName).style.visibility = 'visible';
		document.getElementById(IDName).style.display = 'block';
	}

							   }

function hideElement(IDName){
	if (document.layers)
	{
		document.layers[IDName].visibility = 'hide';
		document.layers[IDName].display = 'none';
	}
	else if (document.all)
	{
		document.all[IDName].style.visibility = 'hidden';
		document.all[IDName].style.display = 'none';
	}
	else if (document.getElementById)
	{
		document.getElementById(IDName).style.visibility = 'hidden';
		document.getElementById(IDName).style.display = 'none';
	}

							   }

