var hotelImgArr=new Array();
var moreImgArr=new Array();
function loadHotImages(){ 
var tmpImgDetails="";
var tmpMoreImgDetails="";
var callToBookMsg = "Call to Book"; // actual value setting at ResSearchMid.jsp
var noRoomsMsg = "No rooms available for selected combinations"; // actual value setting at ResSearchMid.jsp
var onRequestMsg = "Selected combinations are on request"; // actual value setting at ResSearchMid.jsp

for (gg1=0; gg1<hotelImgArr.length; gg1++){
tmpImgDetails=hotelImgArr[gg1].split("|");
document.getElementById(tmpImgDetails[0]).innerHTML="<a href=\""+tmpImgDetails[1]+"\"><img name=\""+tmpImgDetails[0]+"\" src=\""+tmpImgDetails[2]+"\" width=\"70\" height=\"70\" border=\"0\" alt=\""+tmpImgDetails[3]+"\"></a>";
tmpImgDetails="";
}

for (gg2=0; gg2<moreImgArr.length; gg2++){
tmpMoreImgDetails=moreImgArr[gg2].split("|");
document.getElementById(tmpMoreImgDetails[0]).innerHTML="<a href=\""+tmpMoreImgDetails[1]+"\"><img src=\""+tmpMoreImgDetails[2]+"\" width=\""+tmpMoreImgDetails[3]+"\" height=\""+tmpMoreImgDetails[4]+"\" border=\"0\" alt=\""+tmpMoreImgDetails[5]+"\"></a>";
tmpMoreImgDetails="";
}
//hotelImgArr
}

var w3c=(document.getElementById)?true:false;
var ie=(document.all)?true:false;
var N=-1;


function createBar(w,h,bgc,brdW,brdC,blkC,speed,blocks,count,action){
if(ie||w3c){
var t='<div id="_xpbar'+(++N)+'" style="visibility:visible; position:relative; overflow:hidden; width:'+w+'px; height:'+h+'px; background-color:'+bgc+'; border-color:'+brdC+'; border-width:'+brdW+'px; border-style:solid; font-size:1px;">';
t+='<span id="blocks'+N+'" style="left:-'+(h*2+1)+'px; position:absolute; font-size:1px">';
for(i=0;i<blocks;i++){
t+='<span style="background-color:'+blkC+'; left:-'+((h*i)+i)+'px; font-size:1px; position:absolute; width:'+h+'px; height:'+h+'px; '
t+=(ie)?'filter:alpha(opacity='+(100-i*(100/blocks))+')':'-Moz-opacity:'+((100-i*(100/blocks))/100);
t+='"></span>';
}
t+='</span></div>';
document.write(t);
var bA=(ie)?document.all['blocks'+N]:document.getElementById('blocks'+N);
bA.bar=(ie)?document.all['_xpbar'+N]:document.getElementById('_xpbar'+N);
bA.blocks=blocks;
bA.N=N;
bA.w=w;
bA.h=h;
bA.speed=speed;
bA.ctr=0;
bA.count=count;
bA.action=action;
bA.togglePause=togglePause;
bA.showBar=function(){
this.bar.style.visibility="visible";
}
bA.hideBar=function(){
this.bar.style.visibility="hidden";
}
bA.tid=setInterval('startBar('+N+')',speed);
return bA;
}}

function startBar(bn){
var t=(ie)?document.all['blocks'+bn]:document.getElementById('blocks'+bn);
if(parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w){
t.style.left=-(t.h*2+1)+'px';
t.ctr++;
if(t.ctr>=t.count){
eval(t.action);
t.ctr=0;
}}else t.style.left=(parseInt(t.style.left)+t.h+1)+'px';
}

function togglePause(){
if(this.tid==0){
this.tid=setInterval('startBar('+this.N+')',this.speed);
}else{
clearInterval(this.tid);
this.tid=0;
}}

function togglePause(){
if(this.tid==0){
this.tid=setInterval('startBar('+this.N+')',this.speed);
}else{
clearInterval(this.tid);
this.tid=0;
}}


function resultWin(param,imgobj){
if (param=="s"){
var posVals=getPos(imgobj).split("|");
document.getElementById("testResults").style.left=posVals[0];
if (resType=="web"){
document.getElementById("testResults").style.top=Number(posVals[1]);
}else{
document.getElementById("testResults").style.top=Number(posVals[1])-85;
}
document.getElementById("testResults").style.width="170px";
document.getElementById("testResults").style.height="1px";
document.getElementById("testResults").style.display="block";
}else if (param=="h"){
document.getElementById("testResults").style.left=0;
document.getElementById("testResults").style.top=0;
document.getElementById("testResults").style.width="0px";
document.getElementById("testResults").style.height="0px";
document.getElementById("testResults").style.display="none";
combos("visible");
}
}

function setSelData(arrNum,obj,key){
var tempCri=testArr[Number(arrNum)];
if (key=="AP"){
document.forms[0].elements[obj].value=tempCri[0].substring(0,1).toUpperCase()+tempCri[0].substring(2,tempCri[0].length).toLowerCase();
}else if (key=="City"){
document.forms[0].elements[obj].value=tempCri[1];
}
document.forms[0].elements[""+obj+"Hid"].value=tempCri.join("|");
testArr.length=0;
resultWin("h","");
combos("visible");
}
/*
function oRTx(txtyp,txnm,txsoc,txamt){
		this.txTyp=txtyp;
		this.txNm=txnm;
		this.txSoc=txsoc;		
		this.txAmt=txamt;
	}
	
function oDRt(dlydy,dlystdrt,dlyaart,dlychrt,dlytot,dlyvenrt){
		this.dlyDy=dlydy;
		this.dlySRt=dlystdrt;
		this.dlyAARt=dlyaart;
		this.dlyCRt=dlychrt;
		this.dlyTot=dlytot;
		this.dlyVenRt=dlyvenrt;
	}
	
	function oRt(rtcd,rttyp,rtsoc,rttot,rtvninf,rtminusmrkup,xmlrt,avgrtMinusMarkUp){
		this.rtCd=rtcd;
		this.rtTyp=rttyp;
		this.rtSoc=rtsoc;
		this.rtTot=rttot;
		this.rtVninf=rtvninf;
		this.rtMinusmrkup=rtminusmrkup;
		this.xmlRt=xmlrt;
		this.avgRtMinusMarkUp=avgrtMinusMarkUp;
		
	}*/
	
	function oRt(rtcd,xmlrt){
		this.rtCd=rtcd;
		this.xmlRt=xmlrt;
	}
	/*
	function oRm(rnm,rcd,rtyp,bdcd,bdtyp,rdesc,rvendt,pcd,pdesc,dcd,ddesc,radlt,rchld,rbtype){
		this.rNm=rnm;
		this.rCd=rcd;
		this.rTyp=rtyp;
		this.bdCd=bdcd;
		this.bdTyp=bdtyp;
		this.rDesc=rdesc;
		this.rVenDt=rvendt;
		this.pCd=pcd;
		this.pDesc=pdesc;
		this.dCd=dcd;
		this.dCesc=ddesc;
		this.rAdlt=radlt;
		this.rChld=rchld;
		this.rBtype=rbtype;
	}*/
	
	function oRm(rcd,rbtype,inventory,inventoryExhausted,inventoryObtainedBy,roomKey){
		this.rCd=rcd;
		this.rBtype=rbtype;
		this.inventory=inventory;
		this.inventoryExhausted=inventoryExhausted;
		this.inventoryObtainedBy=inventoryObtainedBy;
		this.roomKey=roomKey;
	}
	
	function oHt(hcd,rdcd,hnm,hadd,hcty,hste,hzip,hctry,hdes,hurl,hthmb,hpol,havg,hven,hvenid,hprt,hconty,hcurr,hexchgeate,StarCategory){
		this.hCd=hcd;
		this.rdCd=rdcd;
		this.hNm=hnm;
		this.hAdd=hadd;
		this.hCty=hcty;
		this.hSte=hste;
		this.hZip=hzip;
		this.hCtry=hctry;
		this.hDes=hdes;
		this.hUrl=hurl;
		this.hThnb=hthmb;
		this.hPol=hpol;
		this.hAvg=havg;
		this.hVen=hven;
		this.hVenId=hvenid;
		this.hPrt=hprt;
		this.hConty=hconty;
		this.hCurr=hcurr;
		this.hExchgRate=hexchgeate;
		this.starCategory=StarCategory
	}

function countNoDays(inM,inD,inY,outM,outD,outY){
selDays=1;
	if (inY==outY){
		if (inM==outM){
		selDays=outD-inD;
			if (selDays<1){selDays=-1;}
		}else{
			if (inM>outM){
			selDays=-1;
			}else{
				selDays=(getMaxDays(inM,inY)-inD)+outD;
				for (a=0; a<(outM-inM-1); a++){
				selDays=selDays+getMaxDays(inM+1+a,inY);
				}
			}
		}
	}else{
		if (outY>inY){
			selDays=(getMaxDays(inM,inY)-inD)+outD;
			for (k=inM+1; k<=11; k++){
				selDays=selDays+getMaxDays(k,inY);
			}
			for (k=0; k<(outY-inY-1); k++){
				selDays=selDays+getDaysOfYear(inY+1+k);
			}
			for (k=0; k<outM; k++){
				selDays=selDays+getMaxDays(k,outY);
			}
			
		}else{
		selDays=-1;
		}
	}
	return selDays;
}

