var schemaName="arabiahorizons";
//var subURL="http://test1.secure-reservation.com/"+schemaName+"";
var subURL="http://booking.arabiahorizons.com/"+schemaName+"";

var airTxtArr = new Array();

var _month = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");







function loadHotelOnlySearchTest(countryOfResidence,hotelLocationStr,checkinDateIndex,checkinMonth,noOfNights,noOfRooms){

	document.forms[formName].engType[1].checked=true;

	setEngType("H");

	



	

	document.forms[formName].elements["H_Country"].value=countryOfResidence; // [Country of residence / Consumer region]

	defaultHotelCityLocation 	= hotelLocationStr; // [Hotel search location]

	document.forms[formName].elements["H_InDate"].selectedIndex	= Number(checkinDateIndex); // [Checkin date index]

	setDtOptIn('H','_In',document.forms[formName].elements["H_InDate"]); // Call this function after the above line

	document.forms[formName].elements["H_InMonthYr"].value 	= checkinMonth; // [Checking month value]

	setDtOptIn('H','_In',document.forms[formName].elements["H_InMonthYr"]); // Call this function after the above line

	document.forms[formName].elements["H_nights"].value = Number(noOfNights); // [No of nights]

	setDtOptIn('H','_In',document.forms[formName].elements["H_InDate"]); // Call this function after the above line

	document.forms[formName].elements["H_cmbNoOfRooms"].value=Number(noOfRooms); // [No of rooms]

	showRooms(Number(document.forms[formName].elements["H_cmbNoOfRooms"].value)); // Call this function after the above line

	



	if(defaultHotelCityLocation!=""){

		document.forms[formName].H_Loc.value		= defaultHotelCityLocation.split("|")[1];

		document.forms[formName].hid_H_Loc.value	= defaultHotelCityLocation;

	}

	

}



