﻿// JScript File
var js_typsrch_processing = '';
var js_typsrch_processing_txt = '';
var js_timer;
var js_SrchCtrlID;
var js_Ajx_ts;
var Js_ID="HtlSrchCtrl_sle_searchBy";
var Js_DivID="dv_srchdisp";
 var js_rec_i;
var Js_count=1;





function openCal(id,obj)
	{
	    try{
	        var objCal=new PopUpCalendar();
	        objCal.turnOffOnYearSpan(true);
            objCal.CurrentDate(document.getElementById(js_SrchCtrlID + '_hid_currdate').value);
            
            if(id == js_SrchCtrlID + '_sle_ChkInDt')
	        objCal.CheckInDate(true);
	        
	        objCal.show(document.getElementById(id),'dd-mm-yyyy',obj);
	    }catch(e)
	    {
	    alert(e.description);
	    }
	}

function JF_REsrh(ev,id)
{

Js_ID=id;
if(Js_ID=="HtlSrchCtrl_sle_searchBy")
{
Js_DivID='dv_srchdisp';

if(document.getElementById(Js_ID)&& document.getElementById(Js_ID).value=="")
{ document.getElementById('HtlSrchCtrl_sle_star_rating').value="";
        document.getElementById('HtlSrchCtrl_sle_star_rating').disabled=true;
        
        document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value = "";
        document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value = "";
}

 if(document.getElementById(Js_ID) && document.getElementById(Js_ID).value != '' && document.getElementById(js_SrchCtrlID + '_hid_searchBy').value != document.getElementById(Js_ID).value)
        {
         document.getElementById('HtlSrchCtrl_sle_star_rating').value="";
        document.getElementById('HtlSrchCtrl_sle_star_rating').disabled=true;
        
        document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value = "";
        document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value = "";
        }
     
       
        
}
else
{

Js_DivID='dv_Resrh';

//Js_DivID="dv_Resrh";
}
//JF_DivIdFi(Js_DivID,Js_ID);
JF_chngsearch(ev);
}
	
	
	
	
function JF_chngsearch(e)
{


if(window.event)keyPressed = window.event.keyCode; // IE
else
keyPressed = e.which; // Firefox
//alert(keyPressed);
    if(document.getElementById(Js_ID))
    {
	    if ((document.getElementById(Js_ID).value.length) > 1 && js_typsrch_processing == '' && keyPressed != 27 && keyPressed != 37 && keyPressed != 38 && keyPressed != 39 && keyPressed != 40 && keyPressed != 13 && keyPressed != 16 && keyPressed != 17 && keyPressed != 35 && keyPressed != 36 && keyPressed != 9 && keyPressed != 18)
	    {
		    JF_getsearch();
	    }
	    else 
	    {
	    if( (document.getElementById(Js_ID).value.length) < 2 ) 
	    JF_Hidsrchdiv();
	    
	    }
	       
	}
	
	
	return false;
}

