var schemaName="flightsightv3";

var subURL="http://bookings.flightsite.co.za/"+schemaName+"";


var v_cutoff = 2;
var f_cutoff = 2;
var h_cutoff = 2;
var a_cutoff = 2;
var c_cutoff = 2;

var v_max_pax = 6;
var f_max_pax = 9;

var h_min_nights = 1
var h_max_nights = 31

var v_error_dep ="Departure Date cannot be after the Return date!";
var v_error_from ="Please type the first few letters of your departure point and select from the list displayed.";
var v_error_to ="Please type the first few letters of your destination and select from the list displayed.";
var v_error_same_loc ="The departure point and and destination cannot be the same!";
var v_error_adult_inf ="Only 1 infant per adult permitted.";
var v_error_max_pax ="Your enquiry has exceeded the maximum passenger count. Please contact us for group booking requests.";
var v_error_cutoff_1 ="Departure Date should be later than ";
var v_error_cutoff_2 =" days from the current time!";
var v_error_11="Your Search Date Period Should be Less Than 11 Months from the current date!"

var f_error_cutoff_1 ="Departure Date should be later than ";
var f_error_cutoff_2 =" days from the current time!";
var f_error_dep ="Departure Date cannot be after the Return date.";
var f_error_from ="Please type the first few letters of your departure point and select from the list displayed.";
var f_error_to ="Please type the first few letters of your destination and select from the list displayed.";
var f_error_same_loc ="The departure point and and destination cannot be the same!";
var f_error_adult_inf ="Only 1 infant per adult permitted.";
var f_error_max_pax ="Your enquiry has exceeded the maximum passenger count. Please contact us for group booking requests.";
var f_error_11="Your Search Date Period Should be Less Than 11 Months from the current date!"

var h_error_loc ="Please type the first few letters of your departure point then select from the list displayed.";
var h_error_cutoff_1 ="Departure Date should be later than ";
var h_error_cutoff_2 =" days from the current time!";
var h_error_max ="Number of nights can not exceed 31. Please modify your search dates and try again.";
var h_error_min ="Number of nights can not be less than 1. Please modify your search dates and try again.";
var h_error_dep ="Departure Date cannot be after the Return date!";

var a_error_res ="Please select your country of residence from the drop down!";
var a_error_loc ="Please type the first few letters of your departure point then select from the list displayed.";
var a_error_dep ="Departure Date cannot be after the Return date!";
var a_error_cutoff_1 ="Departure Date should be later than ";
var a_error_cutoff_2 =" days from the current time!";

var c_error_res ="Please select your country of residence from the drop down!";
var c_error_from ="Please type the first few letters of the pick up location and then select from the list displayed.";
var c_error_to ="Please type the first few letters of the drop off location and then select from the list displayed.";
var c_error_dep ="Pickup Date cannot be after the Return date!";
var c_error_cutoff_1 ="Pickup Date should be later than ";
var c_error_cutoff_2 =" days from the current time!";


var airTxtArr = new Array();
var _month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");