function initializeForm(objH,htCount,rmCount,totRm,resort,code,curType){
		document.ResSearchForm.resortName.value=""+resort+"";		
		document.ResSearchForm.SHtCd.value=""+objH.hCd+"";
		document.ResSearchForm.SRideCd.value=""+objH.rdCd+"";
		document.ResSearchForm.SHtNm.value=""+objH.hNm+"";
		document.ResSearchForm.SHtAdd.value=""+objH.hAdd+"";
		document.ResSearchForm.SHtCty.value=""+objH.hCty+"";
		document.ResSearchForm.SHtSte.value=""+objH.hSte+"";
		document.ResSearchForm.SHtZip.value=""+objH.hZip+"";
		document.ResSearchForm.SHtCtry.value=""+objH.hCtry+"";
		document.ResSearchForm.SHtDes.value=""+objH.hDes+"";
		document.ResSearchForm.SHtUrl.value=""+objH.hUrl+""; 
		document.ResSearchForm.SHtThmUrl.value=""+objH.hThnb+"";
		document.ResSearchForm.SHtPol.value=""+objH.hPol+"";
		
		document.ResSearchForm.SHtAvgRt.value=""+objH.hAvg+"";
		document.ResSearchForm.SHtVenInf.value=""+objH.hVen+"";
		document.ResSearchForm.SHtVenId.value=""+objH.hVenId+"";
		document.ResSearchForm.SHtPrId.value=""+objH.hPrt+"";
		document.ResSearchForm.SHtContTyp.value=""+objH.hConty+"";
		document.ResSearchForm.SHtCurrency.value=""+objH.hCurr+"";
		document.ResSearchForm.exchangeRate.value=""+objH.hExchgRate+"";
		document.ResSearchForm.starCategory.value=""+objH.starCategory+"";
		
	
		var room="";
		var hotCd=""+objH.hCd+"";
		
		var rDes="";
		var rVenDt="";
		var pCd="";
		var pDesc="";
		var dCd="";
		var dCesc="";
		var rNm="";
		var rCd="";
		var rTyp="";
		var rCd="";
		var rTyp="";
		var bdCd="";
		var bdTyp="";
		var rChld="";
		var rAdlt="";
		
		var rtCd="";
		var rtTyp="";
		var rtSoc="";
		var rtTot="";
		var rtVninf="";
		var rtMinusmrkup="";
		
		var dlyDy="";
		var dlySRt="";
		var dlyAARt="";
		var dlyCRt="";
		var dlyTot="";
		var dlyVenRt="";
		
		var txTyp="";
		var txName="";
		var txSoc="";
		var txVenDt="";
		var txAmt="";
		var xmlRt="";
		var avgRtMinusMarkUp="";	
		var booktyp="";
		var req="";	
		var fre="";	
		var con="";	
		
		for(a=1;a<=totRm;a++){
			room=document.ResSearchForm.elements["r"+hotCd+a+htCount].value;
			obrm="obR"+htCount+room;
			obrt="oRt"+htCount+room;
			odrt="oDRt"+htCount+room;
			ormtx="oRTx"+htCount+room; 
			
		
			if(eval(obrm).rBtype=='REQ'){
			req="Y";				
			}else if(eval(obrm).rBtype=='FRE'){
			fre="Y";				
			}else{
			con="Y";
			}	
			
			//alert(eval(obrm).rCd);
			//rNm=rNm+eval(obrm).rNm+"@";
			
			rCd=rCd+eval(obrm).rCd+"@";
			
			/*rTyp=rTyp+eval(obrm).rTyp+"@";
			bdCd=bdCd+eval(obrm).bdCd+"@";
			bdTyp=bdTyp+eval(obrm).bdTyp+"@";
			rDes=rDes+eval(obrm).rDesc+"@";
			rVenDt=rVenDt+eval(obrm).rVenDt+"@";
			pCd=pCd+eval(obrm).pCd+"@";
			pDesc=pDesc+eval(obrm).pDesc+"@";
			dCd=dCd+eval(obrm).dCd+"@";
			dCesc=dCesc+eval(obrm).dCesc+"@";
			rAdlt=rAdlt+eval(obrm).rAdlt+"@";
			rChld=rChld+eval(obrm).rChld+"@";*/
			 
			rtCd=rtCd+eval(obrt).rtCd+"@";
			xmlRt=xmlRt+eval(obrt).xmlRt+"@";
			
			/*rtTyp=rtTyp+eval(obrt).rtTyp+"@";
			
			avgRtMinusMarkUp=avgRtMinusMarkUp+eval(obrt).avgRtMinusMarkUp+"@";
			
			rtSoc=rtSoc+eval(obrt).rtSoc+"@";
			rtTot=rtTot+eval(obrt).rtTot+"@";
			rtVninf=rtVninf+eval(obrt).rtVninf+"@";
			rtMinusmrkup=rtMinusmrkup+eval(obrt).rtMinusmrkup+"@";
			
			
			dlyDy=dlyDy+eval(odrt).dlyDy+"@";
			dlySRt=dlySRt+eval(odrt).dlySRt+"@";
			dlyAARt=dlyAARt+eval(odrt).dlyAARt+"@";
			dlyCRt=dlyCRt+eval(odrt).dlyCRt+"@";
			dlyTot=dlyTot+eval(odrt).dlyTot+"@";
			dlyVenRt=dlyVenRt+eval(odrt).dlyVenRt+"@";
			
			
			txTyp=txTyp+eval(ormtx).txTyp+"@";
			txName=txName+eval(ormtx).txNm+"@";
			txSoc=txSoc+eval(ormtx).txSoc+"@";			
			txAmt=txAmt+eval(ormtx).txAmt+"@";*/
			
		}
	/*
		document.ResSearchForm.avgRateMinusMarkUp.value=""+avgRtMinusMarkUp+"";
		
		document.ResSearchForm.SRmNm.value=""+rNm+"";
		*/
		document.ResSearchForm.SRmCd.value=""+rCd+"";
		document.ResSearchForm.xmlRate.value=""+xmlRt+"";
		
		/*document.ResSearchForm.SRmTyp.value=""+rTyp+"";
		document.ResSearchForm.SBdCd.value=""+bdCd+"";
		document.ResSearchForm.SBdTyp.value=""+bdTyp+"";
		document.ResSearchForm.SRmDes.value=""+rDes+"";
		document.ResSearchForm.SRmVenInf.value=""+rVenDt+"";
		document.ResSearchForm.SRmPrmCd.value=""+pCd+"";
		document.ResSearchForm.SRmPrmDes.value=""+pDesc+"";
		document.ResSearchForm.SRmDisCd.value=""+dCd+"";
		document.ResSearchForm.SRmdisDes.value=""+dCesc+"";
		document.ResSearchForm.SRmAdlt.value=""+rAdlt+"";
		document.ResSearchForm.SRmChld.value=""+rChld+"";*/
		document.ResSearchForm.SRtCd.value=""+rtCd+"";
		/*document.ResSearchForm.SRtTyp.value=""+rtTyp+"";
		document.ResSearchForm.SRtSoc.value=""+rtSoc+"";
		document.ResSearchForm.SRtTot.value=""+rtTot+"";
		document.ResSearchForm.SRtVenInf.value=""+rtVninf+"";
		document.ResSearchForm.SRtMinusmrkup.value=""+rtMinusmrkup+"";
		document.ResSearchForm.SDlyDy.value=""+dlyDy+"";
		document.ResSearchForm.SDlyStdRt.value=""+dlySRt+"";
		document.ResSearchForm.SDlyAARt.value=""+dlyAARt+"";
		document.ResSearchForm.SDlyChRt.value=""+dlyCRt+"";
		document.ResSearchForm.SDlyTot.value=""+dlyTot+"";
		document.ResSearchForm.SDlyVenInf.value=""+dlyVenRt+"";*/
		if (eval("show_"+code+"")){
			calcTotlasOnSubmit(code,'',curType);
		}else{
			calcTotlasOnSubmit(code,'init',curType);
		}
		

		//calcTotalSingleOnSubmit(code,'init');
		/*document.ResSearchForm.STxTyp.value=""+txTyp+"";
		document.ResSearchForm.STxNm.value=""+txName+"";
		document.ResSearchForm.STxSoc.value=""+txSoc+"";
		//document.ResSearchForm.STxVenInf.value=""+txVenDt+"";
		document.ResSearchForm.STxAmt.value=""+txAmt+"";*/

		if(req=='Y'){
		booktyp="REQ";
		}else if(fre=='Y'){
		booktyp="FRE";
		}else if(con=='Y'){
		booktyp="CON";
		}   
		//alert(booktyp);
		document.ResSearchForm.bookType.value=""+booktyp+"";
		//document.ResSearchForm.bookType.value="CON";
		document.ResSearchForm.index.value=""+htCount+"";
	}
	


/////////////// Hotel Info page Booking engine Children ////////////////////////////

function addChildDetailsHinfo(value,screen,adultcount,childcount){ 
tmp_txt="<table border=\"0\" bordercolor=\"#FFFAF0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"55\" height=\"2\" border=\"0\"></td>"+
"<td class=\"chihead\" style=\"font-size:10px;\" width=\"50\">Adults</td>"+
"<td class=\"chihead\" style=\"font-size:10px;\" width=\"50\">Children</td>";
tmp_txt+="</tr>"+
"<tr>";

for (var k=0; k<childcount; k++){
if (k<3){break;}
tmp_txt+="<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"50\" height=\"2\" border=\"0\"></td>";
}

tmp_txt+="</tr>";
for (var a=0; a<value; a++){
tmp_txt=tmp_txt+"<tr>";  
if (a==0){
tmp_txt=tmp_txt+"<td width=\"55\" nowarp><span id=\"roomHead"+(a+1)+"\" style=\"padding-top:5px;display:block;\">Room "+(a+1)+"</span></td>";
tmp_txt=tmp_txt+"<td width=\"50\" nowarp><span id=\"idcmbAdlt_R"+(a+1)+"\" style=\"padding-top:5px;display:block;\"><select name=\"cmbAdlt_R"+(a+1)+"\" style=\"width:40px;\" class=\"select\">";
}else{
tmp_txt=tmp_txt+"<td width=\"55\" nowarp><span id=\"roomHead"+(a+1)+"\" style=\"padding-top:5px;display:none;\">Room "+(a+1)+"</span></td>";
tmp_txt=tmp_txt+"<td width=\"50\" nowarp><span id=\"idcmbAdlt_R"+(a+1)+"\" style=\"padding-top:5px;display:none;\"><select name=\"cmbAdlt_R"+(a+1)+"\" style=\"width:40px;\" class=\"select\">";
}

for (var k=0; k<adultcount; k++){  
tmp_txt+="<option value=\""+(k+1)+"\">"+(k+1)+"</option>"; 
} 
tmp_txt=tmp_txt+"</select></span></td>";  


rnm=a+2;
if (a==0){
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbChi_R"+(a+1)+"\" style=\"padding-top:5px;display:block;\"><select name=\"cmbChi_R"+(a+1)+"\" style=\"width:40px;\" onChange=\"showHideAges(parseInt(this.name.substring(8,this.name.length)),Number(this.options[this.selectedIndex].value),'"+childcount+"');\" class=\"select\">";
}else{
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbChi_R"+(a+1)+"\" style=\"padding-top:5px;display:none;\"><select name=\"cmbChi_R"+(a+1)+"\" style=\"width:40px;\" onChange=\"showHideAges(parseInt(this.name.substring(8,this.name.length)),Number(this.options[this.selectedIndex].value),'"+childcount+"');\" class=\"select\">";
} 

for (var y=-1; y<childcount; y++){  
tmp_txt+="<option value=\""+(y+1)+"\">"+(y+1)+"</option>"; 
}   
tmp_txt=tmp_txt+"</select></span></td>";     

for (var k=1; k<=childcount; k++){
if (k==1){
}
tmp_txt+="<td class=\"chihead\"><div id=\"R"+(a+1)+"chihead"+k+"\" style=\"font-size:10px; display:none;padding-top:4px;padding-bottom:2px;\"><div>Age "+k+"</div>"+ret_combo("ChiAgeR"+(a+1)+"",k)+"</div></td>";
if (k%6==0){
}
}

}
 
tmp_txt=tmp_txt+"</table>";
document.getElementById("roomdataHinfo").innerHTML=tmp_txt;
a=0;
}

function addChildDetailsHinfo(value,screen,adultcount,childcount,roomLabel,adtlabel,chdlabel){ 
tmp_txt="<table border=\"0\" bordercolor=\"#FFFAF0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"55\" height=\"2\" border=\"0\"></td>"+
"<td class=\"chihead\" style=\"font-size:10px;\" width=\"50\">"+adtlabel+"</td>"+
"<td class=\"chihead\" style=\"font-size:10px;\" width=\"50\">"+chdlabel+"</td>";
tmp_txt+="</tr>"+
"<tr>";

for (var k=0; k<childcount; k++){
if (k<3){break;}
tmp_txt+="<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"50\" height=\"2\" border=\"0\"></td>";
}

tmp_txt+="</tr>";
for (var a=0; a<value; a++){
tmp_txt=tmp_txt+"<tr>";  
if (a==0){
tmp_txt=tmp_txt+"<td width=\"55\" nowarp><span id=\"roomHead"+(a+1)+"\" style=\"padding-top:5px;display:block;\">"+roomLabel+" "+(a+1)+"</span></td>";
tmp_txt=tmp_txt+"<td width=\"50\" nowarp><span id=\"idcmbAdlt_R"+(a+1)+"\" style=\"padding-top:5px;display:block;\"><select name=\"cmbAdlt_R"+(a+1)+"\" style=\"width:40px;\" class=\"select\">";
}else{
tmp_txt=tmp_txt+"<td width=\"55\" nowarp><span id=\"roomHead"+(a+1)+"\" style=\"padding-top:5px;display:none;\">"+roomLabel+" "+(a+1)+"</span></td>";
tmp_txt=tmp_txt+"<td width=\"50\" nowarp><span id=\"idcmbAdlt_R"+(a+1)+"\" style=\"padding-top:5px;display:none;\"><select name=\"cmbAdlt_R"+(a+1)+"\" style=\"width:40px;\" class=\"select\">";
}

for (var k=0; k<adultcount; k++){  
tmp_txt+="<option value=\""+(k+1)+"\">"+(k+1)+"</option>"; 
} 
tmp_txt=tmp_txt+"</select></span></td>";  


rnm=a+2;
if (a==0){
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbChi_R"+(a+1)+"\" style=\"padding-top:5px;display:block;\"><select name=\"cmbChi_R"+(a+1)+"\" style=\"width:40px;\" onChange=\"showHideAges(parseInt(this.name.substring(8,this.name.length)),Number(this.options[this.selectedIndex].value),'"+childcount+"');\" class=\"select\">";
}else{
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbChi_R"+(a+1)+"\" style=\"padding-top:5px;display:none;\"><select name=\"cmbChi_R"+(a+1)+"\" style=\"width:40px;\" onChange=\"showHideAges(parseInt(this.name.substring(8,this.name.length)),Number(this.options[this.selectedIndex].value),'"+childcount+"');\" class=\"select\">";
} 

for (var y=-1; y<childcount; y++){  
tmp_txt+="<option value=\""+(y+1)+"\">"+(y+1)+"</option>"; 
}   
tmp_txt=tmp_txt+"</select></span></td>";     

for (var k=1; k<=childcount; k++){
if (k==1){
}
tmp_txt+="<td class=\"chihead\"><div id=\"R"+(a+1)+"chihead"+k+"\" style=\"font-size:10px; display:none;padding-top:4px;padding-bottom:2px;\"><div>Age "+k+"</div>"+ret_combo("ChiAgeR"+(a+1)+"",k)+"</div></td>";
if (k%6==0){
}
}

}
 
tmp_txt=tmp_txt+"</table>";
document.getElementById("roomdataHinfo").innerHTML=tmp_txt;
a=0;
}
//////////////////////////////////////////////////////////////////////////////////////