function loadDataNew_H(formName){

	setFields("H");

	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchHotels";

	if (chkDates()){showError();return;}



	var searchStr = document.forms[formName].hid_H_Loc.value.split("|");

	document.forms["ResPkgSearchForm"].searchCityId.value		= searchStr[0];

	document.forms["ResPkgSearchForm"].searchCityName.value	= searchStr[1];

	document.forms["ResPkgSearchForm"].searchStateId.value	= searchStr[2];

	document.forms["ResPkgSearchForm"].searchCountryId.value	= searchStr[3];

	

	document.forms["ResPkgSearchForm"].cmbCty_Hotels.value	= document.forms["ResPkgSearchForm"].searchCityId.value;

	document.forms["ResPkgSearchForm"].cityLookup_Hotels.value	= document.forms["ResPkgSearchForm"].searchCityName.value;

	document.forms["ResPkgSearchForm"].cmbSte_Hotels.value	= document.forms["ResPkgSearchForm"].searchStateId.value;

	document.forms["ResPkgSearchForm"].cmbCtry_Hotels.value	= document.forms["ResPkgSearchForm"].searchCountryId.value;

	

	document.forms["ResPkgSearchForm"].cmbInYr_Hotels.value	= Number(document.forms[formName].elements["H_InYear"].options[document.forms[formName].elements["H_InYear"].selectedIndex].value);

	document.forms["ResPkgSearchForm"].cmbInMn_Hotels.value	= Number(document.forms[formName].elements["H_InMonth"].options[document.forms[formName].elements["H_InMonth"].selectedIndex].value)+1;

	document.forms["ResPkgSearchForm"].cmbInDt_Hotels.value	= document.forms[formName].elements["H_InDate"].options[document.forms[formName].elements["H_InDate"].selectedIndex].value;	

	document.forms["ResPkgSearchForm"].cmbNgt_Hotels.value	= Number(document.forms[formName].elements["H_nights"].options[document.forms[formName].elements["H_nights"].selectedIndex].value);

	

	document.forms["ResPkgSearchForm"].cmbOutYr_Hotels.value	= Number(document.forms[formName].elements["H_OutYear"].options[document.forms[formName].elements["H_OutYear"].selectedIndex].value);

	document.forms["ResPkgSearchForm"].cmbOutMn_Hotels.value	= Number(document.forms[formName].elements["H_OutMonth"].options[document.forms[formName].elements["H_OutMonth"].selectedIndex].value)+1;

	document.forms["ResPkgSearchForm"].cmbOutDt_Hotels.value	= document.forms[formName].elements["H_OutDate"].options[document.forms[formName].elements["H_OutDate"].selectedIndex].value;

	

	//document.forms["ResPkgSearchForm"].cmbNoRm_Hotels.value	= Number(document.forms[formName].elements["H_cmbNoOfRooms"].options[document.forms[formName].elements["H_cmbNoOfRooms"].selectedIndex].value);	

	//document.forms["ResPkgSearchForm"].totRooms_Hotels.value	= Number(document.forms[formName].elements["H_cmbNoOfRooms"].options[document.forms[formName].elements["H_cmbNoOfRooms"].selectedIndex].value);

	

	document.forms["ResPkgSearchForm"].cmbInMn.value=Number(document.forms[formName].elements["H_InMonth"].options[document.forms[formName].elements["H_InMonth"].selectedIndex].value)+1;	

	document.forms["ResPkgSearchForm"].cmbInYr.value=document.forms[formName].elements["H_InYear"].options[document.forms[formName].elements["H_InYear"].selectedIndex].value;

	document.forms["ResPkgSearchForm"].cmbOutMn.value=Number(document.forms[formName].elements["H_OutMonth"].options[document.forms[formName].elements["H_OutMonth"].selectedIndex].value)+1;	

	document.forms["ResPkgSearchForm"].cmbOutYr.value=document.forms[formName].elements["H_OutYear"].options[document.forms[formName].elements["H_OutYear"].selectedIndex].value;	

	document.forms["ResPkgSearchForm"].cmbInDt.value=document.forms[formName].elements["H_InDate"].options[document.forms[formName].elements["H_InDate"].selectedIndex].value;			

	document.forms["ResPkgSearchForm"].cmbOutDt.value=document.forms[formName].elements["H_OutDate"].options[document.forms[formName].elements["H_OutDate"].selectedIndex].value;

	document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms[formName].H_Country.value;
	
	document.forms["ResPkgSearchForm"].elements["hotelStarId_Hotels"].value    =document.forms[formName].elements["hstarCat"].options[document.forms[formName].elements["hstarCat"].selectedIndex].value;

document.forms["ResPkgSearchForm"].elements["hotelType_Hotels"].value    =document.forms[formName].elements["hType"].options[document.forms[formName].elements["hType"].selectedIndex].value;

	document.forms["ResPkgSearchForm"].hotelName_Hotels.value = document.forms[formName].hotelName.value;
	document.forms["ResPkgSearchForm"].consumerCurrencyCode.value=document.forms[formName].elements["consumerCurrencyCode"].options[document.forms[formName].elements["consumerCurrencyCode"].selectedIndex].value;

	var OutMonth=document.forms["ResPkgSearchForm"].cmbOutMn.value;

	var InMonth=document.forms["ResPkgSearchForm"].cmbInMn.value;

	var cMonth=Number(_InDate.getMonth()+1);

	var d = new Date();

	var curr_year = d.getFullYear();

	var totalAdults 	= 0;

	var totalChildren	= 0;

	var occupancyStr	= "";

	

	if(document.forms["ResPkgSearchForm"].hotelCode_Hotels.value==""){

		document.forms["ResPkgSearchForm"].shtcd_Hotels.value="0";

	}

	if(document.forms["ResPkgSearchForm"].occupancy_Details_Hotels.value==""){

		document.forms["ResPkgSearchForm"].occupancy_Details_Hotels.value = "<room1Adult>1</room1Adults><room1Children>0</room1Children>";

	}

	document.forms["ResPkgSearchForm"].cmbtourOpt_Hotels.value="0";

	document.forms["ResPkgSearchForm"].pkgType.value	= "H";

	var currentDate 	= new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate());

	var checkinDate 	= new Date(Number(document.forms["ResPkgSearchForm"].cmbInYr.value),Number(document.forms["ResPkgSearchForm"].cmbInMn.value)-1,Number(document.forms["ResPkgSearchForm"].cmbInDt.value));

	var checkoutDate 	= new Date(Number(document.forms["ResPkgSearchForm"].cmbOutYr.value),Number(document.forms["ResPkgSearchForm"].cmbOutMn.value)-1,Number(document.forms["ResPkgSearchForm"].cmbOutDt.value));

	

	
	/*if (searchStr==""){

		alert("Please Enter the Location!");
		
	}else if(document.forms["ResPkgSearchForm"].consumerRegionId.value=="null"){

		alert("Please Enter the Passenger Nationality!");


	}else*/
	
	if (checkinDate>checkoutDate || checkinDate<currentDate){

		alert("The Correct Date Should be Selected!");

	}/*else if(document.getElementById("H_Country").value=="null"){

		alert("Country of Residence Must be Selected!");

	}*/else {

		befSubmit('H');

		document.forms["ResPkgSearchForm"].submit();

	}

}