function loadDataNew_V(){
	setFields("F");
	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchAir";
	if (chkDates()){showError();return;}
	var depSearchStr = document.forms["form1"].V_DepFromHid.value.split(",");
	var retSearchStr = document.forms["form1"].V_RetLocHid.value.split(",");		

	document.forms["ResPkgSearchForm"].cmbNgt.value= 2;		
	document.forms["ResPkgSearchForm"].tripType_Air.value = "R";	
	
	
	
	var air_InDate		= document.forms["form1"].elements["air_InDate"].options[document.forms["form1"].elements["air_InDate"].selectedIndex].value;
	var air_InMonth 	= Number(document.forms["form1"].elements["air_InMonth"].options[document.forms["form1"].elements["air_InMonth"].selectedIndex].value)+1;
	
	if(air_InMonth<10){
		air_InMonth ="0"+air_InMonth;
	}
	
	var	air_OutDate		= document.forms["form1"].elements["air_OutDate"].options[document.forms["form1"].elements["air_OutDate"].selectedIndex].value;
	var air_OutMonth 	= Number(document.forms["form1"].elements["air_OutMonth"].options[document.forms["form1"].elements["air_OutMonth"].selectedIndex].value)+1;
	
	if(air_OutMonth<10){
		air_OutMonth ="0"+air_OutMonth;
	}
	
	var inDateObj=new Date(Number(document.forms["form1"].elements["air_InYear"].options[document.forms["form1"].elements["air_InYear"].selectedIndex].value),Number(air_InMonth)-1,Number(air_InDate),0,0,0,0);
	var outDateObj=new Date(Number(document.forms["form1"].elements["air_OutYear"].options[document.forms["form1"].elements["air_OutYear"].selectedIndex].value),Number(air_OutMonth)-1,Number(air_OutDate),0,0,0,0);
	var dtDiff=Number(get_deference(inDateObj,outDateObj));
	
	document.forms["ResPkgSearchForm"].vacationpkg.value	   	= 'Y'
	document.forms["ResPkgSearchForm"].depDate_Air.value	   	= Number(document.forms["form1"].elements["air_InYear"].options[document.forms["form1"].elements["air_InYear"].selectedIndex].value)+"-"+air_InMonth+"-"+air_InDate;	
	
	document.forms["ResPkgSearchForm"].cmbDepTime_Air.value 		= document.forms["form1"].Air_DepTime.value;
	
	document.forms["ResPkgSearchForm"].depLoc_Air.value	   		= depSearchStr[1];
	document.forms["ResPkgSearchForm"].depLocName_Air.value 	= depSearchStr[0]+"&nbsp;&nbsp;("+depSearchStr[3]+"-"+depSearchStr[7]+")";		
		
	document.forms["ResPkgSearchForm"].vacationSearchDepStr.value= document.forms["form1"].V_DepFromHid.value.replace(/,/g,"|");
	document.forms["ResPkgSearchForm"].vacationSearchRetStr.value= document.forms["form1"].V_RetLocHid.value.replace(/,/g,"|");
	
	document.forms["ResPkgSearchForm"].arrLoc_Air.value	   		= retSearchStr[1];
	document.forms["ResPkgSearchForm"].arrLocName_Air.value 	= retSearchStr[0]+"&nbsp;&nbsp;("+retSearchStr[3]+"-"+retSearchStr[7]+")";
	
	/*document.forms["ResPkgSearchForm"].depLoc_Air.value	   	= depSearchStr[1];
	alert(depSearchStr[1]);
	document.forms["ResPkgSearchForm"].depLocName_Air.value 		= depSearchStr[0];	
		alert(depSearchStr[0]);
	document.forms["ResPkgSearchForm"].depAirport_Air.value	 = depSearchStr[3];
		alert(depSearchStr[3]);
	
	
	document.forms["ResPkgSearchForm"].arrLoc_Air.value	   	= retSearchStr[1];
	document.forms["ResPkgSearchForm"].arrLocName_Air.value 		= retSearchStr[0];
		document.forms["ResPkgSearchForm"].arrAirport_Air.value	   	= retSearchStr[3];*/
		
	document.forms["ResPkgSearchForm"].arrDate_Air.value	   	= Number(document.forms["form1"].elements["air_OutYear"].options[document.forms["form1"].elements["air_OutYear"].selectedIndex].value)+"-"+air_OutMonth+"-"+air_OutDate;
	document.forms["ResPkgSearchForm"].cmbArrDt_Air.value 		= air_OutDate;
	document.forms["ResPkgSearchForm"].cmbArrMn_Air.value 		= air_OutMonth;
	document.forms["ResPkgSearchForm"].cmbArrYr_Air.value 
	
	document.forms["ResPkgSearchForm"].cmbArrTime_Air.value 		= document.forms["form1"].Air_RetTime.value;
	document.forms["ResPkgSearchForm"].cmbInMn_Hotels.value 		= air_InMonth;
	document.forms["ResPkgSearchForm"].cmbInDt_Hotels.value 		= air_InDate;
	document.forms["ResPkgSearchForm"].cmbInYr_Hotels.value 		= document.forms["form1"].elements["air_InYear"].options[document.forms["form1"].elements["air_InYear"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbOutDt_Hotels.value 		= air_OutDate;
	document.forms["ResPkgSearchForm"].cmbOutMn_Hotels.value 		= air_OutMonth;
	document.forms["ResPkgSearchForm"].cmbOutYr_Hotels.value 		= document.forms["form1"].elements["air_OutYear"].options[document.forms["form1"].elements["air_OutYear"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbNgt_Hotels.value 			= Number(dtDiff);
	//document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms["form1"].V_Country.value;
	
	
	document.forms["ResPkgSearchForm"].cmbInMn_Activities.value 	= air_InMonth;
	document.forms["ResPkgSearchForm"].cmbInDt_Activities.value 	= air_InDate;
	document.forms["ResPkgSearchForm"].cmbInYr_Activities.value 	= document.forms["form1"].elements["air_InYear"].options[document.forms["form1"].elements["air_InYear"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbOutDt_Activities.value 	= air_OutDate;
	document.forms["ResPkgSearchForm"].cmbOutMn_Activities.value 	= air_OutMonth;
	document.forms["ResPkgSearchForm"].cmbOutYr_Activities.value 	= document.forms["form1"].elements["air_OutYear"].options[document.forms["form1"].elements["air_OutYear"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbNgt_Activities.value 		= Number(dtDiff);

	
	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 adlts = 0;
	var seniors = 0;
	var children = 0;
	var infant =0;
	
	var Roomlen=Number(eval("document.forms['form1'].H_cmbNoOfRooms.value"));
	
	
	
	for (var oc=0; oc<Roomlen; oc++){	
		adlts = Number(adlts) +  Number(eval("document.forms['form1'].R"+(oc+1)+"occAdults.value"));
		children = Number(children) + Number(eval("document.forms['form1'].R"+(oc+1)+"occChi.value"));
		infant = Number(infant) + Number(eval("document.forms['form1'].R"+(oc+1)+"occInfants.value"));
		
	}
	
	document.forms["ResPkgSearchForm"].cmbNoOfAdults_Activities.value 	= Number(adlts) +  Number(eval("document.forms['form1'].R"+(oc+1)+"occAdults.value"));
	
	document.forms["ResPkgSearchForm"].cmbNoOfChildren_Activities.value = Number(children) + Number(eval("document.forms['form1'].R"+(oc+1)+"occChi.value"));
	
	var roomChildren= Number(document.forms["ResPkgSearchForm"].cmbNoOfChildren_Activities.value);
	document.forms["ResPkgSearchForm"].gstChildAges_Activities.value = "";	
	document.forms["ResPkgSearchForm"].cmbAdults_Air.value		= adlts; 	
	document.forms["ResPkgSearchForm"].cmbSeniors_Air.value		= seniors; 
	document.forms["ResPkgSearchForm"].cmbChildren_Air.value	= children; 
	document.forms["ResPkgSearchForm"].cmbInfant_Air.value		= infant; 

	document.forms["ResPkgSearchForm"].cmbNoRm_Hotels.value =    Number(document.forms['form1'].H_cmbNoOfRooms.options[document.forms['form1'].H_cmbNoOfRooms.selectedIndex].value);
	
	if(document.forms["form1"].elements["Air_FlightClass"][0].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "Economy";
	}else if(document.forms["form1"].elements["Air_FlightClass"][1].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "Premium";
	}else if(document.forms["form1"].elements["Air_FlightClass"][2].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "Business";
	}else if(document.forms["form1"].elements["Air_FlightClass"][3].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "First";
	}
	

		document.forms["ResPkgSearchForm"].nonStopStatus_Air.value = "";	
	var arrcityid = retSearchStr[2]; 
	document.forms["ResPkgSearchForm"].cmbCty.value  = arrcityid; 
	document.forms["ResPkgSearchForm"].cmbDepCityCode.value = depSearchStr[2];
	document.forms["ResPkgSearchForm"].cmbArrCityCode.value = arrcityid;
	document.forms["ResPkgSearchForm"].cmbArrCtry.value = retSearchStr[5];
    
	document.forms["ResPkgSearchForm"].cmbCty_Hotels.value = arrcityid;
	document.forms["ResPkgSearchForm"].cmbCtry_Hotels.value = retSearchStr[5];	
	document.forms["ResPkgSearchForm"].cityLookup_Hotels.value = retSearchStr[3];
	
	if(retSearchStr[4]=="-" || retSearchStr[4]==""){
			document.forms["ResPkgSearchForm"].cmbSte_Hotels.value = "0";
		}else{
			document.forms["ResPkgSearchForm"].cmbSte_Hotels.value = retSearchStr[4];
	}
	var selroomcount = document.forms["form1"].elements["H_cmbNoOfRooms"].value;
	document.forms["ResPkgSearchForm"].totRooms_Hotels.value	= selroomcount;
	document.forms["ResPkgSearchForm"].cmbNoRm_Hotels.value  = selroomcount;
	document.forms["ResPkgSearchForm"].accommodationType.value="HT"; 
	document.forms["ResPkgSearchForm"].cmbtourOpt_Hotels.value="0";
	document.forms["ResPkgSearchForm"].shtcd_Hotels.value="0";
	
	document.forms["ResPkgSearchForm"].cmbCty_Activities.value = arrcityid;
	document.forms["ResPkgSearchForm"].cmbCtry_Activities.value = retSearchStr[5];
		
	document.forms["ResPkgSearchForm"].tripTypeNew_Air.value = "R";
	document.forms["ResPkgSearchForm"].tripTypeNew.value = "R";	
	document.forms["ResPkgSearchForm"].tripType_Air.value = "R";
	
	var totadltchil=Number(adlts) + Number(children);	
	document.forms["ResPkgSearchForm"].pickupLocName_Car.value 	= retSearchStr[0]; 
	document.forms["ResPkgSearchForm"].pickupLoc_Car.value	  		= retSearchStr[1];
		
	document.forms["ResPkgSearchForm"].retupLocName_Car.value  	= retSearchStr[0]; 
	document.forms["ResPkgSearchForm"].retupLoc_Car.value	  		= retSearchStr[1]; 			
		
	document.forms["ResPkgSearchForm"].pickupDate_Car.value	= document.forms["ResPkgSearchForm"].depDate_Air.value;
	document.forms["ResPkgSearchForm"].pickupTime_Car.value	= document.forms["ResPkgSearchForm"].cmbDepTime_Air.value;
	document.forms["ResPkgSearchForm"].returnDate_Car.value	= document.forms["ResPkgSearchForm"].arrDate_Air.value;
	document.forms["ResPkgSearchForm"].retTime_Car.value		= document.forms["ResPkgSearchForm"].cmbArrTime_Air.value;	
	document.forms["ResPkgSearchForm"].carType_Car.value		= "ALL";
	
	var currentDate = new Date(new Date().getFullYear(),new Date().getMonth(),(new Date().getDate()+v_cutoff));
	var elevenmonths = new Date(new Date().getFullYear(),(new Date().getMonth()+11),(new Date().getDate()));
	var vac_back_date = Number(get_deference(inDateObj,currentDate));
	if(document.forms["form1"].elements["V_DepFromHid"].value=="") {
		show_error_msg(v_error_from);
		} else if(document.forms["form1"].elements["V_RetLocHid"].value=="") {
		show_error_msg(v_error_to);
		} else if(document.forms["form1"].elements["V_DepFromHid"].value==document.forms["form1"].elements["V_RetLocHid"].value) {
		show_error_msg(v_error_same_loc);
		} else if (inDateObj>outDateObj){
		show_error_msg(v_error_dep);
		}else if(inDateObj<(currentDate)){
			show_error_msg(v_error_cutoff_1+v_cutoff+v_error_cutoff_2)
		}else if(inDateObj<(currentDate)){
			show_error_msg(v_error_cutoff_1+v_cutoff+v_error_cutoff_2)
		}else if(inDateObj>=elevenmonths || outDateObj>=elevenmonths) {
			show_error_msg(v_error_11);
		}else if (Number(adlts)<Number(infant)){
			show_error_msg(v_error_adult_inf);
		}else if (totadltchil>v_max_pax){
			show_error_msg(v_error_max_pax);
		}else{
		befSubmit('V');
		document.forms["ResPkgSearchForm"].submit();
		}
}

function get_deference(ind,oud){
var milSec=parseInt(oud-ind);
var ret_val=milSec/86400000;
return ret_val;
}


function loadDataNew_F(){
	
	setFields("F");
	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchAir";
	if (chkDates()){showError();return;}
	var depSearchStr_a = document.forms["form1"].hid_air_Loc_a.value.split(",");
	var retSearchStr_a = document.forms["form1"].hid_air_Loc1_a.value.split(",");
	

	document.forms["ResPkgSearchForm"].cmbNgt.value= 2;		
	if(document.forms["form1"].elements["Air_TripType"][0].checked){
		document.forms["ResPkgSearchForm"].tripType_Air.value = "R";
	}else if(document.forms["form1"].elements["Air_TripType"][1].checked){
		document.forms["ResPkgSearchForm"].tripType_Air.value = "O";
		document.ResPkgSearchForm.isFlex.value='N';
	}
	
	
	var air_InDate		= document.forms["form1"].elements["air_a_InDate"].options[document.forms["form1"].elements["air_a_InDate"].selectedIndex].value;
	
	var air_InMonth 	= Number(document.forms["form1"].elements["air_a_InMonth"].options[document.forms["form1"].elements["air_a_InMonth"].selectedIndex].value)+1;
	if(air_InMonth<10){
		air_InMonth ="0"+air_InMonth;
	}
	var	air_OutDate		= document.forms["form1"].elements["air_a_OutDate"].options[document.forms["form1"].elements["air_a_OutDate"].selectedIndex].value;
	var air_OutMonth 	= Number(document.forms["form1"].elements["air_a_OutMonth"].options[document.forms["form1"].elements["air_a_OutMonth"].selectedIndex].value)+1;
	if(air_OutMonth<10){
		air_OutMonth ="0"+air_OutMonth;
	}
	if(document.ResPkgSearchForm.isFlex.value=="Y"){
		document.ResPkgSearchForm.dep_flex.value = document.getElementById('dep_flexx').value;
		document.ResPkgSearchForm.ret_flex.value = document.getElementById('ret_flexx').value;
		document.ResPkgSearchForm.depFlex.value = document.getElementById('dep_flexx').value;
		document.ResPkgSearchForm.retFlex.value = document.getElementById('ret_flexx').value;
	}
	var inDateObj=new Date(Number(document.forms["form1"].elements["air_a_InYear"].options[document.forms["form1"].elements["air_a_InYear"].selectedIndex].value),Number(air_InMonth)-1,Number(air_InDate),0,0,0,0);
	var outDateObj=new Date(Number(document.forms["form1"].elements["air_a_OutYear"].options[document.forms["form1"].elements["air_a_OutYear"].selectedIndex].value),Number(air_OutMonth)-1,Number(air_OutDate),0,0,0,0);
	var dtDiff=Number(get_deference(inDateObj,outDateObj));
	document.forms["ResPkgSearchForm"].vacationpkg.value	   	= 'N'

	document.forms["ResPkgSearchForm"].depDate_Air.value	   	= Number(document.forms["form1"].elements["air_a_InYear"].options[document.forms["form1"].elements["air_a_InYear"].selectedIndex].value)+"-"+air_InMonth+"-"+air_InDate;	
	
	document.forms["ResPkgSearchForm"].cmbDepTime_Air.value 	= document.forms["form1"].Air_DepTime_a.value;	
	
		document.forms["ResPkgSearchForm"].depLoc_Air.value	   		= depSearchStr_a[1];
		document.forms["ResPkgSearchForm"].depLocName_Air.value 	= depSearchStr_a[0];	
		
		document.forms["ResPkgSearchForm"].arrLoc_Air.value	   		= retSearchStr_a[1];
		document.forms["ResPkgSearchForm"].arrLocName_Air.value 	= retSearchStr_a[0];
	
	document.forms["ResPkgSearchForm"].arrDate_Air.value	   	= Number(document.forms["form1"].elements["air_a_OutYear"].options[document.forms["form1"].elements["air_a_OutYear"].selectedIndex].value)+"-"+air_OutMonth+"-"+air_OutDate;
	document.forms["ResPkgSearchForm"].cmbArrTime_Air.value 	= document.forms["form1"].Air_RetTime_a.value;
	document.forms["ResPkgSearchForm"].cmbAdults_Air.value		= document.forms["form1"].Air_cmbNoOfAdults.value;
	document.forms["ResPkgSearchForm"].cmbSeniors_Air.value		= document.forms["form1"].Air_cmbNoOfSeniors.value;
	document.forms["ResPkgSearchForm"].cmbChildren_Air.value	= document.forms["form1"].Air_cmbNoOfChildren.value;
	document.forms["ResPkgSearchForm"].cmbInfant_Air.value		= document.forms["form1"].Air_cmbNoOfInfants.value;
	


	
	if(document.forms["form1"].elements["Aira_FlightClass"][0].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "Economy";
	}else if(document.forms["form1"].elements["Aira_FlightClass"][1].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "Premium";

	}else if(document.forms["form1"].elements["Aira_FlightClass"][2].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "Business";
	}else if(document.forms["form1"].elements["Aira_FlightClass"][3].checked){
		document.forms["ResPkgSearchForm"].seatClass_Air.value = "First";
	}
	
if(document.forms["form1"].elements["nonStopStatusNew"].checked){
		document.forms["ResPkgSearchForm"].nonStopStatus_Air.value="Nonstop";
	}

		//document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms["form1"].F_Country.value;
	document.forms["ResPkgSearchForm"].nonStopStatus_Air.value = "";	
	document.forms["ResPkgSearchForm"].pkgType.value			= "F";
	var currentDate = new Date(new Date().getFullYear(),new Date().getMonth(),(new Date().getDate()+f_cutoff));
	var elevenmonths = new Date((new Date().getFullYear()),(new Date().getMonth()+11),(new Date().getDate()));
	
	document.forms["ResPkgSearchForm"].cmbAirLineNew.value = document.forms["form1"].Air_AirLine.value;
	document.forms["ResPkgSearchForm"].cmbAirLine.value = document.forms["form1"].Air_AirLine.value;
	document.forms["ResPkgSearchForm"].airLine_Codes.value = document.forms["form1"].Air_AirLine.value;
	document.forms["ResPkgSearchForm"].airLine_CodesNew.value = document.forms["form1"].Air_AirLine.value;
	
	var airAdult = document.forms["ResPkgSearchForm"].cmbAdults_Air.value;
	var airInf = document.forms["ResPkgSearchForm"].cmbInfant_Air.value
	var totadltchil=Number(document.forms["ResPkgSearchForm"].cmbAdults_Air.value) + Number(document.forms["ResPkgSearchForm"].cmbChildren_Air.value);	
	
		/*if (document.forms["ResPkgSearchForm"].consumerRegionId.value=="-Select a Country-"){
		alert("Please Enter the Country!");	
		}else if(document.getElementById("F_Country").value=="null"){
		alert("Country of Residence Must be Selected!");
		} else*/ 
		if(document.forms["form1"].elements["air_Loc_a"].value=="" || document.forms["form1"].elements["hid_air_Loc_a"].value=="") {
		show_error_msg(f_error_from);
		} else if(document.forms["form1"].elements["air_Loc1_a"].value=="" || document.forms["form1"].elements["hid_air_Loc1_a"].value=="") {
		show_error_msg(f_error_to);
		} else if(document.forms["form1"].elements["hid_air_Loc_a"].value==document.forms["form1"].elements["hid_air_Loc1_a"].value) {
		show_error_msg(f_error_same_loc);
		}else if(inDateObj>outDateObj){
			show_error_msg(f_error_dep);
		}else if(inDateObj<(currentDate)){
			show_error_msg(f_error_cutoff_1+f_cutoff+f_error_cutoff_2);
		}else if(inDateObj>=elevenmonths || outDateObj>=elevenmonths) {
			show_error_msg(f_error_11);
		}else if (Number(airAdult)<Number(airInf)){
			show_error_msg(f_error_adult_inf);		
		}else if (totadltchil>f_max_pax){
			show_error_msg(f_error_max_pax);
		}else {
		befSubmit('F');
		document.forms["ResPkgSearchForm"].submit();
		}
}


function loadDataNew_H(){
	setFields("H");
	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchHotels";
	if (chkDates()){showError();return;}

	var searchStr = document.forms["form1"].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["form1"].elements["H_InYear"].options[document.forms["form1"].elements["H_InYear"].selectedIndex].value);
	document.forms["ResPkgSearchForm"].cmbInMn_Hotels.value	= Number(document.forms["form1"].elements["H_InMonth"].options[document.forms["form1"].elements["H_InMonth"].selectedIndex].value)+1;
	document.forms["ResPkgSearchForm"].cmbInDt_Hotels.value	= document.forms["form1"].elements["H_InDate"].options[document.forms["form1"].elements["H_InDate"].selectedIndex].value;	
	document.forms["ResPkgSearchForm"].cmbNgt_Hotels.value	= Number(document.forms["form1"].elements["H_nights"].options[document.forms["form1"].elements["H_nights"].selectedIndex].value);
	
	document.forms["ResPkgSearchForm"].cmbOutYr_Hotels.value	= Number(document.forms["form1"].elements["H_OutYear"].options[document.forms["form1"].elements["H_OutYear"].selectedIndex].value);
	document.forms["ResPkgSearchForm"].cmbOutMn_Hotels.value	= Number(document.forms["form1"].elements["H_OutMonth"].options[document.forms["form1"].elements["H_OutMonth"].selectedIndex].value)+1;
	document.forms["ResPkgSearchForm"].cmbOutDt_Hotels.value	= document.forms["form1"].elements["H_OutDate"].options[document.forms["form1"].elements["H_OutDate"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].cmbNoRm_Hotels.value	= Number(document.forms["form1"].elements["H_cmbNoOfRooms"].options[document.forms["form1"].elements["H_cmbNoOfRooms"].selectedIndex].value);	
	document.forms["ResPkgSearchForm"].totRooms_Hotels.value	= Number(document.forms["form1"].elements["H_cmbNoOfRooms"].options[document.forms["form1"].elements["H_cmbNoOfRooms"].selectedIndex].value);
	
	document.forms["ResPkgSearchForm"].cmbInMn.value=Number(document.forms["form1"].elements["H_InMonth"].options[document.forms["form1"].elements["H_InMonth"].selectedIndex].value)+1;	
	document.forms["ResPkgSearchForm"].cmbInYr.value=document.forms["form1"].elements["H_InYear"].options[document.forms["form1"].elements["H_InYear"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbOutMn.value=Number(document.forms["form1"].elements["H_OutMonth"].options[document.forms["form1"].elements["H_OutMonth"].selectedIndex].value)+1;	
	document.forms["ResPkgSearchForm"].cmbOutYr.value=document.forms["form1"].elements["H_OutYear"].options[document.forms["form1"].elements["H_OutYear"].selectedIndex].value;	
	document.forms["ResPkgSearchForm"].cmbInDt.value=document.forms["form1"].elements["H_InDate"].options[document.forms["form1"].elements["H_InDate"].selectedIndex].value;			
	document.forms["ResPkgSearchForm"].cmbOutDt.value=document.forms["form1"].elements["H_OutDate"].options[document.forms["form1"].elements["H_OutDate"].selectedIndex].value;
	//document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms["form1"].H_Country.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));
	document.forms["ResPkgSearchForm"].elements["hotelStarId_Hotels"].value    =document.forms["form1"].elements["hstarCat"].options[document.forms["form1"].elements["hstarCat"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].elements["hotelType_Hotels"].value    =document.forms["form1"].elements["hType"].options[document.forms["form1"].elements["hType"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].hotelName_Hotels.value = document.forms["form1"].hotelName.value;
	
	var newHotelInDate=new Date(Number(document.forms["ResPkgSearchForm"].cmbInYr_Hotels.value),Number(document.forms["ResPkgSearchForm"].cmbInMn_Hotels.value)-1,Number(document.forms["ResPkgSearchForm"].cmbInDt_Hotels.value),0,0,0,0);
	
	var newHotelOutDate=new Date(Number(document.forms["ResPkgSearchForm"].cmbOutYr_Hotels.value),Number(document.forms["ResPkgSearchForm"].cmbOutMn_Hotels.value)-1,Number(document.forms["ResPkgSearchForm"].cmbOutDt_Hotels.value),0,0,0,0);
	
	var hotelDtDiff=Number(get_deference(newHotelInDate,newHotelOutDate));	
	var today = new Date(new Date().getFullYear(),new Date().getMonth(),(new Date().getDate()));
	var checkHotPastDt = Number(get_deference(today,newHotelInDate));	
	
	if(hotelDtDiff > 0 && hotelDtDiff < 31){
		document.forms["form1"].elements["H_nights"].options.value = hotelDtDiff;
	}
	//if (document.forms["ResPkgSearchForm"].consumerRegionId.value=="- Select -"){
		//alert("Please Enter the Country!");
		//}else if(document.getElementById("H_Country").value=="null"){
		//alert("Country of Residence Must be Selected!");
	//}else
	if (searchStr=="" || document.forms["form1"].elements["hid_H_Loc"].value==""){
		show_error_msg(h_error_loc);
	}else if(Number(checkHotPastDt) < h_cutoff){
	show_error_msg(h_error_cutoff_1+h_cutoff+h_error_cutoff_2);
}else if(Number(hotelDtDiff) > h_max_nights){
		show_error_msg(h_error_max);			
//}else if ((OutMonth<cMonth) || (InMonth<cMonth) || (document.forms["form1"].elements["air_InYear"].value<curr_year)){
}else if(Number(hotelDtDiff) < h_min_nights && Number(hotelDtDiff) > 0){
	show_error_msg(h_error_min);
	}else if(Number(hotelDtDiff) < 0){
	show_error_msg(h_error_dep);
	} else {	
		befSubmit('H');
		document.forms["ResPkgSearchForm"].submit();
	}
}

//activity
function loadDataNew_A(){
	
	setFields("A");
	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchActivities";
	if (chkDates()){showError();return;}
	
	var searchStr = document.forms["form1"].hid_A_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["form1"].elements["activity_InYear"].options[document.forms["form1"].elements["activity_InYear"].selectedIndex].value);
	document.forms["ResPkgSearchForm"].cmbInMn_Activities.value	= Number(document.forms["form1"].elements["activity_InMonth"].options[document.forms["form1"].elements["activity_InMonth"].selectedIndex].value)+1;
	document.forms["ResPkgSearchForm"].cmbInDt_Activities.value	= document.forms["form1"].elements["activity_InDate"].options[document.forms["form1"].elements["activity_InDate"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].cmbOutYr_Activities.value	= Number(document.forms["form1"].elements["activity_OutYear"].options[document.forms["form1"].elements["activity_OutYear"].selectedIndex].value);
	document.forms["ResPkgSearchForm"].cmbOutMn_Activities.value	= Number(document.forms["form1"].elements["activity_OutMonth"].options[document.forms["form1"].elements["activity_OutMonth"].selectedIndex].value)+1;
	document.forms["ResPkgSearchForm"].cmbOutDt_Activities.value	= document.forms["form1"].elements["activity_OutDate"].options[document.forms["form1"].elements["activity_OutDate"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].cmbInMn.value=Number(document.forms["form1"].elements["activity_InMonth"].options[document.forms["form1"].elements["activity_InMonth"].selectedIndex].value)+1;
	document.forms["ResPkgSearchForm"].cmbInYr.value=document.forms["form1"].elements["activity_InYear"].options[document.forms["form1"].elements["activity_InYear"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbOutMn.value=Number(document.forms["form1"].elements["activity_OutMonth"].options[document.forms["form1"].elements["activity_OutMonth"].selectedIndex].value)+1;
	document.forms["ResPkgSearchForm"].cmbOutYr.value=document.forms["form1"].elements["activity_OutYear"].options[document.forms["form1"].elements["activity_OutYear"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].cmbInDt.value=document.forms["form1"].elements["activity_InDate"].options[document.forms["form1"].elements["activity_InDate"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].cmbOutDt.value=document.forms["form1"].elements["activity_OutDate"].options[document.forms["form1"].elements["activity_OutDate"].selectedIndex].value;
	
	document.forms["ResPkgSearchForm"].cmbNoOfAdults_Activities.value 	= document.forms["form1"].elements["R1occAdults_A"].value;
	document.forms["ResPkgSearchForm"].cmbNoOfChildren_Activities.value = document.forms["form1"].elements["R1occChi_A"].value;
	
	document.forms[0].cmbProgTyp_Activities.value	= "0";
	document.forms[0].actType_Activities.value	= "0";
	
	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["form1"].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["form1"].elements["activity_nights"].options[document.forms["form1"].elements["activity_nights"].selectedIndex].value);
	document.forms["ResPkgSearchForm"].actType_Activities.value	= document.forms["form1"].elements["Act_type"].options[document.forms["form1"].elements["Act_type"].selectedIndex].value;
	document.forms["ResPkgSearchForm"].pkgType.value	= "A";
	document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms["form1"].A_Country.value;
	//document.forms["ResPkgSearchForm"].consumerRegionId.value 		= "0~ZA";
	var currentDate 	= new Date(new Date().getFullYear(),new Date().getMonth(),(new Date().getDate()+a_cutoff));
	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(document.getElementById("A_Country").value=="null"){
		show_error_msg(a_error_res);
	}else if (searchStr==""){
		show_error_msg(a_error_loc);	
	}else if (checkinDate>=checkoutDate){
		show_error_msg(a_error_dep);
	}else if (checkinDate<currentDate){
		show_error_msg(a_error_cutoff_1+a_cutoff+a_error_cutoff_2);
	}else {
		befSubmit('A');
		document.forms["ResPkgSearchForm"].submit();
	}
	
}


//car
function loadDataNew_C(){

	setFields("C");
	document.forms["ResPkgSearchForm"].action=subURL+"/packaging/reservation/ResPkgSearchCriteria.do?ActionType=ResSearchCar";
	if (chkDates()){showError();return;}
	
	var depSearchStr = document.forms["form1"].hid_car_Loc.value.split(",");
	
	document.forms["ResPkgSearchForm"].pickupLocName_Car.value 	= depSearchStr[1];
	document.forms["ResPkgSearchForm"].pickupLoc_Car.value		= depSearchStr[0];
	document.forms["ResPkgSearchForm"].pickupAirport_Car.value	= depSearchStr[3];

	var InDate		= document.forms["form1"].elements["car_InDate"].options[document.forms["form1"].elements["car_InDate"].selectedIndex].value;
	var InMonth 	= Number(document.forms["form1"].elements["car_InMonth"].options[document.forms["form1"].elements["car_InMonth"].selectedIndex].value)+1;
	if(InMonth<10){
		InMonth ="0"+InMonth;
	}
	var	OutDate		= document.forms["form1"].elements["car_OutDate"].options[document.forms["form1"].elements["car_OutDate"].selectedIndex].value;
	var OutMonth 	= Number(document.forms["form1"].elements["car_OutMonth"].options[document.forms["form1"].elements["car_OutMonth"].selectedIndex].value)+1;
	if(OutMonth<10){
		OutMonth ="0"+OutMonth;
	}	
	var cMonth=Number(_InDate.getMonth()+1);
	var d = new Date();
	var curr_year = d.getFullYear();
	
	document.forms["ResPkgSearchForm"].pickupDate_Car.value		= Number(document.forms["form1"].elements["car_InYear"].options[document.forms["form1"].elements["car_InYear"].selectedIndex].value)+"-"+InMonth+"-"+InDate;
	document.forms["ResPkgSearchForm"].pickupTime_Car.value		= document.forms["form1"].PickTime.value;
	document.forms["ResPkgSearchForm"].returnDate_Car.value		= Number(document.forms["form1"].elements["car_OutYear"].options[document.forms["form1"].elements["car_OutYear"].selectedIndex].value)+"-"+OutMonth+"-"+OutDate;
	document.forms["ResPkgSearchForm"].retTime_Car.value		= document.forms["form1"].ReturnTime.value;
	document.forms["ResPkgSearchForm"].pkgType.value			= "C";
	document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms["form1"].C_Country.value;	
	document.forms["ResPkgSearchForm"].carType_Car.value		= document.forms["form1"]._CarType.value;
	
	if(document.forms["form1"].elements["_ReturnCar"].checked){
		document.forms["ResPkgSearchForm"].retupLoc_Car.value=document.forms["ResPkgSearchForm"].pickupLoc_Car.value;
		document.forms["ResPkgSearchForm"].retupLocName_Car.value=document.forms["ResPkgSearchForm"].pickupLocName_Car.value;
	}else{
		var retSearchStr = document.forms["form1"].hid_car_Loc1.value.split(",");
		document.forms["ResPkgSearchForm"].retupLocName_Car.value 	= retSearchStr[1];
		document.forms["ResPkgSearchForm"].retupLoc_Car.value		= retSearchStr[0];
		document.forms["ResPkgSearchForm"].retupAirport_Car.value	   	= retSearchStr[3];
	}
	
	
	if(document.forms["form1"].elements["_ReturnCar"].checked){
		var arrcityid = depSearchStr[2]; 
		document.forms["ResPkgSearchForm"].cmbCty_Hotels.value  = arrcityid; 
		document.forms["ResPkgSearchForm"].cmbDepCityCode.value = depSearchStr[2];
		document.forms["ResPkgSearchForm"].cmbArrCityCode.value = arrcityid;
		document.forms["ResPkgSearchForm"].cmbArrCtry.value = depSearchStr[5];
	}else{
		var arrcityid = retSearchStr[2]; 
		document.forms["ResPkgSearchForm"].cmbCty_Hotels.value  = arrcityid; 
		document.forms["ResPkgSearchForm"].cmbDepCityCode.value = depSearchStr[2];
		document.forms["ResPkgSearchForm"].cmbArrCityCode.value = arrcityid;
		document.forms["ResPkgSearchForm"].cmbArrCtry.value = retSearchStr[5];
	}
	
	var currentDate 	= new Date(new Date().getFullYear(),new Date().getMonth(),(new Date().getDate()+c_cutoff));
	var checkinDate 	= new Date(Number(document.forms["ResPkgSearchForm"].pickupDate_Car.value.split("-")[0]),Number(document.forms["ResPkgSearchForm"].pickupDate_Car.value.split("-")[1])-1,Number(document.forms["ResPkgSearchForm"].pickupDate_Car.value.split("-")[2]));
	var checkoutDate 	= new Date(Number(document.forms["ResPkgSearchForm"].returnDate_Car.value.split("-")[0]),Number(document.forms["ResPkgSearchForm"].returnDate_Car.value.split("-")[1])-1,Number(document.forms["ResPkgSearchForm"].returnDate_Car.value.split("-")[2]));
	
	var newCarInDate=new Date(Number(document.forms["form1"].elements["car_InYear"].options[document.forms["form1"].elements["car_InYear"].selectedIndex].value),Number(InMonth)-1,Number(InDate),0,0,0,0);
	
	var newCarOutDate=new Date(Number(document.forms["form1"].elements["car_OutYear"].options[document.forms["form1"].elements["car_OutYear"].selectedIndex].value),Number(OutMonth)-1,Number(OutDate),0,0,0,0);
	
	var carDtDiff=Number(get_deference(newCarInDate,newCarOutDate));	
	/*var today = new Date();*/
	var today = new Date(new Date().getFullYear(),new Date().getMonth(),(new Date().getDate()));
	var checkCarPastDt = Number(get_deference(today,newCarInDate));	
	if(document.getElementById("C_Country").value=="null"){
		show_error_msg(c_error_res);
	}else if(depSearchStr==""){
		show_error_msg(c_error_from);
	}else if(retSearchStr==""){
		show_error_msg(c_error_to);	
	}else if(Number(checkCarPastDt) < c_cutoff){
	show_error_msg(c_error_cutoff_1+c_cutoff+c_error_cutoff_2);
}else if (Number(carDtDiff)<0){
		show_error_msg(c_error_dep);
}else { 
	befSubmit('C');
	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]+"</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]+"</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,180,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["form1"].elements["hid_air_Loc1_a"].value=airTxtArr[index].join("|");
	document.forms["form1"].elements["hid_car_Loc1"].value=airTxtArr[index].join("|");
	document.forms["form1"].elements["V_RetLocHid"].value=airTxtArr[index].join("|");
	
	document.forms["form1"].elements[obj].value=airTxtArr[index][0];
			
	setObjPos('ixpDataFrame',0,0,180,0,'none');
	setObjPos('maskFrame',0,0,180,0,'none');
	showAllLoc=false;
}

function altcell(st,obj,cls){
	if (st=="ov"){
	obj.className="overclass";
	}else{
	obj.className=cls;
	}
}