function addLangChildDetails(value,screen,adultcount,childcount,roomLabel,adtlabel,chdlabel){ 
//alert('inside res search hotel js == ');
//function addChildDetails(value){ 
//addRoomHeadings(value);
tmp_txt="<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">"+
"<tr>"+
"<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"55\" height=\"2\" border=\"0\"></td>"+
"<td class=\"chihead\" style=\"font-size:10px;\" width=\"50\">"+adtlabel+"</td>"+
"<td class=\"chihead\" style=\"font-size:10px;\" width=\"50\">"+chdlabel+"</td>";
tmp_txt+="</tr>"+
"<tr>";


for (var k=0; k<childcount; k++){
if (k<3){break;}
tmp_txt+="<td><img src=\"../../admin/images/s.gif\" alt=\"\" width=\"50\" height=\"2\" border=\"0\"></td>";
}

tmp_txt+="</tr>";
for (var a=0; a<value; a++){
tmp_txt=tmp_txt+"<tr>";  
if (a==0){
tmp_txt=tmp_txt+"<td width=\"55\"><span id=\"roomHead"+(a+1)+"\" style=\"padding-top:5px;display:block;\">"+roomLabel+" "+(a+1)+"</span></td>";
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbAdlt_R"+(a+1)+"\" style=\"padding-top:5px;display:block;\"><select name=\"cmbAdlt_R"+(a+1)+"\" style=\"width:40px;\" class=\"select\">";
}else{
tmp_txt=tmp_txt+"<td width=\"55\"><span id=\"roomHead"+(a+1)+"\" style=\"padding-top:5px;display:none;\">"+roomLabel+" "+(a+1)+"</span></td>";
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbAdlt_R"+(a+1)+"\" style=\"padding-top:5px;display:none;\"><select name=\"cmbAdlt_R"+(a+1)+"\" style=\"width:40px;\" class=\"select\">";
}

//tmp_txt=tmp_txt+"<option value=\"1\">1</option>"+
//"<option value=\"2\">2</option>"+
//"<option value=\"3\">3</option>"+
//"<option value=\"4\">4</option>"+ 
//"<option value=\"5\">5</option>"+
//"<option value=\"6\">6</option>"+
//"</select></span></td>"+
for (var k=0; k<adultcount; k++){  
tmp_txt+="<option value=\""+(k+1)+"\">"+(k+1)+"</option>"; 
} 
tmp_txt=tmp_txt+"</select></span></td>";  


rnm=a+2;
if (a==0){
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbChi_R"+(a+1)+"\" style=\"padding-top:5px;display:block;\"><select name=\"cmbChi_R"+(a+1)+"\" style=\"width:40px;\" onChange=\"showHideAges(parseInt(this.name.substring(8,this.name.length)),Number(this.options[this.selectedIndex].value),'"+childcount+"');\" class=\"select\">";
}else{
tmp_txt=tmp_txt+"<td width=\"50\"><span id=\"idcmbChi_R"+(a+1)+"\" style=\"padding-top:5px;display:none;\"><select name=\"cmbChi_R"+(a+1)+"\" style=\"width:40px;\" onChange=\"showHideAges(parseInt(this.name.substring(8,this.name.length)),Number(this.options[this.selectedIndex].value),'"+childcount+"');\" class=\"select\">";
} 

//tmp_txt=tmp_txt+"<option value=\"0\">0</option>"+
//"<option value=\"1\">1</option>"+
//"<option value=\"2\">2</option>"+
//"<option value=\"3\">3</option>"+
//"</select></span></td>"+
//"</tr>"+
//"<tr>";
for (var y=-1; y<childcount; y++){  
tmp_txt+="<option value=\""+(y+1)+"\">"+(y+1)+"</option>"; 
}   
tmp_txt=tmp_txt+"</select></span></td></tr>";     


//for (var k=0; k<3; k++){
for (var k=1; k<=childcount; k++){
if (k==1){
tmp_txt+="<tr>";
}
tmp_txt+="<td class=\"chihead\"><div id=\"R"+(a+1)+"chihead"+k+"\" style=\"font-size:10px; display:none;padding-top:4px;padding-bottom:2px;\"><div>Age "+k+"</div>"+ret_combo("ChiAgeR"+(a+1)+"",k)+"</div></td>";
if (k%3==0){
tmp_txt+="</tr><tr>";
}
}
tmp_txt=tmp_txt+"</tr>"; 

}
 
tmp_txt=tmp_txt+"</table>";
document.getElementById("roomdata").innerHTML=tmp_txt;
a=0;
} 

 function search_again(){
	return;
	var valArrr=new Array();
	valArrr[0]="cmbCtry";
	valArrr[1]="cmbSte";
	valArrr[2]="cmbCty";
	valArrr[3]="cmbInMn";
	valArrr[4]="cmbInDt";
	valArrr[5]="cmbInYr";
	valArrr[6]="cmbOutMn";
	valArrr[7]="cmbOutDt";
	valArrr[8]="cmbOutYr";
	valArrr[9]="cmbNgt";
	valArrr[10]="cmbNoRm";
	 for (k=0; k<valArrr.length; k++){
	 tmpvvl=ret_val(valArrr[k]);
	 
	 for (j=0; j<partsstr.length; j++){
	 if (partsstr[j].indexOf(valArrr[k])>-1){
	 partsstr[j]=""+valArrr[k]+"="+tmpvvl+"";
	 }
	 }
	 }

	 
	 document.forms["ResSearchForm"].elements["cmbNoRm"].disabled=false;
	 temURL="../reservation/ResSearch.do?"+partsstr.join("&")+"";
	 document.location.replace(temURL);
}	
 
 
function ret_val(val){
	 return escape(document.forms["ResSearchForm"].elements[val].options[document.forms["ResSearchForm"].elements[val].selectedIndex].value);
	 }
var stay="mtr";
function ShowMoreRooms(ht,but){
	tmp_shown=eval("show_"+ht+"");
	totTypes=Number(document.forms["ResSearchForm"].elements[""+ht+"_totTypes"].value);
	MoreRooms=true;
	for (gg=0; gg<totTypes; gg++){
	if (eval("str_"+ht+"_RT"+(gg+1)+"")=="" && MoreRooms==true){
	MoreRooms=false;
	}
	if (eval("str_"+ht+"_RT"+(gg+1)+"")!=""){
	value="<table width='100%' border='0' cellpadding='0' cellspacing='0' class='gridtbl' style='border-bottom-width:0px;'>"+eval("str_"+ht+"_RT"+(gg+1)+"")+"</table>";
	if (tmp_shown==false){
		if(but==null){
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").innerHTML=value;
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").style.display="block";
		if(document.forms["ResSearchForm"].elements["accommodationType"].value=="HT"){
		document.getElementById("spID_"+ht+"").innerHTML = "<img src=\"../../admin/images/hidemoreroom_arrow.gif\" width=\"16\" height=\"8\" border=\"0\" align=\"absmiddle\">'"+document.forms[0].keydesc1.value+"'";
		}else{
		document.getElementById("spID_"+ht+"").innerHTML = "<img src=\"../../admin/images/hidemoreroom_arrow.gif\" width=\"16\" height=\"8\" border=\"0\" align=\"absmiddle\">Click to Hide More Bed Types";
		}
		}else{
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").innerHTML=value;
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").style.display="block";
		document.getElementById(but).value = "Hide Room Types";
		}
	}else{
		if(but==null){
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").innerHTML="";
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").style.display="none";
		document.getElementById("spID_"+ht+"").innerHTML = "<img src=\"../../admin/images/moreroom_arrow.gif\" width=\"16\" height=\"8\" border=\"0\" align=\"absmiddle\">'"+document.forms[0].keydesc.value+"'";
		}else{
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").innerHTML="";
		document.getElementById("id_"+ht+"_RT"+(gg+1)+"").style.display="none";
		document.getElementById(but).value = "Click for More Room Types";
		}
	}
	}
	}
	try{
		hideDailyRates();
	}catch(ex){}
	checkInventoryAgain(ht);
}

function ShowMoreRoomsHtCC(ht,num,but){
var totTypes=Number(document.forms["ResSearchForm"].elements[""+ht+"_totTypes"].value);
var styl="";
if (eval("show_"+ht+"")){
styl="none";
if(document.forms["ResSearchForm"].elements["accommodationType"].value=="HT"){
but.value="Show More Rooms";
}else{
but.value="Show More Beds";
}
}else{
styl="block";
if(document.forms["ResSearchForm"].elements["accommodationType"].value=="HT"){
but.value="Hide More Rooms";
}else{
but.value="Hide More Beds";
}
} 
	for (var gh=0; gh<totTypes; gh++){
		var brk=false;
		var jk=0;
		while (!brk){
			try{
				document.getElementById("R"+(gh+1)+"_"+ht+"_TR"+jk+"").style.display=styl;
				jk++;	
			}catch(err){
				brk=true;
			}
		}
	}
eval("chkShown"+ht+"()");
}

function setRm(rmCount,hotCd,rmNumCount,ht,bool,htcount,curtype){
	//alert(curtype)
	if(rmCount!='-'){
	document.ResSearchForm.elements["r"+hotCd+rmNumCount+htcount].value=""+rmCount+"";
	}
	var room="";
	var req="";
	var fre="";
	var con="";	
	var booktyp="";
	var cal="";
	
	for(a=1;a<=document.ResSearchForm.totRooms.value;a++){
	//alert("r"+hotCd+a+htcount);
	try{
	room=document.ResSearchForm.elements["r"+hotCd+a+htcount].value;
	}catch(e){}
	//alert("r"+htcount+"/"+room);
	obrm="obR"+htcount+room;
	//alert(eval(obrm).rBtype);
	if(eval(obrm).rBtype=='CAL'){
	cal="Y";
	}
	else if(eval(obrm).rBtype=='REQ'){
	req="Y";				
	}else if(eval(obrm).rBtype=='FRE'){
	fre="Y";				
	}else{
	con="Y";
	}			
	}
	if(req=='Y'){
	booktyp="REQ";
	}else if(fre=='Y'){
	booktyp="FRE";
	}else if(con=='Y'){
	booktyp="CON";
	}else if(cal=='Y'){
	booktyp="CAL";
	}
	//alert(booktyp);
	
	if(booktyp=="CAL"){
	try {
	document.getElementById("onReq_"+ht+"").style.display="block";
	document.getElementById("onReq_"+ht+"").innerHTML = "Call To Book";
	}catch(ex){}
	}
	else if(booktyp=="CON"){
		//document.getElementById(""onReq_HT"+noRoomTypes+"").innerHTML = ""
		try {
		 if(displayAvailableForAllotment=="Y"){
		   document.getElementById("onReq_"+ht+"").style.display="block";
		   document.getElementById("onReq_"+ht+"").style.background="#cdcdcd";
		   document.getElementById("onReq_"+ht+"").innerHTML = "Available";
		 }else{
		   document.getElementById("onReq_"+ht+"").style.display="none";
		   document.getElementById("onReq_"+ht+"").innerHTML = "";		 
		 }
		}catch(ex){}
		//document.images["bookImg"+ht+""].src="../images/but_res_book_now.gif";
		//document.getElementById("bookImg"+ht+"").style.width="78"
		//document.getElementById("bookImg"+ht+"").style.height="23";
	}else if(booktyp=="FRE"){
		//abert(booktyp);
		//document.getElementById(""onReq_HT"+noRoomTypes+"").innerHTML = ""
		try {
		document.getElementById("onReq_"+ht+"").style.display="none";
		document.getElementById("onReq_"+ht+"").innerHTML = "";
		}catch(ex){}
		//document.images["bookImg"+ht+""].src="../images/but_res_book_now.gif";
		//document.getElementById("bookImg"+ht+"").style.width="78"
		//document.getElementById("bookImg"+ht+"").style.height="23";
	}else{
	//alert(booktyp);
	try {
	document.getElementById("onReq_"+ht+"").style.display="block";
	document.getElementById("onReq_"+ht+"").innerHTML = "On Request";
	}catch(ex){}
	//document.images["bookImg"+ht+""].src="../images/but_cc_request_booking.gif";
	//document.getElementById("bookImg"+ht+"").style.width="142"
	//document.getElementById("bookImg"+ht+"").style.height="22";
	}
	document.ResSearchForm.bookType.value=""+booktyp+"";
	if (bool==true){
	
	calcTotalSingle(ht,'init1',curtype);
	}
	checkInventoryAgain(ht);
}