//activity

function loadDataNew_A(formName){

	

	setFields("A");

	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchActivities";

	if (chkDates()){showError();return;}

	

	var searchStr = document.forms[formName].hid_H_Loc.value.split("|");

	document.forms["ResPkgSearchForm"].searchCityId.value	= searchStr[0];

	document.forms["ResPkgSearchForm"].searchCityName.value	= searchStr[1];

	document.forms["ResPkgSearchForm"].searchStateId.value	= searchStr[2];

	document.forms["ResPkgSearchForm"].searchCountryId.value	= searchStr[3];

	document.forms["ResPkgSearchForm"].cmbCty_Activities.value	= document.forms["ResPkgSearchForm"].searchCityId.value;

	document.forms["ResPkgSearchForm"].cityLookup_Activities.value	= document.forms["ResPkgSearchForm"].searchCityName.value;

	document.forms["ResPkgSearchForm"].cmbCtry_Activities.value	= document.forms["ResPkgSearchForm"].searchCountryId.value;

	

	document.forms["ResPkgSearchForm"].cmbInYr_Activities.value	= Number(document.forms[formName].elements["activity_InYear"].options[document.forms[formName].elements["activity_InYear"].selectedIndex].value);

	document.forms["ResPkgSearchForm"].cmbInMn_Activities.value	= Number(document.forms[formName].elements["activity_InMonth"].options[document.forms[formName].elements["activity_InMonth"].selectedIndex].value)+1;

	document.forms["ResPkgSearchForm"].cmbInDt_Activities.value	= document.forms[formName].elements["activity_InDate"].options[document.forms[formName].elements["activity_InDate"].selectedIndex].value;

	

	document.forms["ResPkgSearchForm"].cmbOutYr_Activities.value	= Number(document.forms[formName].elements["activity_OutYear"].options[document.forms[formName].elements["activity_OutYear"].selectedIndex].value);

	document.forms["ResPkgSearchForm"].cmbOutMn_Activities.value	= Number(document.forms[formName].elements["activity_OutMonth"].options[document.forms[formName].elements["activity_OutMonth"].selectedIndex].value)+1;

	document.forms["ResPkgSearchForm"].cmbOutDt_Activities.value	= document.forms[formName].elements["activity_OutDate"].options[document.forms[formName].elements["activity_OutDate"].selectedIndex].value;

	

	document.forms["ResPkgSearchForm"].cmbInMn.value=Number(document.forms[formName].elements["activity_InMonth"].options[document.forms[formName].elements["activity_InMonth"].selectedIndex].value)+1;

	document.forms["ResPkgSearchForm"].cmbInYr.value=document.forms[formName].elements["activity_InYear"].options[document.forms[formName].elements["activity_InYear"].selectedIndex].value;

	document.forms["ResPkgSearchForm"].cmbOutMn.value=Number(document.forms[formName].elements["activity_OutMonth"].options[document.forms[formName].elements["activity_OutMonth"].selectedIndex].value)+1;

	document.forms["ResPkgSearchForm"].cmbOutYr.value=document.forms[formName].elements["activity_OutYear"].options[document.forms[formName].elements["activity_OutYear"].selectedIndex].value;

	

	document.forms["ResPkgSearchForm"].cmbInDt.value=document.forms[formName].elements["activity_InDate"].options[document.forms[formName].elements["activity_InDate"].selectedIndex].value;

	document.forms["ResPkgSearchForm"].cmbOutDt.value=document.forms[formName].elements["activity_OutDate"].options[document.forms[formName].elements["activity_OutDate"].selectedIndex].value;

	

	document.forms["ResPkgSearchForm"].cmbNoOfAdults_Activities.value 	= document.forms[formName].elements["R1occAdults_A"].value;

	document.forms["ResPkgSearchForm"].cmbNoOfChildren_Activities.value = document.forms[formName].elements["R1occChi_A"].value;

	

	var roomChildren= Number(document.forms["ResPkgSearchForm"].cmbNoOfChildren_Activities.value);

	document.forms["ResPkgSearchForm"].gstChildAges_Activities.value = "";

	for(var childCount=0;childCount<Number(roomChildren);childCount++){

		document.forms["ResPkgSearchForm"].gstChildAges_Activities.value+=document.forms[formName].elements["R1occAge"+(childCount+1)+"_A"].value;

		if(childCount!=(Number(roomChildren)-1)){

			document.forms["ResPkgSearchForm"].gstChildAges_Activities.value+=",";

		}

	}

	

	var OutMonth=document.forms["ResPkgSearchForm"].cmbOutMn.value;

	var InMonth=document.forms["ResPkgSearchForm"].cmbInMn.value;

	var cMonth=Number(_InDate.getMonth()+1);



	var d = new Date();

	var curr_year = d.getFullYear();

	

	

	document.forms["ResPkgSearchForm"].cmbNgt_Activities.value	= Number(document.forms[formName].elements["activity_nights"].options[document.forms[formName].elements["activity_nights"].selectedIndex].value);

	document.forms["ResPkgSearchForm"].actType_Activities.value	= document.forms[formName].elements["Act_type"].options[document.forms[formName].elements["Act_type"].selectedIndex].value;

	document.forms["ResPkgSearchForm"].pkgType.value	= "A";

	document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms[formName].A_Country.value;

	document.forms["ResPkgSearchForm"].consumerCurrencyCode.value=document.forms[formName].elements["Act_consumerCurrencyCode"].options[document.forms[formName].elements["Act_consumerCurrencyCode"].selectedIndex].value; 

	var currentDate 	= new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate());

	var checkinDate 	= new Date(Number(document.forms["ResPkgSearchForm"].cmbInYr.value),Number(document.forms["ResPkgSearchForm"].cmbInMn.value)-1,Number(document.forms["ResPkgSearchForm"].cmbInDt.value));

	var checkoutDate 	= new Date(Number(document.forms["ResPkgSearchForm"].cmbOutYr.value),Number(document.forms["ResPkgSearchForm"].cmbOutMn.value)-1,Number(document.forms["ResPkgSearchForm"].cmbOutDt.value));

	if (searchStr==""){

		alert("Please Enter the Location!");
		
	}else if (document.forms["ResPkgSearchForm"].consumerRegionId.value=="null"){

		alert("Please Enter the Passenger Nationality!");

	}else if (checkinDate>checkoutDate || checkinDate<currentDate){

		alert("The Correct Date Should be Selected!");

	}/*else if(document.getElementById("A_Country").value=="null"){

		alert("Country of Residence Must be Selected!");

	}*/else {

		befSubmit('A');

		document.forms["ResPkgSearchForm"].submit();

	}

	

}







