var H_nightcombo="<select style='40px;' name='H_nights' onClick=\"hideError()\" onchange=\"setDtOptIn('H','_In',this.form.H_InDate);\">"+opts(1,31,1)+"</select>";
var A_nightcombo="<select name='activity_nights' onClick=\"hideError()\" onchange=\"setDtOptIn('activity','_In',this.form.activity_InDate);\">"+opts(1,31,1)+"</select>";
function setEngType(val){
var roomComboData="<div>"+


"<div class='entxt' style='float:left;width:85px;'>Room(s)<br/><select name='H_cmbNoOfRooms' style='width:40px;' onChange='showRooms(Number(this.options[this.selectedIndex].value));'>"+opts(1,6,1)+

"</select></div><div style='width:200px;float:left'>"+buildOcc()+"</div></div><span id='adultsCombo' style='display:none;'></span></td></tr><tr>"+

"<td colspan='2'><img src='images/ixps.gif' width='1' height='1'/><span id='occBox' style='display:block;'>"+

"<table width='240' border='0' align='left' cellpadding='0' cellspacing='0'>"+

"</table>";

var roomComboData3=buildActivityOcc();
	document.forms["form1"].pkgType.value = val;
	document.forms["ResPkgSearchForm"].pkgType.value = val;
	document.forms["ResPkgSearchForm"].elements["engineType"].value=val;
	if (val=="tabTabdhtmlgoodies_tabView1_0"){
		document.getElementById("roomComboH").innerHTML=roomComboData;	
		document.getElementById("nightComboH").innerHTML=H_nightcombo;	
		showRooms(1);
		document.forms["form1"].elements["H_nights"].value="2";		
		document.forms["form1"].elements["hid_H_Loc"].value="";
		document.forms["form1"].elements["hid_A_Loc"].value="";
	}else if (val=="tabTabdhtmlgoodies_tabView1_1"){

		

		document.forms["form1"].activity_Loc.value="";

		document.getElementById("nightComboA").innerHTML=A_nightcombo;			

		document.forms["form1"].elements["activity_nights"].value="2";

		document.forms["form1"].elements["Act_type"].value="0";

		document.forms["form1"].elements["hid_H_Loc"].value="";

		document.forms["form1"].elements["hid_A_Loc"].value="";

		

		document.getElementById("roomComboA").innerHTML=roomComboData3;

}

}

function search(){

	document.forms["ResPkgSearchForm"].elements["pkgType"].value=document.forms["form1"].pkgType.value;

	//alert("XXX" + document.forms["form1"].pkgType.value); 

	eval("loadDataNew_"+document.forms["form1"].pkgType.value+"()");

}

	var schemaName="alsarh";

 var subURL="http://www19.secure-reservation.com/"+schemaName+"";

	 

var airTxtArr = new Array();

var _month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
function get_deference(ind,oud){
var milSec=parseInt(oud-ind);
var ret_val=milSec/86400000;
return ret_val;
}





function loadDataNew_tabTabdhtmlgoodies_tabView1_0(){

	setFields("tabTabdhtmlgoodies_tabView1_0");

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

	



	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"].searchCountryName.value	= searchStr[5];

	

	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"].countryLookup_Hotels.value	= document.forms["ResPkgSearchForm"].searchCountryName.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;



			document.forms["ResPkgSearchForm"].destinationcountry.value=document.forms["form1"].elements["destinationcountry"].options[document.forms["form1"].elements["destinationcountry"].selectedIndex].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 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	= "";

			document.forms["ResPkgSearchForm"].consumerCurrencyCode.value=document.forms["form1"].elements["H_consumerCurrencyCode"].options[document.forms["form1"].elements["H_consumerCurrencyCode"].selectedIndex].value;

			

	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));

		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();

	var checkHotPastDt = Number(get_deference(today,newHotelInDate));	

	







	var errorMsg = "";





	if (searchStr==""){	



	searchError=true;

	errorMsg += "Please select the Location from the drop down!<br/>";

	

	}

	

	if(Number(checkHotPastDt) < -1){		

	searchError=true;

	errorMsg+= "Can not search for past dates!<br/>";

	} 

	

	if(Number(hotelDtDiff) > 30){		

	searchError=true;

	errorMsg += "Can not search for periods longer than 30 days!<br/>";

	}

	

	if(Number(hotelDtDiff) < 0){	

	

	searchError=true;

	errorMsg += "To date should be after the From date!<br/>";

	}





	

	if(searchError==false){

	

		befSubmit('tabTabdhtmlgoodies_tabView1_0');
setTimeout('document.forms["ResPkgSearchForm"].submit()',1000)
	}else{
		showError(errorMsg)
	}
}



//activity

function loadDataNew_tabTabdhtmlgoodies_tabView1_1(){

	

	setFields("tabTabdhtmlgoodies_tabView1_1");

	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"].searchCountryName.value	= searchStr[5];

	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"].destinationcountry.value	= document.forms["ResPkgSearchForm"].searchCountryName.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;

	

	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"].destinationcountry.value=document.forms["form1"].elements["destinationcountry_A"].options[document.forms["form1"].elements["destinationcountry_A"].selectedIndex].value;

	

	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["ResPkgSearchForm"].pkgType.value	= "A";

	document.forms["ResPkgSearchForm"].consumerRegionId.value 		= document.forms["form1"].A_Country.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));

		document.forms["ResPkgSearchForm"].consumerCurrencyCode.value=document.forms["form1"].elements["A_consumerCurrencyCode"].options[document.forms["form1"].elements["A_consumerCurrencyCode"].selectedIndex].value;

	

	var hotelDtDiff=Number(get_deference(checkinDate,checkoutDate));	

	

	var today = new Date();

	var checkHotPastDt = Number(get_deference(today,checkinDate));	

var errorMsg = "";



	var errorMsg = "";





	if (searchStr==""){	



	searchError=true;

	errorMsg += "Please select the Location from the drop down!<br/>";

	

	}

	

	if(Number(checkHotPastDt) < -1){		

	searchError=true;

	errorMsg+= "Can not search for past dates!<br/>";

	} 

	

	if(Number(hotelDtDiff) > 30){		

	searchError=true;

	errorMsg += "Can not search for periods longer than 30 days!<br/>";

	}

	

	if(Number(hotelDtDiff) < 0){	

	

	searchError=true;

	errorMsg += "To date should be after the From date!<br/>";

	}





	

	if(searchError==false){

	

		befSubmit('tabTabdhtmlgoodies_tabView1_1');

setTimeout('document.forms["ResPkgSearchForm"].submit()',1000)

	}else{

		showError(errorMsg)

	}



	

}







function altcell(st,obj,cls){

	if (st=="ov"){

	obj.className="overclass";

	}else{

	obj.className=cls;

	}

}