function cusBookDetails(){
		if (document.ResSearchForm.userEmail.value == "" || document.ResSearchForm.userEmailPassword.value == ""){
			
			document.ResSearchForm.target="_self";
      		document.ResSearchForm.action="../reservation/ResSearchCriteria.do?ActionType=CusBookDetails";
			document.ResSearchForm.submit();
		}else{	
	      	document.ResSearchForm.target="customerBookDetails";
	      	document.ResSearchForm.action="../reservation/ResSearchCriteria.do?ActionType=CusBookDetails";
	      	window.open('about:blank',"customerBookDetails");
	      	//window.open('about:blank',"customerBookDetails","width=800,height=600,status=0,toolbar=0,menubar=0,scrollbars=1,top=100,left=100");
	      	document.ResSearchForm.submit();
		}
	}
	
	function calcTotlas(code,state){
	//var curformat="AUD";
	valgbp=0;valusd=0;valeur=0;
	var ratesArr=new Array();
	var totTypes=Number(document.forms["ResSearchForm"].elements[""+code+"_totTypes"].value);
	for (var jj=0; jj<3; jj++){
		ratesArr[jj]=0;
	}
	
	for (var jj=1; jj<=totTypes; jj++){
	totcombos=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jj+"Radios"].value)
	
	if (state=="init"){
		tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
		for (var kk=0; kk<tmparr.length; kk++){
		ratesArr[kk]=ratesArr[kk]+(parseFloat(tmparr[kk])*100);
		}
	}else{
		if (totcombos==1){
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
			for (var ii=0; ii<tmparr.length; ii++){
			ratesArr[ii]=ratesArr[ii]+(parseFloat(tmparr[ii])*100);
			}
		}else{
			for (kk=0; kk<totcombos; kk++){
				if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].checked){
				tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].value.split("|");
				for (var ii=0; ii<tmparr.length; ii++){
				ratesArr[ii]=ratesArr[ii]+(parseFloat(tmparr[ii])*100);
				}
				}	
			}
		}
	}
	
	
	}
		
		for (var ii=0; ii<tmparr.length; ii++){
		ratesArr[ii]=ratesArr[ii]/100;
		document.getElementById("rt"+(ii+1)+"_"+code+"").innerHTML="<b>"+ratesArr[ii].toFixed(2)+"</b>";
		}
		tmparr.length=0;
	}
	
	function calcTotalSingleBK(code,state){
	valComn=0;
	var ratesArr=new Array();
	totTypes=Number(document.forms["ResSearchForm"].elements[""+code+"_totTypes"].value)
	
	for (var jj=0; jj<totTypes; jj++){
		ratesArr[jj]=0;
	}
	for (jj=1; jj<=totTypes; jj++){
	totcombos=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jj+"Radios"].value)
	
	if (state=="init"){
		tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
		for (var jj=0; jj<tmparr.length; jj++){
			ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
		}		
	}else{
		if (totcombos==1){
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
			for (var jj=0; jj<tmparr.length; jj++){
				ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
			}	
		}else{
			for (kk=0; kk<totcombos; kk++){
				if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].checked){
				tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].value.split("|");
				for (var jj=0; jj<tmparr.length; jj++){
					ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
				}
				}	
			}
		}
	}
	}
		for (var jj=0; jj<tmparr.length; jj++){
			ratesArr[jj]=ratesArr[jj]/100;
			document.getElementById("rt"+(jj+1)+"_"+code+"").innerHTML="<b>"+ratesArr[jj].toFixed(2)+"</b>";
		}
		tmparr.length=0;
		
	}
	
	
	
	function calcTotalSingleOnSubmit(code,state){
	valComn=0;
	
	var ratesArr=new Array();
	totTypes=Number(document.forms["ResSearchForm"].elements[""+code+"_totTypes"].value)
	for (var jj=0; jj<totTypes; jj++){
		ratesArr[jj]=0;
	}

	for (jj=1; jj<=totTypes; jj++){
	totcombos=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jj+"Radios"].value)
	
	if (state=="init"){
		tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
		valComn=valComn+(parseFloat(tmparr[0])*100);		
		for (var jj=0; jj<tmparr.length; jj++){
			ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
		}
	}else{
		if (totcombos==1){
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
			for (var jj=0; jj<tmparr.length; jj++){
				ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
			}			
		}else{
			for (kk=0; kk<totcombos; kk++){
				if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].checked){
				tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].value.split("|");
				for (var jj=0; jj<tmparr.length; jj++){
					ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
				}		
				}	
			}
		}
	}
	}
		for (var jj=0; jj<tmparr.length; jj++){
			ratesArr[jj]=ratesArr[jj]/100;
			document.ResSearchForm.totalBookingComn.value=ratesArr[jj].toFixed(2);
		}
		tmparr.length=0;
	}
	function chkBrdTypes(htCount){
	var totHTTypes=parseInt(document.ResSearchForm.elements["HT"+(parseInt(htCount)+1)+"_totTypes"].value);
	var tmp_hidBRDType="__";
		for (var kfg=1; kfg<=totHTTypes; kfg++){
		var typeTotRadios=Number(document.forms["ResSearchForm"].elements["HT"+(parseInt(htCount)+1)+"_Type"+kfg+"Radios"].value)
		var moreShowed=eval("show_HT"+(parseInt(htCount)+1)+"");
			if (!moreShowed || typeTotRadios==1){
			if (tmp_hidBRDType=="__"){
				tmp_hidBRDType=document.ResSearchForm.elements["hid_brdtypeHT"+(parseInt(htCount)+1)+"_RT"+kfg+""].value;
				break;
			}else if (document.ResSearchForm.elements["hid_brdtypeHT"+(parseInt(htCount)+1)+"_RT"+kfg+""].value!=tmp_hidBRDType){
				return false;
			}
			
			}else{
				for (var kfg1=0; kfg1<typeTotRadios; kfg1++){
					if (document.forms["ResSearchForm"].elements["HT"+(parseInt(htCount)+1)+"_RT"+kfg+""][kfg1].checked){
						if (tmp_hidBRDType=="__"){
							tmp_hidBRDType=document.ResSearchForm.elements["hid_brdtypeHT"+(parseInt(htCount)+1)+"_RT"+kfg+""][kfg1].value;
							break;
						}else if (document.ResSearchForm.elements["hid_brdtypeHT"+(parseInt(htCount)+1)+"_RT"+kfg+""][kfg1].value!=tmp_hidBRDType){
							return false;
						}
					}
				}			
			}
		}
	return true;
	}
	
	function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = ""+name + "=" + escape(value)+"";
	document.cookie = curCookie;
	}
	
	function getSelRadios(cnt){
	var H_totTypes=document.ResSearchForm.elements["HT"+cnt+"_totTypes"].value;
	var selString="";
	var showMore="";
	for (var kfg2=1; kfg2<=H_totTypes; kfg2++){
		var typeTotRadios=Number(document.forms["ResSearchForm"].elements["HT"+cnt+"_Type"+kfg2+"Radios"].value);
		if (kfg2!=1){selString+="#"+typeTotRadios+"";}else{selString+=""+typeTotRadios+"";}
		for (var kfg3=0; kfg3<typeTotRadios; kfg3++){
			if (document.forms["ResSearchForm"].elements["HT"+cnt+"_RT"+kfg2+""][kfg3].checked){
			if (showMore=="" && kfg3!=0){showMore=true;}
			selString+="@true";
			}else{
			selString+="@false";
			}
		}
	}
		if (showMore){
			return "HT"+cnt+"|"+selString+"";
		}else{
			return "-";
		}
	}
	
	var scrform="ResHotelsSearchForm";
var nav				= navigator.appName;

var WeekDays		= new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var FORM="";var INM="";var IND="";var INY="";var OUTM="";var OUTD="";var OUTY="";var NON="";

function Init(frm,inm,ind,iny,outm,outd,outy,non){
FORM=frm;INM=inm;IND=ind;INY=iny;OUTM=outm;OUTD=outd;OUTY=outy;NON=non;
}

function setMonthDays(objname,mm,yy){
	with (document.forms[FORM]){
		currIndex=elements[objname].selectedIndex;
		
		elements[objname].options.length=0;
		for (a=1; a<=getMaxDays(mm,yy); a++){
		elements[objname].options[a-1] = (a<10)? new Option("0"+a+"","0"+a+"") : new Option(a,a)
		}
		if (elements[objname].options.length<(currIndex+1)){
		elements[objname].selectedIndex=elements[objname].options.length-1;
		}else{
		elements[objname].selectedIndex=currIndex;
		}
	}
}

function returnDay(val){
	iiy=document.forms[FORM].elements[eval(""+val+"Y")].options[document.forms[FORM].elements[eval(""+val+"Y")].selectedIndex].value;
	iim=Number(document.forms[FORM].elements[eval(""+val+"M")].options[document.forms[FORM].elements[eval(""+val+"M")].selectedIndex].value)-1;
	iid=document.forms[FORM].elements[eval(""+val+"D")].options[document.forms[FORM].elements[eval(""+val+"D")].selectedIndex].value;
	tmpDate1=new Date(iiy,iim,iid);
	return tmpDate1.getDay();
}


function retDay(dd,mm,yy){
tempOptDate= new Date(yy,mm,dd,0,0,0,0);
return WeekDays[tempOptDate.getDay()]

}

function getMaxDays(mm,yy){
mxCount=0;
	if (mm==1 && yy%4==0){
	mxCount=29; }else if (mm==1){
	mxCount=28; }else if (mm==0 || mm==2 || mm==4 || mm==6 || mm==7 || mm==9 || mm==11){
	mxCount=31;	}else{ mxCount=30;}
return mxCount;
}


function getDaysOfYear(yy){
	if (yy%4==0){
	return 366;
	}else{
	return 365;
	}
}

function setCheckOut(obj){
	with (document.forms[FORM]){
	if (obj.name.indexOf("Dt")==-1){
	
	setMonthDays(IND,Number(elements[INM].options[elements[INM].selectedIndex].value)-1,elements[INY].options[elements[INY].selectedIndex].value);
	}
	tempCheckIn = new Date(elements[INY].options[elements[INY].selectedIndex].value,Number(elements[INM].options[elements[INM].selectedIndex].value)-1,elements[IND].options[elements[IND].selectedIndex].value,0,0,0,0);
	tempCheckOut = new Date(tempCheckIn.setDate(tempCheckIn.getDate()+Number(elements[NON].options[elements[NON].selectedIndex].value)));
	elements[OUTY].selectedIndex = tempCheckOut.getFullYear()-InYear;
	elements[OUTM].selectedIndex = tempCheckOut.getMonth();
	setMonthDays(OUTD,tempCheckOut.getMonth(),tempCheckOut.getFullYear());
	elements[OUTD].selectedIndex = tempCheckOut.getDate()-1;
	}
	document.images["inday"].src="../../admin/images/dd"+returnDay('IN')+".gif";
	document.images["outday"].src="../../admin/images/dd"+returnDay('OUT')+".gif";
}

