var aD, dD; //Arrival & departure dates
	var today = new Date();
	today.setDate(today.getDate() + 5); //today's date plus 5
	var AFFILIATE = "";//Affiliate code IATA/ARC/CLID, etc
	var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
 
	//Go to Reservhotel function will check all parameters before submitting the form
	function gotoReservHotel(){
		if (document.myform.aDate.value == "")//Check if arrival date has been selected
			alert("Select your arrival date");
		else if (document.myform.dDate.value == "")//Check if departure date has been selected
			alert("Select your departure date");
		else if (dD <= aD)//check to see that departure date is after the arrival date
			alert("The departure date can not be after the return date.");
		else if (HOTELONLY == false && document.getElementById("xAirport") && document.getElementById("xAirport").value == "")//check to see if the airport has been selected
			alert("You must select a departing airport for hotel and air packages.");
		else if (aD < today && (document.getElementById("xAirport") && HOTELONLY == false)){  //check to see packages are selected in the future
			alert("Packages must have be select at least 5 days from today.");
		}else{
 
			//check affiliate and add hidden attribute to the form
			if  (AFFILIATE != ""){
					var field3 = document.createElement("input");
					field3.setAttribute("type","hidden");
					field3.setAttribute("value",AFFILIATE );
					field3.setAttribute("name","aff");
					document.getElementById("myform").appendChild(field3);
			}
			document.myform.submit();
		}
	}
	var HOTELONLY = false;
 
	//Change tab type
	function getType(show){
		if (show == "hotel"){
			document.getElementById("xAirport").style.display = "none";
			document.getElementById("xAirport").selectedIndex = -1;
			document.getElementById("xCountry").style.display = "none";
			document.getElementById("xCountry").selectedIndex = -1;
			HOTELONLY = true;
			MM_swapImage('Air','','/calendar/images/hotel-AirTabBLUE.gif',1);
			MM_swapImage('Hotel','','/calendar/images/Hotel-ONLY-tabBLUE-ACTIVE.gif',1);
		}else{
			document.getElementById("xAirport").style.display = "";
			document.getElementById("xCountry").style.display = "";
			HOTELONLY = false;
			MM_swapImage('Air','','/calendar/images/hotel-AirTabBLUE-ACTIVE.gif',1);
			MM_swapImage('Hotel','','/calendar/images/Hotel-ONLY-tabBLUE.gif',1);
 
		}
	}
 
	var request = null;
	function createRequest() {
		try {request = new XMLHttpRequest();} catch (trymicrosoft) {
			try {request = new ActiveXObject("Msxml2.XMLHTTP");} catch (othermicrosoft) {
				try {request = new ActiveXObject("Microsoft.XMLHTTP");}catch (failed) {
				   request = null;}}}
		if (request == null){alert("Error creating request object!  Your browser does not support AJAX.  Please update it to use this site.")};
	}
 
	function getAirports(){
		createRequest();
		var url = "html_countries/"+document.getElementById("countries").value+".html";
		if (request == null){
			document.write("Asynchronous Request Failed");
		}else{
			request.open("GET", url, true);
			request.onreadystatechange = function(){
				if (request.readyState == 4){
					document.getElementById("airport_list").innerHTML=request.responseText;
				}
			};
			request.send(null);
		}
	}
 
	//Swap pictures functions
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
 
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