function JF_Wait()
{   
    if(js_char_cnt == document.getElementById(Js_ID).value.length)
    {
        window.clearTimeout(js_timer);
        JF_Showimage();
    }
}
var js_char_cnt;
function JF_getsearch()
{	
    window.clearTimeout(js_timer);
    js_char_cnt = document.getElementById(Js_ID).value.length;
    js_timer = window.setTimeout('JF_Wait();',500);
}
function JF_Showimage()
{   
    if(document.getElementById('hid_selectrowcnt')) document.getElementById('hid_selectrowcnt').value = 0;
	
	document.getElementById(Js_DivID).innerHTML = '';
	document.getElementById(Js_ID).style.backgroundImage = 'url(images/ajax-loader.gif)';
	document.getElementById(Js_ID).style.backgroundRepeat = 'no-repeat';
	document.getElementById(Js_ID).style.backgroundPosition = 'right center';
	js_typsrch_processing_txt = document.getElementById(Js_ID).value;
	js_typsrch_processing = 'Y';	
	JF_GetTypeSrchList();//Resp
}
function JF_GetTypeSrchList()
{  
    js_searchBy_txt = document.getElementById(Js_ID).value;
	//js_searchBy_txt = js_searchBy_txt.replace(/'/g,"''");
	//js_searchBy_txt = js_searchBy_txt.replace(/\\/g,"\\\\");
	if(document.getElementById(js_SrchCtrlID + '_sle_searchBy').value=="London")
	{
	document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value='4129';
	}
	
	var xm = new LSCreateXML();
	
if(Js_ID=="HtlSrchCtrl_sle_star_rating")
	{
	xm.StartTag("AssociationRQ");
	xm.AddParam("Guid",document.getElementById("Hid_Guid").value);
    xm.AddParam("Outlt",document.getElementById("hid_outlet").value);
    xm.AddParam("SiteId",document.getElementById("hid_Mastersiteid").value);
    xm.AddParam("CustCode",document.getElementById("hid_custcd").value);
   xm.AddParam("CityCd",document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value);
    xm.AddParam("SrchTxt",js_searchBy_txt);
    xm.EndTag();
    JsCallAjaxCtrl("JF_GetTypeSrchListResp",xm.GetXml(), "ASSN");
	}
	else
	{
	xm.StartTag("root");
	xm.AddParam("SiteId",document.getElementById("hid_siteid").value);
	xm.AddParam("CustCd",document.getElementById("hid_custcd").value);
	xm.AddParam("CityDesc",js_searchBy_txt);
	xm.EndTag();
	JsCallAjaxCtrl("JF_GetTypeSrchListResp",xm.GetXml(), "BHRCCITY");
	}
	//<SiteId></SiteId><CustCd></CustCd></root>

	
	 
//   var sb = new JsStringBuilder();
//    sb.Append("<AssociationRQ>");
//    sb.Append("<Guid>");
//    sb.Append(document.getElementById("Hid_Guid").value);
//    sb.Append("</Guid>");
//    sb.Append("<Outlt></Outlt>");
//    sb.Append("<SiteId>BHRC</SiteId>");
//    sb.Append("<CustCode>IN</CustCode>");
//    sb.Append("<SrchTxt>"+ js_searchBy_txt +"</SrchTxt>");
//    sb.Append("</AssociationRQ>");
    
    
}
function JF_GetTypeSrchListResp()
{

document.getElementById("dv_srchdisp").style.display='none';
document.getElementById("dv_Resrh").style.display='none';



    js_retstring = js_Ajx_ts.OutPut();
    js_typsrch_processing = '';
    if (js_typsrch_processing_txt == document.getElementById(Js_ID).value)
    {	
	
        js_retstring=js_retstring.replace(/&#34;/g,"\""); 
        js_retstring=js_retstring.replace(/&#47;/g,"\n");
        js_retstring=js_retstring.replace(/&amp;#160;/g," ");
        js_retstring=js_retstring.replace(/\'/g,"\`");
   
        var js_Loclist = "<table  border=\"0\" cellpadding=\"2\"  cellspacing=\"0\" style=\"background-color:#fbedac\;\">";
    
        var xmlDoc = FnXMLObject(js_retstring);
       
        if(Js_ID=="HtlSrchCtrl_sle_star_rating")
        {
	        js_rec_i = Js_count+1;
//             var js_Loclist = "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" style=\"background-color:#ffffff\">"
//    
//            var xmlDoc = FnXMLObject(js_retstring);
//             var js_rec_i = 1;
            var xmlhtl=xmlDoc.getElementsByTagName("AssociationType");
           if(xmlhtl.length > 0 && xmlDoc.getElementsByTagName("Error").length == 0)
           {
            var js_City_cd="",js_estcnt;
                for (var i=0;i<xmlhtl.length;i++)
                {
                    var Js_Code=xmlhtl[i].attributes.getNamedItem("Code").nodeValue;
                    var js_assntypdesc = xmlhtl[i].attributes.getNamedItem("Desc").nodeValue;
                    var js_SrchType = xmlhtl[i].attributes.getNamedItem("SrchType").nodeValue;
                   // js_Loclist += "<tr><td   style=\"background-color:#D4A017;cursor:pointer;font-family:arial;font-size:11px\" id=\"tr_"+ js_SrchType +"\"><font color=\"White\"><b>";
                  
                    //js_Loclist +=js_assntypdesc;
                    //js_Loclist += "</font></b></td></tr>"
                    
                    
                    
                    xmlassnlst=xmlhtl[i].childNodes.length;
                    
                for (var j=0;j<xmlassnlst;j++)
                {
                    js_assn_cd = xmlhtl[i].childNodes[j].attributes.getNamedItem("Code").nodeValue;
                    js_assn_nam = xmlhtl[i].childNodes[j].attributes.getNamedItem("Desc").nodeValue;
                    js_estcnt=xmlhtl[i].childNodes[j].attributes.getNamedItem("EstCount").nodeValue;
                    if(parseInt(js_assn_nam.length)>47)
                    {
                    js_assn_nam=js_assn_nam.substr(0,47)+"...";
                    }
                    
                    if(parseInt(js_estcnt)==0) js_estcnt="";
                     if(parseInt(js_estcnt)==1) js_estcnt=js_estcnt+" Hotel";                     
                    if(parseInt(js_estcnt)>1)js_estcnt=js_estcnt+" Hotels";
                    
                    
//                    js_City_cd='6279';
//                    js_Loclist += "<tr ><td width=\"80%\" onmouseover=\"javascript:JF_srchdivover(\'"+ js_rec_i +"\');\" onmouseout=\"javascript:JF_srchdivout(\'"+ js_rec_i +"\');\" onclick=\"javascript:JF_SetAssn(\'"+js_assn_cd+"\', \'"+js_assn_nam+"\', \'"+js_SrchType+"\',\'"+js_City_cd+"\')\" style=\"background-color:#fbedac;cursor:pointer;border-right:0;font-family:arial;font-size:11px;\" id=\"tr_"+ js_rec_i +"\" ";
//                    js_Loclist += ">"+js_assn_nam;
//                    js_Loclist += "&nbsp;&nbsp;&nbsp;</td><td align=\"right\" width=\"20%\" onmouseover=\"javascript:JF_srchdivover(\'"+ js_rec_i +"\');\" onmouseout=\"javascript:JF_srchdivout(\'"+ js_rec_i +"\');\" onclick=\"javascript:JF_SetAssn(\'"+js_assn_cd+"\', \'"+js_assn_nam+"\', \'"+js_SrchType+"\',\'"+js_City_cd+"\')\"   style=\"background-color:#fbedac;cursor:pointer;font-family:arial;border-left:0;font-size:11px;\" id=\"trs_"+ js_rec_i +"\"><b>"+js_estcnt+"</b></td></tr>"
//                    js_Loclist += "<input type=\"hidden\" name=\"hid_cty_cd_" + js_rec_i +"\" id=\"hid_cty_cd_" + js_rec_i +"\" value=\""+js_City_cd+"\"><input type=\"hidden\" name=\"hid_assn_cd_" + js_rec_i +"\" id=\"hid_assn_cd_" + js_rec_i +"\" value=\""+js_assn_cd+"\"><input type=\"hidden\" name=\"hid_assn_name_" + js_rec_i +"\" id=\"hid_assn_name_" + js_rec_i +"\" value=\""+ js_assn_nam +"\"><input type=\"hidden\" name=\"hid_sort_order_" + js_rec_i +"\" id=\"hid_sort_order_" + js_rec_i +"\" value=\""+js_SrchType+"\">";
//                    js_rec_i++;
                    
                    js_City_cd="";
                    js_Loclist += "<tr ><td width=\"300px;\" onmouseover=\"javascript:JF_srchdivover(\'"+ js_rec_i +"\');\" onmouseout=\"javascript:JF_srchdivout(\'"+ js_rec_i +"\');\" onclick=\"javascript:JF_SetAssn(\'"+js_assn_cd+"\', \'"+js_assn_nam+"\', \'"+js_SrchType+"\',\'"+js_City_cd+"\')\" style=\"background-color:#fbedac;cursor:pointer;border-right:0;font-family:arial;font-size:11px;\" id=\"tr_"+ js_rec_i +"\" ";
                    js_Loclist += "><div style=\"float:left;\" >"+js_assn_nam;
                    js_Loclist += "</div><div style=\"float:right;\" ><b>"+js_estcnt+"</b>&nbsp;"
                    
                        
                    js_Loclist += "</div></td></tr><input type=\"hidden\" name=\"hid_cty_cd_" + js_rec_i +"\" id=\"hid_cty_cd_" + js_rec_i +"\" value=\""+js_City_cd+"\"><input type=\"hidden\" name=\"hid_assn_cd_" + js_rec_i +"\" id=\"hid_assn_cd_" + js_rec_i +"\" value=\""+js_assn_cd+"\"><input type=\"hidden\" name=\"hid_assn_name_" + js_rec_i +"\" id=\"hid_assn_name_" + js_rec_i +"\" value=\""+ js_assn_nam +"\"><input type=\"hidden\" name=\"hid_sort_order_" + js_rec_i +"\" id=\"hid_sort_order_" + js_rec_i +"\" value=\""+js_SrchType+"\">";
                    js_rec_i++;
                }
     
                }
                //js_Loclist += "</table>";
              }
              else
                {
                 js_Loclist += "<tr><td style=\"background-color:#fbedac;font-family:arial;font-size:11px;height:20px\">No Result  to Display&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>"
                }
                
        }
        else
        {
      
        js_rec_i=1;
            var xmlhtl=xmlDoc.getElementsByTagName("row");
            if(xmlhtl.length > 0 && xmlDoc.getElementsByTagName("Error").length == 0)
            {
                for (var i=0;i<xmlhtl.length;i++)
                {
                 var js_assntypdesc = xmlhtl[i].attributes.getNamedItem("city_desc").nodeValue;
                 var js_SrchType = 'CTY';
                 var js_assn_cd = xmlhtl[i].attributes.getNamedItem("city_cd").nodeValue;
                 var js_assn_nam = xmlhtl[i].attributes.getNamedItem("city_desc").nodeValue;
                js_rec_i 
                js_Loclist += "<tr><td onmouseover=\"javascript:JF_srchdivover(\'"+ js_rec_i +"\');\" onmouseout=\"javascript:JF_srchdivout(\'"+ js_rec_i +"\');\" onclick=\"javascript:JF_SetAssn(\'"+js_assn_cd+"\', \'"+js_assn_nam+"\', \'"+js_SrchType+"\')\" style=\"background-color:#fbedac;cursor:pointer;font-family:arial;font-size:11px\" id=\"tr_"+ js_rec_i +"\" ";
                js_Loclist += ">"+js_assn_nam;
	  
                js_Loclist += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                 js_Loclist += "<input type=\"hidden\" name=\"hid_assn_cd_" + js_rec_i +"\" id=\"hid_assn_cd_" + js_rec_i +"\" value=\""+js_assn_cd+"\"><input type=\"hidden\" name=\"hid_assn_name_" + js_rec_i +"\" id=\"hid_assn_name_" + js_rec_i +"\" value=\""+ js_assn_nam +"\"><input type=\"hidden\" name=\"hid_sort_order_" + js_rec_i +"\" id=\"hid_sort_order_" + js_rec_i +"\" value=\""+js_SrchType+"\">";
                 js_Loclist += "</td></tr>"
      
                 js_rec_i =js_rec_i+1;
    
     
                }
                Js_count=i;
             }
             
             else
            {
            js_Loclist += "<tr><td style=\"background-color:#fbedac;font-family:arial;font-size:11px;height:20px\">No City to Display&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>"
            }
        
    }
    js_Loclist += "</table>";
	  
        
    document.getElementById(Js_DivID).innerHTML = js_Loclist;
    //}catch(e){e.message}
    if(navigator.appVersion.indexOf('MSIE 6') != -1) document.getElementById(js_SrchCtrlID + '_sle_star_rating').style.display = 'none';
    document.getElementById(Js_DivID).style.display = '';
    document.getElementById(Js_ID).style.backgroundImage = 'none';
    //document.getElementById(Js_DivID).style.top = '260px';
    //document.getElementById(Js_DivID).style.left = '130px';
    document.getElementById(Js_DivID).style.overflowX = 'hidden';
    if(Js_ID!="HtlSrchCtrl_sle_star_rating")
    {
    document.getElementById('hid_selectrowcnt').value = 0;
    }
    else
    {
    document.getElementById('hid_selectrowcnt').value =Js_count;
    }
    document.getElementById('hid_selectrowcnt').value = parseInt(document.getElementById('hid_selectrowcnt').value) + 1;
    if(document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ))
    {
        document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
        //document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).scrollIntoView(false);
        document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).focus();
         //document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
        //document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).scrollIntoView(false);
        
    }
    else
	
  
        document.getElementById('hid_selectrowcnt').value = 0;
		
    document.getElementById(Js_ID).focus();
 }

    else 
    {
    if((document.getElementById(Js_ID).value.length) > 1)
    {	
        JF_getsearch();
    }
    else
        JF_Hidsrchdiv();
	}
  

}
function JF_SetAssn(jl_assn_cd, jl_assn_name, jl_SrchType,jl_city_cd)
{
if(Js_ID=="HtlSrchCtrl_sle_star_rating")
{
    if(jl_SrchType=='CTY')
    {
        document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value =jl_assn_cd;
        document.getElementById(js_SrchCtrlID + '_hid_searchBy').value= jl_assn_name;
        document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value = "";
        document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value = jl_assn_name;
    }
    else
    {
        document.getElementById(js_SrchCtrlID + '_hid_Resrh').value = jl_SrchType;
	    document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value = jl_assn_cd;
	    document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value = jl_assn_name;
	    document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value =jl_city_cd
    }
   
	
	
}
else
{
   document.getElementById(js_SrchCtrlID + '_hid_Resrh').value=jl_SrchType;
	//document.getElementById(js_SrchCtrlID + '_hid_SrchType').value = jl_SrchType;
	document.getElementById(js_SrchCtrlID + '_hid_searchBy').value= jl_assn_name;
	document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value = jl_assn_cd;
	 document.getElementById('HtlSrchCtrl_sle_star_rating').disabled=false;
	}
	
	document.getElementById(Js_ID).value = jl_assn_name;
	
	//document.getElementById(js_SrchCtrlID + '_hid_searchBy').value = jl_assn_name;
		
	if(navigator.appVersion.indexOf('MSIE 6') != -1) document.getElementById(js_SrchCtrlID + '_sle_star_rating').style.display = '';
	if(document.getElementById('tr_1')) document.getElementById('tr_1').scrollIntoView(false);
	document.getElementById(Js_DivID).style.display = 'none';
	document.getElementById(Js_ID).focus();
}
function JF_Hidsrchdiv()
{	


if(navigator.appVersion.indexOf('MSIE 6') != -1) document.getElementById(js_SrchCtrlID + '_sle_star_rating').style.display = '';
	if(document.getElementById('tr_1')) document.getElementById('tr_1').scrollIntoView(false);
	document.getElementById(Js_DivID).style.display = 'none';
	document.getElementById(Js_ID).style.backgroundImage = 'none';
	if(document.getElementById('hid_selectrowcnt')) document.getElementById('hid_selectrowcnt').value = 0;
	
}
function JF_chkKeyevnt(e)
{
	if(window.event)
		keyPressed = window.event.keyCode; // IE
	else
		keyPressed = e.which; // Firefox

	if(document.getElementById(Js_DivID).style.display == '' )
	{
		if( keyPressed == 40)
		{
			//document.getElementById(Js_DivID).focus();
			try
			{
				if(document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ))
				{
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fbedac';
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fbedac';
				}
				document.getElementById('hid_selectrowcnt').value = parseInt(document.getElementById('hid_selectrowcnt').value) + 1;
				if(document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ))
				{
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
					
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).scrollIntoView(false);
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).scrollIntoView(false);
					//JF_SetAssn1( document.getElementById( 'hid_assn_cd_' + document.getElementById('hid_selectrowcnt').value ).value, document.getElementById( 'hid_assn_name_' + document.getElementById('hid_selectrowcnt').value ).value )
				}
				else
				{
					document.getElementById('hid_selectrowcnt').value = parseInt(document.getElementById('hid_selectrowcnt').value) - 1;
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
				}
			}
			catch(err)
			{
				//alert(err);
			}
		}
		else if( keyPressed == 38)
		{
			//document.getElementById(Js_DivID).focus();
			try
			{
				if(document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ) && parseInt(document.getElementById('hid_selectrowcnt').value) > 1 )
				{
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fbedac';
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fbedac';
				}
				if(parseInt(document.getElementById('hid_selectrowcnt').value) > 1)
					document.getElementById('hid_selectrowcnt').value = parseInt(document.getElementById('hid_selectrowcnt').value) - 1;
				if(document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ))
				{
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
					document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).scrollIntoView(false);
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fed464';
					//document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).scrollIntoView(false);
					//JF_SetAssn1( document.getElementById( 'hid_assn_cd_' + document.getElementById('hid_selectrowcnt').value ).value, document.getElementById( 'hid_assn_name_' + document.getElementById('hid_selectrowcnt').value ).value )
				}
			}
			catch(err)
			{
				//alert(err);
			}
		}
		else if( keyPressed == 13 || keyPressed == 9)
		{	
			if (document.getElementById('hid_selectrowcnt').value != '0')
				JF_SetAssn( document.getElementById( 'hid_assn_cd_' + document.getElementById('hid_selectrowcnt').value ).value, document.getElementById( 'hid_assn_name_' + document.getElementById('hid_selectrowcnt').value ).value, document.getElementById( 'hid_sort_order_' + document.getElementById('hid_selectrowcnt').value ).value,document.getElementById( 'hid_cty_cd_' + document.getElementById('hid_selectrowcnt').value ).value )
			else
				JF_Hidsrchdiv();
		}
		else if( keyPressed == 27 )
		{
			JF_Hidsrchdiv();
			document.getElementById(js_SrchCtrlID + '_hid_searchBy').value = '';
			document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value = '';
			 
			
				//document.form_bhrc.hid_srch_est_cd.value = '';
			//document.form_bhrc.hid_srch_city_cd.value = '';
			document.getElementById(Js_ID).focus();
		}
		//else if( keyPressed == 9 )
		//{
		//	JF_Hidsrchdiv();
		//}
		
	}
}
function JF_srchdivover(js_rowid)
{
	try{
	if( document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value) )
		document.getElementById('tr_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fbedac';
//		if( document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value) )
//		document.getElementById('trs_' + document.getElementById('hid_selectrowcnt').value ).style.backgroundColor = '#fbedac';
	document.getElementById('hid_selectrowcnt').value = js_rowid;
	document.getElementById('tr_' + js_rowid ).style.backgroundColor = '#fed464';
	//document.getElementById('trs_' + js_rowid ).style.backgroundColor = '#fed464';
	
	
	
	}catch(err){}
}
function JF_srchdivout(js_rowid)
{	
	try{
	document.getElementById('tr_' + js_rowid ).style.backgroundColor = '#fbedac';
	//document.getElementById('trs_' + js_rowid ).style.backgroundColor = '#fbedac';
	}catch(err){}
}
function JF_typsrchtxtdisp()
{	
	if (document.getElementById(Js_ID).value == '') document.getElementById(Js_ID).value = 'Type and Search';
}
function JF_typsrchtxtHide()
{	
	if (document.getElementById(Js_ID).value == "Type and Search") document.getElementById(Js_ID).value = '';
}
function JF_SetSearchBoxFns()
{	
    js_SrchCtrlID = "HtlSrchCtrl";//document.getElementById('hid_SrchCtrlID').value;
    if(document.getElementById(Js_ID))
    {
        window.document.onkeydown = JF_chkKeyevnt;
        window.document.onclick= JF_Hidsrchdiv;
    
	    document.getElementById(Js_ID).onclick = JF_typsrchtxtHide;
	    document.getElementById(Js_ID).onfocus = JF_typsrchtxtdisp;
	    document.getElementById(Js_ID).onblur = JF_typsrchtxtHide;
	    document.getElementById(Js_ID).onmouseover = JF_typsrchtxtdisp;
	    document.getElementById(Js_ID).onmouseout = JF_typsrchtxtHide;
	    document.getElementById(Js_ID).onkeydown = JF_typsrchtxtHide;
	}
}
function JF_gettop(ID,noofhtls)
{
var eP=eval('document.getElementById("'+ID+'")');
    var eL=0;
	var eT=0;
	var p=eP;
	while(p&&p.tagName!="BODY")
	{
		eT+=p.offsetTop;
		eL+=p.offsetLeft;
		p=p.offsetParent;
	}
    var eH=eP.offsetHeight;
	var dH=0 ;
	var W=0;
	var sT=document.body.scrollTop;
	var dW=0;

var controlwidth = eP.offsetWidth;
var top=parseFloat(eT) - noofhtls;
return top;
}
function JF_ShowToolTip(js_objid, js_str)
{
	var tooltop;
	tooltop = JF_gettop(js_objid,0);
	if(js_objid == 'info_locations') tooltop = tooltop + 140;
	document.getElementById('ToolTip').style.display = '';
	ContentInfo = '<table border="0" cellpadding="4" bgcolor="#fbedac" cellspacing="0">'+
	'<tr><td style="font-size:11px"><font color=#000000 face="Arial">'+js_str+'</font></td></tr>'+
	'</table>';
	document.getElementById('ToolTip').innerHTML = ContentInfo;
	document.getElementById('ToolTip').style.top = (tooltop + 16) + 'px';
	document.getElementById('ToolTip').style.left = (JF_getLeft(js_objid)-20) + 'px';
}
function JF_HideToolTip()
{
	document.getElementById('ToolTip').style.display = 'none';
	document.getElementById('ToolTip').innerHTML = '';
}