function setNights(obj){
	with (document.forms[FORM]){
	if (obj.name.indexOf("Dt")==-1){
		setMonthDays(OUTD,Number(elements[OUTM].options[elements[OUTM].selectedIndex].value)-1,elements[OUTY].options[elements[OUTY].selectedIndex].value);
	}
	inM=Number(elements[INM].options[elements[INM].selectedIndex].value)-1;
	inD=Number(elements[IND].options[elements[IND].selectedIndex].value);
	inY=Number(elements[INY].options[elements[INY].selectedIndex].value);
	outM=Number(elements[OUTM].options[elements[OUTM].selectedIndex].value)-1;
	outD=Number(elements[OUTD].options[elements[OUTD].selectedIndex].value);
	outY=Number(elements[OUTY].options[elements[OUTY].selectedIndex].value);
	noDays=countNoDays(inM,inD,inY,outM,outD,outY);
		if (noDays!=-1 && noDays<=elements[NON].options.length){
			elements[NON].selectedIndex=noDays-1;
		}
	}
	document.images["inday"].src="../../admin/images/dd"+returnDay('IN')+".gif";
	document.images["outday"].src="../../admin/images/dd"+returnDay('OUT')+".gif";
}

var mDataRetrieved=false;


var Form="ResSearchForm";
function doCalcs(){
gstlist=setGuestList();
document.forms[Form].gstLst.value=gstlist;
document.forms[Form].cmbAdlt.value=countTotal("cmbAdlt");
document.forms[Form].cmbChi.value=countTotal("cmbChi");
document.forms[Form].action="../reservation/ResSearchCriteria.do?ActionType=ResSearch&status=search&reqFrom=resSearch";   
document.forms[Form].submit();
}
function countTotal(val){
try{
noRooms=Number(document.ResSearchForm.cmbNoRm.options[document.ResSearchForm.cmbNoRm.selectedIndex].value);
tot=0;
for (pp=0; pp<noRooms; pp++){
tot+=Number(document.ResSearchForm.elements[""+val+"_R"+(pp+1)+""].options[document.ResSearchForm.elements[""+val+"_R"+(pp+1)+""].selectedIndex].value);
}
}catch(ex){tot=0;}
return tot;
}


function addRoomHeadings(value){
str_RoomHeadings="<table width=\"100%\" height=\""+(21*value)+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
for (var ak=0; ak<value; ak++){
str_RoomHeadings=str_RoomHeadings+"<tr>"+
"<td align=\"right\">Room&nbsp;"+(ak+1)+"&nbsp;</td>"+
"</tr>";
}
str_RoomHeadings=str_RoomHeadings+"</table>";
document.getElementById("roomNo_id").innerHTML=str_RoomHeadings;
}


function showHideAges(value,chis,child){

for (var lk=0; lk<child; lk++){
if (chis>lk){
	document.getElementById("ChiAgeR"+value+""+(lk+1)+"_id").style.display="block";
	document.getElementById("R"+value+"chihead"+(lk+1)+"").style.display="block";
}else{
	document.getElementById("ChiAgeR"+value+""+(lk+1)+"_id").style.display="none";
	document.getElementById("R"+value+"chihead"+(lk+1)+"").style.display="none";
}
}
//showHideHeadings();
}

function showHideHeadings(){
var m_rooms=Number(document.forms["ResSearchForm"].elements["cmbNoRm"].options[document.forms["ResSearchForm"].elements["cmbNoRm"].selectedIndex].value);
var maxChis=0; 
var tempChis=0;
for (var hj=0; hj<m_rooms; hj++){
tempChis=Number(document.forms["ResSearchForm"].elements["cmbChi_R"+(hj+1)+""].options[document.forms["ResSearchForm"].elements["cmbChi_R"+(hj+1)+""].selectedIndex].value);
if (tempChis>maxChis){
maxChis=tempChis;
}
}
for (var rt=0; rt<3; rt++){
if (maxChis>rt){
document.getElementById("chihead"+(rt+1)+"").style.display="block";
}else{
document.getElementById("chihead"+(rt+1)+"").style.display="none";
}
}
}

function ret_combo(name,chi_num){
tmsrt="";
tmsrt+="<span id=\""+name+""+chi_num+"_id\" style=\"display:none;padding-bottom:5px;\"><select name=\""+name+""+chi_num+"\" class=\"select\">";
for (kj=0; kj<17; kj++){
tmsrt+="<option value=\""+(kj+1)+"\">"+(kj+1)+"</option>";
}
tmsrt+="</select></span>";
return tmsrt;
} 

function searching(){
try{
document.getElementById("pageContent").style.display="none";
document.getElementById("preloadMsg").style.display="block";
}catch(ex){
}
}	

function doCalc(){

if(document.getElementById("test12")){

var cityData = document.forms[0].H_HotLocHid.value.split("|");

document.forms[Form].cmbCty.value=cityData[0];
document.forms[Form].ctyNm.value=cityData[1];
document.forms[Form].cmbSte.value=cityData[2];
document.forms[Form].cmbCtry.value=cityData[3];
}


gstlist=setGuestList();
document.forms[Form].gstLst.value=gstlist;
document.forms[Form].cmbAdlt.value=countTotal("cmbAdlt");
document.forms[Form].cmbChi.value=countTotal("cmbChi");

document.forms[Form].action="../reservation/ResSearchCriteria.do?ActionType=ResSearch&status=search&reqFrom=resSearch&searchAgain=Y";   
if(document.forms[Form].cityLookupHid.value=="" || document.forms[Form].cityLookupHid.value=="undefined"){
//document.forms[Form].cmbCty.value=document.forms["ResSearchForm"].cmbCty.value;
//document.forms[Form].ctyNm.value=cityData[3];
//document.forms[Form].cmbSte.value=cityData[5];
//document.forms[Form].cmbCtry.value=cityData[7];
}else{

var cityData=document.forms[Form].cityLookupHid.value.split("|");


/*if (brows.indexOf("Firefox")>-1){
document.forms[Form].cmbCty.value=cityData[1];
document.forms[Form].ctyNm.value=cityData[3];
document.forms[Form].cmbSte.value=cityData[5];
document.forms[Form].cmbCtry.value=cityData[7];
}else{
*/
document.forms[Form].cmbCty.value=cityData[0];
document.forms[Form].ctyNm.value=cityData[1];
document.forms[Form].cmbSte.value=cityData[2];
document.forms[Form].cmbCtry.value=cityData[3];
//}
}

if (resType=="web"){
document.forms[Form].elements["cmbInMn"].value=Number(document.forms[Form].elements["H_InMonth"].options[document.forms[Form].elements["H_InMonth"].selectedIndex].value)+1;
//alert(document.forms[Form].elements["cmbInMn"].value);
document.forms[Form].elements["cmbInDt"].value=document.forms[Form].elements["H_InDate"].options[document.forms[Form].elements["H_InDate"].selectedIndex].value;
document.forms[Form].elements["cmbInYr"].value=document.forms[Form].elements["H_InYear"].options[document.forms[Form].elements["H_InYear"].selectedIndex].value;
document.forms[Form].elements["cmbOutMn"].value=Number(document.forms[Form].elements["H_OutMonth"].options[document.forms[Form].elements["H_OutMonth"].selectedIndex].value)+1;
document.forms[Form].elements["cmbOutDt"].value=document.forms[Form].elements["H_OutDate"].options[document.forms[Form].elements["H_OutDate"].selectedIndex].value;
document.forms[Form].elements["cmbOutYr"].value=document.forms[Form].elements["H_OutYear"].options[document.forms[Form].elements["H_OutYear"].selectedIndex].value;
document.forms[Form].elements["cmbNgt"].value=document.forms[Form].elements["H_cmbNoOfNights"].options[document.forms[Form].elements["H_cmbNoOfNights"].selectedIndex].value;
//document.forms[Form].elements["hotelGroupId"].value=document.forms[Form].elements["H_HotelGroup"].options[document.forms[Form].elements["H_HotelGroup"].selectedIndex].value;
//document.forms[Form].elements["hotelStarId"].value=document.forms[Form].elements["H_HotelStar"].options[document.forms[Form].elements["H_HotelStar"].selectedIndex].value;

	// For the prease wait screen
	document.forms[0].cmbCtry_Hotels.value	= document.forms[Form].cmbCtry.value;
	document.forms[0].cmbInYr_Hotels.value	= document.forms[Form].elements["H_InYear"].options[document.forms[Form].elements["H_InYear"].selectedIndex].value;
	document.forms[0].cmbInMn_Hotels.value	= Number(document.forms[Form].elements["H_InMonth"].options[document.forms[Form].elements["H_InMonth"].selectedIndex].value)+1;
	document.forms[0].cmbInDt_Hotels.value	= document.forms[Form].elements["H_InDate"].options[document.forms[Form].elements["H_InDate"].selectedIndex].value;
	document.forms[0].cmbNgt_Hotels.value	= document.forms[Form].elements["H_cmbNoOfNights"].options[document.forms[Form].elements["H_cmbNoOfNights"].selectedIndex].value;
	document.forms[0].cmbOutYr_Hotels.value	= document.forms[Form].elements["H_OutYear"].options[document.forms[Form].elements["H_OutYear"].selectedIndex].value;
	document.forms[0].cmbOutMn_Hotels.value	= Number(document.forms[Form].elements["H_OutMonth"].options[document.forms[Form].elements["H_OutMonth"].selectedIndex].value)+1;
	document.forms[0].cmbOutDt_Hotels.value	= document.forms[Form].elements["H_OutDate"].options[document.forms[Form].elements["H_OutDate"].selectedIndex].value;
	document.forms[0].cmbNoRm_Hotels.value	= document.forms[0].elements["cmbNoRm"].value;
	document.forms[0].totRooms_Hotels.value	= document.forms[0].elements["cmbNoRm"].value;

if(Number(document.forms[Form].elements["cmbInMn"].value)<10){
	document.forms[Form].elements["cmbInMn"].value = "0"+document.forms[Form].elements["cmbInMn"].value;
}
if(Number(document.forms[Form].elements["cmbOutMn"].value)<10){
	document.forms[Form].elements["cmbOutMn"].value = "0"+document.forms[Form].elements["cmbOutMn"].value;
}

if(document.forms[Form].elements["accommodationType"].value=='HS'){
document.forms[Form].elements["cmbAdlt"].value=document.forms[Form].elements["_cmbHostelNoOfAdults"].options[document.forms[Form].elements["_cmbHostelNoOfAdults"].selectedIndex].value;
var noOfadults=document.forms[Form].elements["cmbAdlt"].value;
var guestList="";
for(x=0;x<noOfadults;x++ ){
guestList=guestList+"1|0|0|%|%@";
}
document.forms[Form].gstLst.value=guestList;
}

}

searching();
showPreload('pageContent','H');
document.forms[Form].submit();

}