var checkMore_new=0;

function setCharSecond(ch,img){

var flag =0;

var tmpArr = new Array();

	for (var j=0; j<airTxtArr.length; j++){

		if (airTxtArr[j][0].toUpperCase().indexOf(ch.value.toUpperCase())==0){

			if (!showAllLoc){checkMore_new++;if (checkMore_new>10){break;}}

			tmpArr[tmpArr.length]="<tr><td class=\"stripe"+((j%2)+3)+"\" style=\"padding-left:5px;cursor:pointer;\" onMouseOver=\"altcell('ov',this)\" onMouseOut=\"altcell('ou',this,'stripe"+((j%2)+3)+"')\" onClick=\"setValSecond("+j+",'"+ch.name+"')\">"+airTxtArr[j][0]+" - "+airTxtArr[j][1]+" - "+airTxtArr[j][3]+"- "+airTxtArr[j][7]+"</td></tr>";

			flag = 1;

		}

		if ((airTxtArr[j][1].toUpperCase().indexOf(ch.value.toUpperCase())==0) && flag==0){

			if (!showAllLoc){checkMore_new++;if (checkMore_new>10){break;}}

			tmpArr[tmpArr.length]="<tr><td class=\"stripe"+((j%2)+3)+"\" style=\"padding-left:5px;cursor:pointer;\" onMouseOver=\"altcell('ov',this)\" onMouseOut=\"altcell('ou',this,'stripe"+((j%2)+3)+"')\" onClick=\"setValSecond("+j+",'"+ch.name+"')\">"+airTxtArr[j][0]+" - "+airTxtArr[j][1]+" - "+airTxtArr[j][3]+"- "+airTxtArr[j][7]+"</td></tr>";

		}

		var flag =0;

	}

	if (!showAllLoc){

		if (checkMore_new>10){tmpArr[tmpArr.length]="<tr><td class=\"morebg\" style=\"padding-left:5px;cursor:pointer;\" onClick=\"showAllLoc=true;setCharSecond(document.forms['form1'].elements['"+ch.name+"'],'"+img+"')\" title=\"Show All\" align=\"center\"><img src=\"images/more_arrow.gif\" width=\"9\" height=\"6\" border=\"0\" hspace=\"3\" alt=\"Show All\" align=\"absmiddle\">Show All</td></tr>";}

	}

	checkMore_new=0;

	

	var outSt="";

if (tmpArr.length==0){

	outSt="<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" class=\"databorder\"><tr><td class=\"stripe4\" onClick=\"setObjPos('ixpDataFrame',0,0,180,0,'none');setObjPos('maskFrame',0,0,0,0,'none');\" align=\"center\">... No Results Available ...</td></tr></table>";

	showRes(img,outSt,1);

}else{

	outSt="<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"4\" class=\"databorder\">"+tmpArr.join("")+"</table>";

	showRes(img,outSt,tmpArr.length);

}

tmpArr.length=0;

}



function setValSecond(index,obj){	

	document.forms[formName].elements[obj].value=airTxtArr[index][0];

			

	setObjPos('ixpDataFrame',0,0,180,0,'none');

	setObjPos('maskFrame',0,0,0,0,'none');

	showAllLoc=false;

}



function altcell(st,obj,cls){

	if (st=="ov"){

	obj.className="overclass";

	}else{

	obj.className=cls;

	}

}
function browsc(){
var nav=navigator.appName;
var uag=navigator.userAgent;
var brow="";
var errorMsg="";
if (uag.indexOf("Netscape/7")>-1){
brow="NS7";
//alert("NS7");
brow=="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
}else if (uag.indexOf("Firefox")>-1){
brow="Firefox";
//alert("Firefox");
brow=="<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>";
}else if (uag.indexOf("Opera")>-1){
//alert("Opera");
brow="Opera";
brow=="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
}else if(uag.indexOf("IE")>-1){
brow="IE";
//alert("IE");
brow=="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
}else if(uag.indexOf("Safari")>-1){
brow="Safari";
//alert("Safari");
brow=="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
}
}