function JsCallAjaxCtrl(CallBackMethod, RqXml,opt)
{
	js_Ajx_ts = new LSGetData();
	js_Ajx_ts.ShowDiv(false);
	js_Ajx_ts.SetParam(RqXml);
	js_Ajx_ts.SetAsycMethod(CallBackMethod);
	js_Ajx_ts.SetErrMethod("JF_AjxError");	
	js_Ajx_ts.SetClassId(opt);
	js_Ajx_ts.GetData();
}
function JF_AjxError(output)
{
    alert(output);
}
function JsStringBuilder()
{
	var _AppndString="";	
	this.Append = Append;
	this.ToString = ToString;
	function Append(sData)
	{
		_AppndString = _AppndString.concat(sData);
	}
	function ToString()
	{
		return _AppndString;
	}
}

//Validation
//Date Validation
function JF_ValidateOnBlur(dateId)
{  
    var objDate = new JF_Date();
    objDate.DayFormatOption("F");// For Previous Date
    //objDate.DayFormatOption("F");// For Future Date
    objDate.FormatControlVal(dateId);
}
function JF_ValidateOnchange(frmDateID)
{
     var objDate = new JF_Date();
    objDate.CurrentSrvrDate(document.getElementById(js_SrchCtrlID + '_hid_currdate').value);
    objDate.DayFormatOption("F");// For Previous Date
    objDate.FormatControlVal(frmDateID);
    objDate.FormatDeptDate(frmDateID, js_SrchCtrlID + '_sle_ChkOutDt');
}
function Jf_CheckDate(j_val)
{

var srh_url="";
    var objDate = new JF_Date();
    objDate.CurrentSrvrDate(document.getElementById(js_SrchCtrlID + '_hid_currdate').value)
    
    
    
    
    if(objDate.isDateMoreThanYear(js_SrchCtrlID + '_sle_ChkInDt'))
    {
        alert("Arrival Date should not be more than one year");
        document.getElementById(js_SrchCtrlID + '_sle_ChkInDt').focus();
        return;
    }
    //if(!objDate.isValidFromAndToDate(js_SrchCtrlID + '_sle_ChkInDt', 'Arrival Date', js_SrchCtrlID + '_sle_ChkOutDt', 'Departure Date')) return;
    if(!objDate.isValidFromAndToDate(js_SrchCtrlID + '_sle_ChkInDt', 'Arrival Date', js_SrchCtrlID + '_sle_ChkOutDt', 'Departure Date')) return;
    var js_numofNights = objDate.NumOfNights(js_SrchCtrlID + '_sle_ChkInDt', js_SrchCtrlID + '_sle_ChkOutDt');
    if(js_numofNights > 15)
    {
        alert('Please contact us by phone or email if you would like to book for more than 15 nights.\rOur long stay rates are heavily discounted. \r Phone:'+document.getElementById("hid_tel1").value+', Email:'+document.getElementById("hid_emil1").value+'');return;
    }
    
    if(document.getElementById('HtlSrchCtrl_sle_star_rating').value=="Hotel,attraction,postcode")
	    {
	    alert('You have not entered any valid search criteria.Please enter a keyword and perform your search again');
		document.getElementById('HtlSrchCtrl_sle_star_rating').focus();
		return;
	    }
     if(Js_ID=="HtlSrchCtrl_sle_star_rating")
    
	{
	    
	    
	  if(document.getElementById(Js_ID) && document.getElementById(Js_ID).value != '' && document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value != document.getElementById(Js_ID).value)
	    {
		alert('You have not entered any valid search criteria.Please enter a keyword and perform your search again');
		document.getElementById(Js_ID).focus();
		return;
	    }
	}
   
     if(Js_ID!="HtlSrchCtrl_sle_star_rating")
    
	{
	
	  if(document.getElementById(Js_ID) && document.getElementById(Js_ID).value != '' && document.getElementById(js_SrchCtrlID + '_hid_searchBy').value != document.getElementById(Js_ID).value)
	    {
		alert('You have not entered any valid search criteria.Please enter a keyword and perform your search again');
		document.getElementById(Js_ID).focus();
		return;
	    }
	}
	 
	
	if(document.getElementById('HtlSrchCtrl_sle_star_rating') && document.getElementById('HtlSrchCtrl_sle_star_rating').value == '')
	{
	    
	    document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value = '';
	    document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value = '';
	}
	
	
	
	
	document.getElementById('sle_nights').value = js_numofNights;
	if(document.getElementById('hid_OnReq_flg')) document.getElementById('hid_OnReq_flg').value="";
	
	if(document.getElementById('hid_CurPage')) document.getElementById('hid_CurPage').value = '1';
	if(j_val!="F")
	{
	
	    document.getElementById("Hid_HeadLoction").value=document.getElementById('HtlSrchCtrl_sle_searchBy').value;
	
	
	   
	  
	    if(document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value == "") document.getElementById(js_SrchCtrlID + '_hid_Resrh').value="CTY";
	   
	   
	

	    if(document.getElementById(js_SrchCtrlID + '_hid_Resrh').value == 'EST')
	    {	 
	    var sssurl=JF_GetPageURL(document.getElementById(js_SrchCtrlID + '_sle_searchBy').value,document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value,document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value,'e')
	    document.getElementById('hid_htlsrchreq').value = 'Y';
	    document.form_bhrc.action = sssurl;	    
	    document.form_bhrc.submit();
	    }
	    else
	    {
	    if(document.getElementById('hid_OnReq_flg'))document.getElementById('hid_OnReq_flg').value="";
	        if(document.getElementById(js_SrchCtrlID + '_hid_Resrh').value == 'CTY') srh_url= JF_GetPageURL('Hotels-in',document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value,document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value,'c') 
	        if(document.getElementById(js_SrchCtrlID + '_hid_Resrh').value != 'CTY') srh_url= JF_GetPageURL('Hotels-in',  document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value,document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value,'a') 
	        document.getElementById(js_SrchCtrlID + '_hid_FrmCntrl').value="Y";
	        document.form_bhrc.action = srh_url+'?Check_in='+document.getElementById(js_SrchCtrlID + '_sle_ChkInDt').value+'&Check_out='+document.getElementById(js_SrchCtrlID + '_sle_ChkOutDt').value+'&Rooms='+document.getElementById(js_SrchCtrlID + '_sle_chk_rooms').value+'&Guest='+document.getElementById(js_SrchCtrlID + '_sle_chk_adlts').value;
	        document.form_bhrc.submit();
	    }
	}
	
	else
	{
	if(document.getElementById('hid_OnReq_flg'))document.getElementById('hid_OnReq_flg').value="";
	document.getElementById(js_SrchCtrlID + '_hid_FrmCntrl').value="Y";
	if(document.getElementById(js_SrchCtrlID + '_hid_Resrh').value =='CTY') srh_url= JF_GetPageURL('Hotels-in',document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value,document.getElementById(js_SrchCtrlID + '_hid_searchBy_cd').value,'c') 
	if(document.getElementById(js_SrchCtrlID + '_hid_Resrh').value !='CTY') srh_url= JF_GetPageURL('Hotels-near',document.getElementById(js_SrchCtrlID + '_hid_Resrh_txt').value,document.getElementById(js_SrchCtrlID + '_hid_Resrh_cd').value,'a') 
	 document.form_bhrc.action =srh_url+'?Check_in='+document.getElementById(js_SrchCtrlID + '_sle_ChkInDt').value+'&Check_out='+document.getElementById(js_SrchCtrlID + '_sle_ChkOutDt').value+'&Rooms='+document.getElementById(js_SrchCtrlID + '_sle_chk_rooms').value+'&Guest='+document.getElementById(js_SrchCtrlID + '_sle_chk_adlts').value;;
	document.form_bhrc.submit();
	}
	
	return false;
}
function JF_ErrHandle(as_name, as_label, as_err) {
 alert(as_err);
 as_name.focus();
 return;
}


function JF_overlayS(as_id)
{
    var js_ctr=js_commn.GetObj(as_id);
    if(js_ctr.value=="Hotel,attraction,postcode")
    {
        js_ctr.value="";
        
        js_ctr.focus();
    }
}
function JF_overdownS(as_id)
{
    var js_ctr=js_commn.GetObj(as_id);
    if(js_ctr.value=="")
    {
        js_ctr.value="Hotel,attraction,postcode";
    }
}