function presearch(){

gstlist=setGuestList();
document.forms[Form].gstLst.value=gstlist;
document.forms[Form].cmbAdlt.value=document.forms[Form].elements["H_cmbNoOfAdults_R"].options[document.forms[Form].elements["H_cmbNoOfAdults_R"].selectedIndex].value;
document.forms[Form].cmbChi.value=1;
document.forms[Form].action="../reservation/ResSearchCriteria.do?ActionType=ResSearch&status=search&reqFrom=resSearch&searchAgain=Y";   
if(document.forms[Form].cityLookupHid.value=="" || document.forms[Form].cityLookupHid.value=="undefined"){
//document.forms[Form].cmbCty.value=document.forms["ResSearchForm"].cmbCty.value;
//document.forms[Form].ctyNm.value=cityData[3];
//document.forms[Form].cmbSte.value=cityData[5];
//document.forms[Form].cmbCtry.value=cityData[7];
}else{
var cityData=document.forms[Form].cityLookupHid.value.split("|");
/*if (brows.indexOf("Firefox")>-1){
document.forms[Form].cmbCty.value=cityData[1];
document.forms[Form].ctyNm.value=cityData[3];
document.forms[Form].cmbSte.value=cityData[5];
document.forms[Form].cmbCtry.value=cityData[7];
}else{
*/
document.forms[Form].cmbCty.value=cityData[0];
document.forms[Form].ctyNm.value=cityData[1];
document.forms[Form].cmbSte.value=cityData[2];
document.forms[Form].cmbCtry.value=cityData[3];
//}
}

if (resType=="web"){
document.forms[Form].elements["cmbInMn"].value=Number(document.forms[Form].elements["H_InMonth"].options[document.forms[Form].elements["H_InMonth"].selectedIndex].value)+1;
document.forms[Form].elements["cmbInDt"].value=document.forms[Form].elements["H_InDate"].options[document.forms[Form].elements["H_InDate"].selectedIndex].value;
document.forms[Form].elements["cmbInYr"].value=document.forms[Form].elements["H_InYear"].options[document.forms[Form].elements["H_InYear"].selectedIndex].value;
document.forms[Form].elements["cmbOutMn"].value=Number(document.forms[Form].elements["H_OutMonth"].options[document.forms[Form].elements["H_OutMonth"].selectedIndex].value)+1;
document.forms[Form].elements["cmbOutDt"].value=document.forms[Form].elements["H_OutDate"].options[document.forms[Form].elements["H_OutDate"].selectedIndex].value;
document.forms[Form].elements["cmbOutYr"].value=document.forms[Form].elements["H_OutYear"].options[document.forms[Form].elements["H_OutYear"].selectedIndex].value;
//alert(document.forms[Form].elements["H_HotelGroup"].options[document.forms[Form].elements["H_HotelGroup"].selectedIndex].value);
//document.forms[Form].elements["hotelGroupId"].value=document.forms[Form].elements["H_HotelGroup"].options[document.forms[Form].elements["H_HotelGroup"].selectedIndex].value;
//document.forms[Form].elements["hotelStarId"].value=document.forms[Form].elements["H_HotelStar"].options[document.forms[Form].elements["H_HotelStar"].selectedIndex].value;

document.forms[Form].elements["cmbNgt"].value=document.forms[Form].elements["H_cmbNoOfNights"].options[document.forms[Form].elements["H_cmbNoOfNights"].selectedIndex].value;
}
document.forms[Form].submit();
searching();
}


function setGuestList(){
try{
noRooms=Number(document.ResSearchForm.cmbNoRm.options[document.ResSearchForm.cmbNoRm.selectedIndex].value);
guestSrt="";
for (var kk=0; kk<noRooms; kk++){
tmpAdults=Number(document.ResSearchForm.elements["cmbAdlt_R"+(kk+1)+""].options[document.ResSearchForm.elements["cmbAdlt_R"+(kk+1)+""].selectedIndex].value);
tmpChilds=Number(document.ResSearchForm.elements["cmbChi_R"+(kk+1)+""].options[document.ResSearchForm.elements["cmbChi_R"+(kk+1)+""].selectedIndex].value);
guestSrt=guestSrt+tmpAdults+"|"+tmpChilds+"|";
var nochis=Number(document.ResSearchForm.elements["cmbChi_R"+(kk+1)+""].options[document.ResSearchForm.elements["cmbChi_R"+(kk+1)+""].selectedIndex].value);
ag_str="";
if (nochis!=0){
for (var jj=0; jj<nochis; jj++){
if (jj!=0){ag_str+=",";}
ag_str+=Number(document.ResSearchForm.elements["ChiAgeR"+(kk+1)+""+(jj+1)+""].options[document.ResSearchForm.elements["ChiAgeR"+(kk+1)+""+(jj+1)+""].selectedIndex].value);
}
}else{
guestSrt=guestSrt+"-";
}
guestSrt=guestSrt+ag_str+"|%|%@";
}
}catch(ex){
guestSrt="";
}
return guestSrt;
}

function showHideRows(val,room,child){
for (var fe=0; fe<room; fe++){ 
if (fe<val){
showHideAges((fe+1),Number(document.ResSearchForm.elements["cmbChi_R"+(fe+1)+""].options[document.ResSearchForm.elements["cmbChi_R"+(fe+1)+""].selectedIndex].value),child);
document.getElementById("roomHead"+(fe+1)+"").style.display="block";
document.getElementById("idcmbAdlt_R"+(fe+1)+"").style.display="block";
document.getElementById("idcmbChi_R"+(fe+1)+"").style.display="block";
}else{
document.getElementById("roomHead"+(fe+1)+"").style.display="none";
document.getElementById("idcmbAdlt_R"+(fe+1)+"").style.display="none";
document.getElementById("idcmbChi_R"+(fe+1)+"").style.display="none";
showHideAges((fe+1),0,0); 
}
}
//showHideHeadings();
} 

function chkagRoom(nochis,ag_str){
var tmp_arr=ag_str.split(",");
if (tmp_arr.length!=nochis){
return false;
}
for (var gh=0; gh<tmp_arr.length; gh++){
if (isNaN(tmp_arr[gh])){
return false;
}
}
return true;
}	
function ldHot(passStr){
	 	var arr= passStr.split("~");
	 	var hotelCode = arr[2];
	 	var ridecode = arr[1];
	 	var invid    = arr[0];
	 	var accommodationType=	arr[3]; 	
		var tempUrl ='/hotelpage/HotelPage.do?T=1&hotelId=' ;
		if (arr.length == 5)
	 	{
	 	tempUrl = arr[4];
	 	}
	 	if(!(ridecode==""||invid==""||ridecode=="-"||invid=="-")){
		 	var myUrl=""+tempUrl+""+hotelCode+"&&rideCode="+ridecode+"&vendorId="+invid+"&hotelId="+hotelCode+"&accommodationType="+accommodationType+"";
		 	//var myUrl="../hotelpage/HotelPage.do?T=1&&rideCode="+ridecode+"&vendorId="+invid+"&hotelId="+hotelCode+"&accommodationType="+accommodationType+"";
		 	window.open(myUrl);
	 	}
}
function calcTotalSingle(code,state,curfor){
//alert(curfor);
	valComn=0;
	var ratesArr=new Array();
	totTypes=Number(document.forms["ResSearchForm"].elements[""+code+"_totTypes"].value)
	for (var jj=0; jj<totTypes; jj++){
		ratesArr[jj]=0;
	}
	for (jj=1; jj<=totTypes; jj++){
	
	totcombos=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jj+"Radios"].value)
	if (state=="init"){
		try{
		tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
		}catch(err){
		tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][0].value.split("|");
		}
		for (var ii=0; ii<tmparr.length; ii++){
			ratesArr[ii]=ratesArr[ii]+(parseFloat(tmparr[ii])*100);
		}
		
	}else{
		if (totcombos==1){
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].value.split("|");
			for (var ii=0; ii<tmparr.length; ii++){
				ratesArr[ii]=ratesArr[ii]+(parseFloat(tmparr[ii])*100);
			}
		}else{
			for (kk=0; kk<totcombos; kk++){
				if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].checked){
				tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].value.split("|");
				
				for (var ii=0; ii<tmparr.length; ii++){
					ratesArr[ii]=ratesArr[ii]+(parseFloat(tmparr[ii])*100);
				}
				}	
			}
		}
	}
	}
		for (var jj=0; jj<tmparr.length; jj++){
			ratesArr[jj]=ratesArr[jj]/100;
			if (curfor==undefined){
			document.getElementById("rt"+(jj+1)+"_"+code+"").innerHTML="<b>"+ratesArr[jj].toFixed(2)+"</b>";
			}else{
			document.getElementById("rt"+(jj+1)+"_"+code+"").innerHTML="<b>"+curfor+"&nbsp;"+ratesArr[jj].toFixed(2)+"</b>";
			try{
				var pkgCost=parseFloat(eval("pkgHT"+(jj+1)+"Rate"));
				var totpkgCost=parseFloat(ratesArr[jj])+pkgCost;
				document.getElementById("fltrt"+(jj+1)+"_"+code+"").innerHTML="<b>"+curfor+"&nbsp;"+pkgCost.toFixed(2)+"</b>";
				document.getElementById("pkgrt"+(jj+1)+"_"+code+"").innerHTML="<b>"+curfor+"&nbsp;"+totpkgCost.toFixed(2)+"</b>";
			}catch(ex){
			}
			
			
			}
		}
		tmparr.length=0;
}	

function checkInventoryAgain(code){
	try{
		var rooms=Number(document.forms["ResSearchForm"].elements[""+code+"_totTypes"].value)
		var hotelIndex=code.split("HT")[1] - 1;
		
		var msgSpan = document.getElementById("onReq_"+code+"");
		var roomCodeArr = new Array();
		var selectedRoomArr = new Array();
		var arrayIndex = 0;
		var noInventory = false;
		var RQHotel = false;
		var CALHotel = false;
		var totRoomTypes = 0;
		
		for (jj=1; jj<=rooms; jj++){
			var roomTypes=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jj+"Radios"].value)
			var actualRoomTypes = roomTypes;
			if (roomTypes>1){
				for (kk=0; kk<roomTypes; kk++){
					var elementChecked = false;
					var expanded = false;
					
					if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].checked == null){
						elementChecked = document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""][kk].checked;
						expanded = true;
					}else{
						elementChecked = document.forms["ResSearchForm"].elements[""+code+"_RT"+jj+""].checked;						
					}
					if (elementChecked){
						var selectedRoom = eval("obR"+hotelIndex+totRoomTypes);
						
						var found = false;
						for (i=0; i<selectedRoomArr.length; i++){							
							if (matchRooms(selectedRoom.roomKey,selectedRoomArr[i].roomKey,selectedRoom.inventoryObtainedBy)){
								found = true;
								selectedRoomArr[i].inventory--;
								break;
							}
						}
											    
						if (!found){
							if (selectedRoom.rBtype == "CON"){
								selectedRoomArr[arrayIndex++] = new oRm(selectedRoom.rCd, selectedRoom.rBtype, selectedRoom.inventory - 1, selectedRoom.inventoryExhausted, selectedRoom.inventoryObtainedBy, selectedRoom.roomKey);
							}else{
								if (selectedRoom.rBtype == "REQ"){
									RQHotel = true;
									break;
								}else if (selectedRoom.rBtype == "CAL"){
									CALHotel = true;
									break;
								}
							}
						}
					}
					if (!expanded){
						totRoomTypes = totRoomTypes+actualRoomTypes;
						roomTypes = 1;
					}else{
						totRoomTypes++;
					}
				}
			}else{
				return;
			}
			if (RQHotel || CALHotel) break;
		}
		
		if (RQHotel){
			msgSpan.innerHTML = "On Request";
			msgSpan.style.display = "";
		}else if (CALHotel){
			msgSpan.innerHTML = "";
			msgSpan.style.display = "none";
		}else{
			var addNowButton = document.getElementById("addNow_"+hotelIndex);
			var bookNowButton = document.getElementById("bookNow_"+hotelIndex);
		
			var CL = NO = RQ = false;
			var minQty = 0;
			var str = "";
			for (i=0; i<selectedRoomArr.length; i++){	
				//str = str + "inventory="+selectedRoomArr[i].inventory + ":" + selectedRoomArr[i].inventoryExhausted + ";";
				if (selectedRoomArr[i].inventory < minQty){
					switch (selectedRoomArr[i].inventoryExhausted){
						case 'CL': 	CL = true;
		            				break;
						case 'CO': 	//CO = true;
		            				break;
						case 'FS': 	//FS = true;
		            				break;
						case 'NO': 	NO = true;
		            				break;
						case 'RQ': 	RQ = true;
		            				break;
		  				default: 
					}
				}
			}
			if(NO){
				msgSpan.innerHTML = str + noRoomsMsg;
				msgSpan.style.display = "";
				addNowButton.style.display = "none";
				bookNowButton.style.display = "none";
			}else if (RQ){
				msgSpan.innerHTML = str + onRequestMsg;
				msgSpan.style.display = "";
				addNowButton.style.display = "";
				bookNowButton.style.display = "";
			}else if(CL){
				msgSpan.innerHTML = str + callToBookMsg;
				msgSpan.style.display = "";
				addNowButton.style.display = "none";
				bookNowButton.style.display = "none";
			}else{
				msgSpan.innerHTML = "";
				msgSpan.style.display = "none";
				addNowButton.style.display = "";
				bookNowButton.style.display = "";
			}
		}
	}catch(e){
		//alert("checkInventoryAgain(code) Error --> " + e);
	}
}	

function matchRooms(code1,code2,invObtainedBy){
	var code1Arr = code1.split("_");
	var code2Arr = code2.split("_");
	switch (invObtainedBy){
		case 'H': 	return code1Arr[0]==code2Arr[0];
					break;
		case 'R': 	return code1Arr[0]+"_"+code1Arr[1]==code2Arr[0]+"_"+code2Arr[1];
					break;
		case 'B': 	return code1Arr[0]+"_"+code1Arr[1]+"_"+code1Arr[2]==code2Arr[0]+"_"+code2Arr[1]+"_"+code2Arr[2];
					break;
		default :	return code1Arr[0]+"_"+code1Arr[1]+"_"+code1Arr[2]==code2Arr[0]+"_"+code2Arr[1]+"_"+code2Arr[2];
					break;
	}
}

function calcTotlasOnSubmit(code,state,curType){
	valgbp=0;valusd=0;valeur=0;valComn=0;
	var ratesArr=new Array();
	totTypes=Number(document.forms["ResSearchForm"].elements[""+code+"_totTypes"].value)
	for (var jj=0; jj<totTypes; jj++){
		ratesArr[jj]=0;
		
	}
	if(curType=='multiple'){
		for (var jjk=1; jjk<=totTypes; jjk++){
			totcombos=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jjk+"Radios"].value)
		if (state=="init"){
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjk+""].value.split("|");
			for (var jj=0; jj<tmparr.length; jj++){
				ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
			}
		}else{
			if (totcombos==1){
				tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjk+""].value.split("|");
				for (var jj=0; jj<tmparr.length; jj++){
					ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
				}
			}else{
				for (kk=0; kk<totcombos; kk++){
					if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jjk+""][kk].checked){
						tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjk+""][kk].value.split("|");
						for (var jj=0; jj<tmparr.length; jj++){
							ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[jj])*100);
						}
					}	
				}
				}
			}
		} //for
		
		document.ResSearchForm.totalBookingGbp.value=ratesArr[0]/100;
		document.ResSearchForm.totalBookingUsd.value=ratesArr[1]/100;
		document.ResSearchForm.totalBookingEur.value=ratesArr[2]/100;
			
		tmparr.length=0;
	}else{
		for (var jjj=1; jjj<=totTypes; jjj++){
			totcombos=Number(document.forms["ResSearchForm"].elements[""+code+"_Type"+jjj+"Radios"].value)
		//for (var jj=0; jj<totcombos; jj++){
		//	ratesArr[jj]=0;
		//}
		if (state=="init"){
		try{
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjj+""].value.split("|");
		}catch(err){
		    tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjj+""][0].value.split("|");
		}
		
		valComn=valComn+(parseFloat(tmparr[0])*100);	
		for (var jj=0; jj<tmparr.length; jj++){
			ratesArr[jj]= ratesArr[jj]+(parseFloat(tmparr[jj])*100);
		}
		}else{
			if (totcombos==1){
			tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjj+""].value.split("|");
			for (var jj=0; jj<tmparr.length; jj++){
				ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[0])*100);
			}
			}else{
				for (var kk=0; kk<totcombos; kk++){
					if (document.forms["ResSearchForm"].elements[""+code+"_RT"+jjj+""][kk].checked){
					tmparr=document.forms["ResSearchForm"].elements[""+code+"_RT"+jjj+""][kk].value.split("|");
						for (var jj=0; jj<tmparr.length; jj++){
							ratesArr[jj]=ratesArr[jj]+(parseFloat(tmparr[0])*100);
						}
					}	
				}
			}
		} 
	}
	var rate = 0;
		for (var jj=0; jj<tmparr.length; jj++){
		    rate = rate + ratesArr[jj]/100;
			document.ResSearchForm.totalBookingComn.value=rate;
		}
		tmparr.length=0;
		}//else multiple
}

function bookNow_hotel(objH,htCount,rmCount,totRm,resort,code,curType){

		
		initializeForm(objH,htCount,rmCount,totRm,resort,code,curType);
		calcTotlasOnSubmit(code,'init',curType);
		document.ResSearchForm.actionTyp.value="addtoCartpkg";
		document.ResSearchForm.action="../reservation/ResSearchAction.do?actionTyp=addtoCartpkg";
		//alert("actionTyp ----->"+document.ResSearchForm.actionTyp.value);
		document.ResSearchForm.submit();
}

function bookNow_Web(objH,htCount,rmCount,totRm,resort,code,curType){
		initializeForm(objH,htCount,rmCount,totRm,resort,code,curType);
		document.ResSearchForm.actionTyp.value="addToCartAndProceed";
		document.ResSearchForm.submit();
}


function bookNow(objH,htCount,rmCount,totRm,resort,code,curType){
		/*if (!chkBrdTypes(htCount)){
		document.getElementById("msg_HT"+(parseInt(htCount)+1)+"").innerHTML="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"+
		"<tr>"+
		"<td class=\"txtorange\" align=\"center\"><b>Can't Select Different Board Types. Please Select Again</b></td>"+
		"</tr>"+
		"</table>";
		setTimeout("hideMsg('msg_HT"+(parseInt(htCount)+1)+"')","5000");
		return;
		}*/
		initializeForm(objH,htCount,rmCount,totRm,resort,code,curType);
		
	//	document.ResSearchForm.bookType.value="CON";
	
		// commented to fix the issue - when you have more than 1 room combinatin subtotal is talking 1st one always...
		//calcTotlasOnSubmit(code,'init',curType);
		
		
		document.ResSearchForm.actionTyp.value="addToCartAndProceed";
//		if (host.indexOf("192.168.1.81:8080")>-1){
//		document.ResSearchForm.action="http://"+host+"/rezbase/hotels/reservation/ResSearchAction.do?actionTyp=bookSingle";
//		document.ResSearchForm.action="http://"+host+"/../hotels/reservation/ResSearchAction.do?actionTyp=bookSingle";
		
//		}else{
		document.ResSearchForm.action="../reservation/ResSearchAction.do?actionTyp=addToCartAndProceed";
		
//		}

		/*if (eval("_mrTrueHT"+(parseInt(htCount)+1)+"") && eval("show_HT"+(parseInt(htCount)+1)+"")){
			document.ResSearchForm.sel_hid_hotel.value=getSelRadios(parseInt(htCount)+1);
			var cok_now = new Date();
			cok_now.setTime(cok_now.getTime()+1000);
			setCookie("SelHidHotel",""+document.ResSearchForm.sel_hid_hotel.value+"@END@", cok_now);
		}*/
		
		document.ResSearchForm.submit();
		
		//window.location="../reservation/BookingDetailsPage.do";	
}

function addNow(objH,htCount,rmCount,totRm,resort,code,curType){
		/*if (!chkBrdTypes(htCount)){
		document.getElementById("msg_HT"+(parseInt(htCount)+1)+"").innerHTML="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"+
		"<tr>"+
		"<td class=\"txtorange\" align=\"center\"><b>Can't Select Different Board Types. Please Select Again</b></td>"+
		"</tr>"+
		"</table>";
		setTimeout("hideMsg('msg_HT"+(parseInt(htCount)+1)+"')","5000");
		return;
		}*/

		initializeForm(objH,htCount,rmCount,totRm,resort,code,curType);
		document.ResSearchForm.actionTyp.value="addtoCart";

		//if (host.indexOf("192.168.1.81:8080")>-1){
		document.ResSearchForm.action="../reservation/ResSearchAction.do?actionTyp=addtoCart&index="+htCount+"";
		//}else{
		//document.ResSearchForm.action="http://"+host+"/"+portalName+"/hotels/reservation/ResSearchAction.do?actionTyp=addtoCart&index="+htCount+"";
		//}
		/*if (eval("_mrTrueHT"+(parseInt(htCount)+1)+"") && eval("show_HT"+(parseInt(htCount)+1)+"")){
			document.ResSearchForm.sel_hid_hotel.value=getSelRadios(parseInt(htCount)+1);
			var cok_now = new Date();
			cok_now.setTime(cok_now.getTime()+1000);
			setCookie("SelHidHotel",""+document.ResSearchForm.sel_hid_hotel.value+"@END@", cok_now);
		}*/
		if (resType=="web"){
		document.forms[Form].elements["cmbInMn"].value=Number(document.forms[Form].elements["H_InMonth"].options[document.forms[Form].elements["H_InMonth"].selectedIndex].value)+1;
		document.forms[Form].elements["cmbInDt"].value=document.forms[Form].elements["H_InDate"].options[document.forms[Form].elements["H_InDate"].selectedIndex].value;
		document.forms[Form].elements["cmbInYr"].value=document.forms[Form].elements["H_InYear"].options[document.forms[Form].elements["H_InYear"].selectedIndex].value;
		document.forms[Form].elements["cmbOutMn"].value=Number(document.forms[Form].elements["H_OutMonth"].options[document.forms[Form].elements["H_OutMonth"].selectedIndex].value)+1;
		document.forms[Form].elements["cmbOutDt"].value=document.forms[Form].elements["H_OutDate"].options[document.forms[Form].elements["H_OutDate"].selectedIndex].value;
		document.forms[Form].elements["cmbOutYr"].value=document.forms[Form].elements["H_OutYear"].options[document.forms[Form].elements["H_OutYear"].selectedIndex].value;
		
		document.forms[Form].elements["cmbNgt"].value=document.forms[Form].elements["H_cmbNoOfNights"].options[document.forms[Form].elements["H_cmbNoOfNights"].selectedIndex].value;
		}
		document.ResSearchForm.submit();
		
		//window.location="../reservation/BookingDetailsPage.do";	
}
function searchSupplier(){
	document.ResSearchForm.actionTyp.value="supplierSearch";
	document.forms[Form].action="../reservation/ResSearchCriteria.do?ActionType=supplierSearch&status=search&reqFrom=resSearch";   
	document.forms[Form].submit();

}


function RemoveItem(htCount,hotelCode){
		//if (host.indexOf("192.168.1.81:8080")>-1){
		document.ResSearchForm.action="../reservation/ResSearchAction.do?actionTyp=removeItem";
		//}else{
		//document.ResSearchForm.action="http://"+host+"/"+portalName+"/hotels/reservation/ResSearchAction.do?actionTyp=removeItem";
		//}
		document.ResSearchForm.index.value=""+htCount+"";
		if (resType=="web"){
		document.forms[Form].elements["cmbInMn"].value=Number(document.forms[Form].elements["H_InMonth"].options[document.forms[Form].elements["H_InMonth"].selectedIndex].value)+1;
		document.forms[Form].elements["cmbInDt"].value=document.forms[Form].elements["H_InDate"].options[document.forms[Form].elements["H_InDate"].selectedIndex].value;
		document.forms[Form].elements["cmbInYr"].value=document.forms[Form].elements["H_InYear"].options[document.forms[Form].elements["H_InYear"].selectedIndex].value;
		document.forms[Form].elements["cmbOutMn"].value=Number(document.forms[Form].elements["H_OutMonth"].options[document.forms[Form].elements["H_OutMonth"].selectedIndex].value)+1;
		document.forms[Form].elements["cmbOutDt"].value=document.forms[Form].elements["H_OutDate"].options[document.forms[Form].elements["H_OutDate"].selectedIndex].value;
		document.forms[Form].elements["cmbOutYr"].value=document.forms[Form].elements["H_OutYear"].options[document.forms[Form].elements["H_OutYear"].selectedIndex].value;
		
		document.forms[Form].elements["cmbNgt"].value=document.forms[Form].elements["H_cmbNoOfNights"].options[document.forms[Form].elements["H_cmbNoOfNights"].selectedIndex].value;
		}
		document.ResSearchForm.submit();
}

	function bookCardNow(){
		//if (host.indexOf("192.168.1.81:8080")>-1){
		//document.ResSearchForm.action="http://"+host+"/"+portalName+"/hotels/reservation/ResSearchAction.do?actionTyp=bookCart";
		//}else{
		document.ResSearchForm.action="../reservation/ResSearchAction.do?actionTyp=bookCart";
		//}
		if (resType=="web"){
		document.forms[Form].elements["cmbInMn"].value=Number(document.forms[Form].elements["H_InMonth"].options[document.forms[Form].elements["H_InMonth"].selectedIndex].value)+1;
		document.forms[Form].elements["cmbInDt"].value=document.forms[Form].elements["H_InDate"].options[document.forms[Form].elements["H_InDate"].selectedIndex].value;
		document.forms[Form].elements["cmbInYr"].value=document.forms[Form].elements["H_InYear"].options[document.forms[Form].elements["H_InYear"].selectedIndex].value;
		document.forms[Form].elements["cmbOutMn"].value=Number(document.forms[Form].elements["H_OutMonth"].options[document.forms[Form].elements["H_OutMonth"].selectedIndex].value)+1;
		document.forms[Form].elements["cmbOutDt"].value=document.forms[Form].elements["H_OutDate"].options[document.forms[Form].elements["H_OutDate"].selectedIndex].value;
		document.forms[Form].elements["cmbOutYr"].value=document.forms[Form].elements["H_OutYear"].options[document.forms[Form].elements["H_OutYear"].selectedIndex].value;
		
		document.forms[Form].elements["cmbNgt"].value=document.forms[Form].elements["H_cmbNoOfNights"].options[document.forms[Form].elements["H_cmbNoOfNights"].selectedIndex].value;
		}
		document.ResSearchForm.submit();
}


// modification functions

function changRtplaneAdd(Btyp,vale,side){
var rmTy;
var ratePlane;
var rmTyp = document.forms[0].elements["sel_Rmtype_R1["+side+"]"].options[document.forms[0].elements["sel_Rmtype_R1["+side+"]"].selectedIndex].value;

//alert(rmTyp);
	if (Btyp>0){
	document.forms[scrform].elements["sel_RTtype_R1["+side+"]"].length=0;
	document.forms[0].elements["sel_RTtype_R1["+side+"]"].options[document.forms[0].elements["sel_RTtype_R1["+side+"]"].length]=new Option("Select Rate Plan","%");
	for (i=0;i<arRmBdRateTyp.length;i++){
		tempTye = arRmBdRateTyp[i].split("|");
			if (vale==tempTye[1] && rmTyp ==tempTye[0]){
			ratePlane = tempTye[2];
			for (d=0;d<arRateTyp.length;d++){
				if (ratePlane == arRateTyp[d][0]){
					//alert(document.forms[0].elements["cmbBDT_R"+sid].options[t].value);
					//if (document.forms[0].elements["cmbTRP_R"+side].options[z].value != arRateTyp[d][0]){
						document.forms[0].elements["sel_RTtype_R1["+side+"]"].options[document.forms[0].elements["sel_RTtype_R1["+side+"]"].length]=new Option(arRateTyp[d][1],arRateTyp[d][0]);
						//z++;
					//}
					
				}
				
			}	

		}	
			
	}
			
}
}



		function changeRate(isChecked,suppId,rateBased,mandatery,isBooked){
		//alert('isChecked -'+isChecked)
			var chkcode="chk_"+suppId+"";
			if(mandatery=="Y"){
				document.forms[0].elements[chkcode].checked="checked";
			}else{
			document.forms[0].action = "../reservation/ReservationModificationTravelParty.do?modificationType=travelparty&ActionType=calculateRates&isBooked="+isBooked+"&isChecked="+isChecked+"&suppId="+suppId+"";
			 document.forms[0].submit();
			}
		}
		
		
		
		function changRtplane(Btyp,vale,side){
var rmTy;
var ratePlane;
var rmTyp = document.forms[0].elements["cmbRT_R"+side].options[document.forms[0].elements["cmbRT_R"+side].selectedIndex].value;
//alert(rmTyp);
	if (Btyp>0){
	document.forms[scrform].elements["cmbTRP_R"+side].length=1;
	for (i=0;i<arRmBdRateTyp.length;i++){
		tempTye = arRmBdRateTyp[i].split("|");
			if (vale==tempTye[1] && rmTyp ==tempTye[0]){
			ratePlane = tempTye[2];
			for (d=0;d<arRateTyp.length;d++){
				if (ratePlane == arRateTyp[d][0]){
					//alert(document.forms[0].elements["cmbBDT_R"+sid].options[t].value);
					//if (document.forms[0].elements["cmbTRP_R"+side].options[z].value != arRateTyp[d][0]){
						document.forms[0].elements["cmbTRP_R"+side].options[document.forms[0].elements["cmbTRP_R"+side].length]=new Option(arRateTyp[d][1],arRateTyp[d][0]);
						//z++;
					//}
					
				}
				
			}	

		}	
			
	}
			
}
}




function changBedtypeAdd(typ,val,sid){
var rmTy;
var bdTy;
t= 0;
//alert(sid+";"+typ+";"+val);
document.forms[scrform].elements["sel_Bdtype_R1["+sid+"]"].length=0;
document.forms[0].elements["sel_Bdtype_R1["+sid+"]"].options[document.forms[0].elements["sel_Bdtype_R1["+sid+"]"].length]=new Option("Select Bed Type","%");
	if (typ>0){
	
	for (i=0;i<arRmBdRateTyp.length;i++){
		tempTy = arRmBdRateTyp[i].split("|");
		if (val==tempTy[0]){
			bdTy = tempTy[1];
			//alert(bdTy)
			for (c=0;c<arBdTyp.length;c++){
				if (bdTy == arBdTyp[c][0]){
				//alert(bdTy+";"+arBdTyp[c][0])
				//alert(document.forms[0].elements["sel_Bdtype_R1["+sid+"]"].options[t].value);
					if (document.forms[0].elements["sel_Bdtype_R1["+sid+"]"].options[t].value != arBdTyp[c][0]){
						document.forms[0].elements["sel_Bdtype_R1["+sid+"]"].options[document.forms[0].elements["sel_Bdtype_R1["+sid+"]"].length]=new Option(arBdTyp[c][1],arBdTyp[c][0]);
						t++;
						//alert(t)
					}
					
				}
				
			}	

		}	
			  
	}
			
}
}

function changBedtype(typ,val,sid){
var rmTy;
var bdTy;
t= 0;
	if (typ>0){
	document.forms[scrform].elements["cmbBDT_R"+sid].length=1;
	for (i=0;i<arRmBdRateTyp.length;i++){
		tempTy = arRmBdRateTyp[i].split("|");
		//alert(val)
			if (val==tempTy[0]){
			bdTy = tempTy[1];
			for (c=0;c<arBdTyp.length;c++){
				if (bdTy == arBdTyp[c][0]){
					//alert(document.forms[0].elements["cmbBDT_R"+sid].options[t].value);
					if (document.forms[0].elements["cmbBDT_R"+sid].options[t].value != arBdTyp[c][0]){
						document.forms[0].elements["cmbBDT_R"+sid].options[document.forms[0].elements["cmbBDT_R"+sid].length]=new Option(arBdTyp[c][1],arBdTyp[c][0]);
						t++;
					}
					
				}
				
			}	

		}	
			
	}
			
}
}


function showAddFilters(val){
	if (val){
	try{
	document.getElementById("addFilters").style.display="block";
	}catch(ex){}
	}else{
	try{
	document.getElementById("addFilters").style.display="none";
	}catch(ex){}
		with (document.forms[0]){
			try{elements["hotelGroupId"].value="ALL";}catch(ex){}
			try{elements["hotelStarId"].value="ALL";}catch(ex){}
			try{elements["hotelLocationId"].value="ALL";}catch(ex){}
			try{elements["hotelAttractionId"].value="ALL";}catch(ex){}
			try{elements["hotelTypeId"].value="ALL";}catch(ex){}
			
			try{elements["hLocation"].selectedIndex=0;}catch(ex){}
			try{elements["hGroup"].selectedIndex=0;}catch(ex){}
			try{elements["hstarCat"].selectedIndex=0;}catch(ex){}
			try{elements["hAtt"].selectedIndex=0;}catch(ex){}
			try{elements["hType"].selectedIndex=0;}catch(ex){}
			
		}
	}
}

function loadFilters(){
try{
with(document.forms[0]){
	try{elements["hLocation"].options.length=0;}catch(ex){}
	for (var jj=-1; jj<hlocArr.length; jj++){
		if (jj==-1){
			try{elements["hLocation"].options[0]=new Option('Select All','ALL');}catch(ex){}
		}else{
			try{elements["hLocation"].options[elements["hLocation"].options.length]= new Option(hlocArr[jj][1],hlocArr[jj][0]);}catch(ex){}
		}
	}
	try{elements["hLocation"].options[0].selected=true;}catch(ex){}
		
	try{elements["hGroup"].options.length=0;}catch(ex){}
	for (var jj=-1; jj<hgrpArr.length; jj++){
		if (jj==-1){
			try{elements["hGroup"].options[0]=new Option('Select All','ALL');}catch(ex){}
		}else{
			try{elements["hGroup"].options[elements["hGroup"].options.length]= new Option(hgrpArr[jj][1],hgrpArr[jj][0]);}catch(ex){}
		}
	}
	try{elements["hGroup"].options[0].selected=true;}catch(ex){}
		
	try{elements["hstarCat"].options.length=0;}catch(ex){}
	for (var jj=-1; jj<starArr.length; jj++){
	if (jj==-1){
		try{elements["hstarCat"].options[0]=new Option('Select All','ALL');}catch(ex){}
	}else{
		try{
			if(starArr[jj][1].indexOf(".5")==-1){
				elements["hstarCat"].options[elements["hstarCat"].options.length]= new Option(starArr[jj][1],starArr[jj][0]);
			}
		}catch(ex){}
	}
	}
	try{elements["hstarCat"].options[0].selected=true;}catch(ex){}
	
	
	try{elements["hAtt"].options.length=0;}catch(ex){}
	for (var jj=-1; jj<attArr.length; jj++){
	if (jj==-1){
		try{elements["hAtt"].options[0]=new Option('Select All','ALL');}catch(ex){}
	}else{
		try{elements["hAtt"].options[elements["hAtt"].options.length]= new Option(attArr[jj][1],attArr[jj][0]);}catch(ex){}
	}
	}
	try{elements["hAtt"].options[0].selected=true;}catch(ex){}
	
	try{elements["hType"].options.length=0;}catch(ex){}
	for (var jj=-1; jj<hottypeArr.length; jj++){
	if (jj==-1){
		try{elements["hType"].options[0]=new Option('Select All','ALL');}catch(ex){}
	}else{
		try{elements["hType"].options[elements["hType"].options.length]= new Option(hottypeArr[jj][1],hottypeArr[jj][0]);}catch(ex){}
	}
	}
	try{elements["hType"].options[0].selected=true;}catch(ex){}
	
}	
}catch(ex){}	

}


function setFilter(val,objnm){
	document.forms[0].elements[objnm].value=val;
	if(objnm == "hotelAttractionId"){
		//alert(document.forms[0].elements[objnm].value.toUpperCase());
		if(document.forms[0].elements[objnm].value.toUpperCase() != "ALL"){
			try{
				document.getElementById("distanceId").style.display="inline";
			}catch(ex){}
		}else {
			try{
				document.getElementById("distanceId").style.display="none";
			}catch(ex){}
		}
	}
}


function showHideRowsHotels(val,rooms,child){ 
//alert(val+" "+rooms+" "+child)
for (var fe=0; fe<rooms; fe++){       
if (fe<val){   
showHideAgesHotels((fe+1),Number(document.ResSearchForm.elements["cmbChi_R"+(fe+1)+""].options[document.ResSearchForm.elements["cmbChi_R"+(fe+1)+""].selectedIndex].value),child);
document.getElementById("roomHead"+(fe+1)+"").style.display="block";
document.getElementById("idcmbAdlt_R"+(fe+1)+"").style.display="block";
document.getElementById("idcmbChi_R"+(fe+1)+"").style.display="block"; 
}else{ 
document.getElementById("roomHead"+(fe+1)+"").style.display="none";
document.getElementById("idcmbAdlt_R"+(fe+1)+"").style.display="none";
document.getElementById("idcmbChi_R"+(fe+1)+"").style.display="none";
showHideAgesHotels((fe+1),0,child);  
}
} 
//showHideHeadings();
}



function showHideAgesHotels(value,chis,child){
for (var lk=0; lk<child; lk++){    
if (chis>lk){ 
	document.getElementById("ChiAgeR"+value+""+(lk+1)+"_id").style.display="block";
	document.getElementById("R"+value+"chihead"+(lk+1)+"").style.display="block";
}else{
	document.getElementById("ChiAgeR"+value+""+(lk+1)+"_id").style.display="none";
	document.getElementById("R"+value+"chihead"+(lk+1)+"").style.display="none";
}
}
//showHideHeadings();
}



