// For Home Page Price Section, By Gourav Kumar, RateGain IT Solution
//function dIS(_page, _chr, _rq)
//{
//    //alert(_page);

//    if(_chr!="") { var _fnh = '1';
//        if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
//         var theDate = new Date();
//         var rU = "/Search/AjaxImpl.aspx?page="+_page+"&chr="+_chr +"&rq="+_rq+"&fnh="+_fnh+"&dt="+ theDate.getTime();
//         var XmlHttp = CreateXmlHttp();
//         if(XmlHttp) { XmlHttp.onreadystatechange = function() { 
//                if(XmlHttp.readyState == 4) {
//	                if(XmlHttp.status == 200) {
//	                    switch (_page) {
//                            case 'destIntelli': dIXDB(XmlHttp.responseText);  break;
//	                        case 'hotelRevIntelli': HRISX(XmlHttp.responseText); break;
//	                        case 'destRevIntelli': DRISX(XmlHttp.responseText); break;
//	                        case 'IATA': IataX(XmlHttp.responseText, ""); break;
//	                    }
//	                }
//                }
//	        }
//		    XmlHttp.open("GET", rU, true); XmlHttp.send(null);		
//	     }
//    }
//}
function dIS(_page, _chr, _rq)
{   
    if(_chr!="") { var _fnh = '1';
        if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
         var theDate = new Date();
         var rU = "/Search/AjaxHome.aspx?page="+_page+"&chr="+_chr +"&rq="+_rq+"&fnh="+_fnh+"&dt="+ theDate.getTime();
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp) { XmlHttp.onreadystatechange = function() { 
                if(XmlHttp.readyState == 4) {
	                if(XmlHttp.status == 200) {
	                    switch (_page) {
                            case 'destIntelli': ShowIntelliMS_UV(XmlHttp.responseText,_fnh);  break;
	                        //case 'hotelRevIntelli':HRISX(XmlHttp.responseText); break;
	                        //case 'destRevIntelli': DRISX(XmlHttp.responseText); break;
	                        //case 'IATA':IataX(XmlHttp.responseText, ""); break;
	                    }
	                }
                }
	        }
		    XmlHttp.open("GET", rU, true); XmlHttp.send(null);		
	     }
    }
}

//function dIXDB(rX)
//{
//    if(rX!=""){ var _sQ = _$("ctl00_plhBody_txtDestination").value;
//        var xD =crXD(rX);
//        if(_cObj(xD.selectNodes("ISD/UL/li"))) {
//            var ndD = xD.selectNodes("ISD/UL/li");
//            if(_cObj(ndD)) {
//                if(xD.selectSingleNode("ISD").getAttribute("RCntr")!=null){
//                    if(xD.selectSingleNode("ISD").getAttribute("RCntr") == _rqDest) {
//                        if(ndD.length > 0) {
//                            var dv = _$("destDiv"); dv.style.display = 'block'; cldv(dv); var _ul = crE('UL');
//                                for(var _rCt=0; _rCt < ndD.length; _rCt++) {
//                                    var _tV = GIH(ndD[_rCt]); _tV = ReplaceAll(_tV,"|", ", ");
//                                    var _dId = ndD[_rCt].getAttribute("id"); var _li = crDLI(_dId, _tV); _ul.appendChild(_li);
//                                }
//                                itC = ndD.length; dv.style.display = "inline"; dv.zIndex = "1000"; dv.appendChild(_ul);
//                                var _destDivCon =  _$("destDivContainer"); _destDivCon.style.display = 'block';
//                                var bName = navigator.appName;
//                                if (bName == "Microsoft Internet Explorer") {
//                                    var _iFrame = _$("destIFrame"); _iFrame.style.display = 'block'; _iFrame.style.width = dv.offsetWidth-2;
//                                    _iFrame.style.height = dv.offsetHeight-2; _iFrame.style.left = _$("destDivContainer").style.left; _iFrame.style.top = _$("destDivContainer").style.top;
//                                }
//                                selChc(0)
//                        }
//                        else { _$("destIFrame").style.display = 'none'; _$("destDiv").style.display = 'none'; }
//                    }
//                }
//                else { _$("destIFrame").style.display = 'none'; _$("destDiv").style.display = 'none'; }
//            }
//        }
//    }
//}
function ShowIntelliMS_UV(IData,_fnh)
{     
    var arrData=IData.split('|##');
    try{
    if(arrData[0]==_rqDest)
    {   
        var dv=_$("destDiv"); dv.innerHTML=''; dv.style.display='block';var _ul = crE('UL');
        if(arrData[1].length>0)
        {                               
            var JObj = eval('(' + arrData[1] + ')'); 
            var _tV,_dId,_li;              
            for(var i = 0; i < JObj.InSe.length; i++) 
            {
                _tV = JObj.InSe[i].INm;              
                _dId = JObj.InSe[i].IKy;                                         
                _li = crDLI(_dId, _tV);
                _ul.appendChild(_li);
            }
            itC = JObj.InSe.length;dv.style.display = "inline"; dv.zIndex = "1000"; dv.appendChild(_ul);
            var _destDivCon =  _$("destDivContainer"); _destDivCon.style.display = 'block';if(_fnh==2){_$("divHlnk").style.display = "none"};
            var bName = navigator.appName;
            if (bName == "Microsoft Internet Explorer") 
            {
                var _iFrame = _$("destIFrame"); _iFrame.style.display = 'block'; _iFrame.style.width = dv.offsetWidth-2;
                _iFrame.style.height = dv.offsetHeight-2; _iFrame.style.left = _$("destDivContainer").style.left; _iFrame.style.top = _$("destDivContainer").style.top;
            } 
            selChc(0)    
        }
        else 
        { 
            _$("destIFrame").style.display = 'none';_$("destDiv").style.display = "none";if(_fnh==2){if(_$("ctl00_plhBody_txtDestination").value.length>0) {_$("divHlnk").style.display = "block";} }
        }
    }
    }
    catch(e)
    {
        alert(e.message)
    }
}
function crDLI(_dId, _tV)
{
    var _li = crE('LI'); _li.id = _dId; _li.innerHTML = _tV;
   _li.onmousedown = function() { dLS(_dId,_tV); };
   _li.onmouseover = function() { crsl = -1; selChc(-1); _li.className = 'listItem'; };
   _li.onmouseout = function() { _li.className = ''; };
   return _li
}
function dLS(_dId, _tV)
{
     _tV=ClrSPN(_tV);
    _$("destIFrame").style.display = 'none'; _$("destDiv").style.display = 'none'; _$("ctl00_plhBody_txtDestination").value = _tV;
    _$("divDestMessage").style.display = "none"; _$("divDidYouMeanDest").style.display = "none";
    _$("ctl00_plhBody_hidDestValue").value = _dId; _$("ctl00_plhBody_hidDestText").value = _tV;
    var _dId = _$("ctl00_plhBody_hidDestValue").value; _$("ctl00_plhBody_hidResortId").value = "0"; _$("ctl00_plhBody_hidResortName").value = "";
    dSr(_dId); if(_cObj(_$('ctl00_plhBody_ddlHotelName')))hSr(_dId,"-1");
    var _dsVs = _dId.split(","); var _destType = _dsVs[5]; var _bType = _dsVs[6]; var _hCount = _dsVs[7]; _$("hidHcount").value = _hCount;
    if(_hCount > 0) _$("lblHotelsCount").innerHTML = "for " + _hCount + " Hotels"; 
    else _$("lblHotelsCount").innerHTML = "";
    if(_cObj(_$("hidFnH"))) if(_$("hidFnH").value == '2') _$("lblHotelsCount").innerHTML = "";
    _$("ctl00_plhBody_hidDestType").value = _destType; _$("ctl00_plhBody_hidBType").value = _bType;
    if(_cObj(_$('ctl00_plhBody_ddlDuration')))
    {
          if(_destType == "C") { if(_bType != "True") { pDr("1", _$("ctl00_plhBody_ddlDuration"));           
                if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In") {
                    cOutDate("2"); setTimeout("pDur(2)" , 500);}
            }
            else
            {
                if(_cObj(_$('hidFnH')) && _$('hidFnH').value == '2')
                    pDr("0", _$("ctl00_plhBody_ddlDuration"));
                else
                   pDr("1", _$("ctl00_plhBody_ddlDuration"));
                _$("ctl00_plhBody_ddlBoard").value = "HB"; _$("ctl00_plhBody_ddlBoard").disabled=false;
                if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In") {
                    cOutDate("7"); setTimeout("pDur(7)" , 500); }
            }
        }
        else { pDr("1", _$("ctl00_plhBody_ddlDuration"));        
            if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In") {
                cOutDate("7"); setTimeout("pDur(7)" , 500); }
        }  
    }    
    return false;
}
function gPSX(_aid)
{
     var _hsrpIds = _$("ctl00_plhBody_hidPriceReqValues").value; var theDate = new Date();
     var rU = "/Search/AjaxImpl.aspx?pagedlp=HomePrice&aid="+_aid+"&v="+_hsrpIds+"&dt="+ theDate.getTime();
     var XmlHttp = CreateXmlHttp();
     if(XmlHttp) { XmlHttp.open("GET", rU, false); XmlHttp.setRequestHeader("Content-Type", "application/xml; charset=utf-8"); XmlHttp.send(null); }
}
// Amit: Can be removed after testing completed
//function validatePriceSearch_Old(_flag)
//{
//    _rqDest += 1;
//    if(_$("divDestMessage").style.display != "none") _$("divDestMessage").style.display = "none";
//    if(_cObj(_$("divDestRevMessage"))) if(_$("divDestRevMessage").style.display != "none") _$("divDestRevMessage").style.display = "none";
//    if(_cObj(_$("divHotelRevMessage"))) if(_$("divHotelRevMessage").style.display != "none") _$("divHotelRevMessage").style.display = "none";
//    if(_$("ctl00_plhBody_txtDestination").value=="" || _$("ctl00_plhBody_txtDestination").value=="e.g. Paris" || _$("ctl00_plhBody_txtDestination").value=="e.g. Costa Del Sol")  {
//        _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block"; _$("lblDestErrMessage").innerHTML = "Please enter a destination first!"; _$("lblHotelsCount").innerHTML = ""; return false;  }
//    if(_$("ctl00_plhBody_hidDestValue").value =="") { _$("divDestMessage").style.display = "none";
//        if(_$("ctl00_plhBody_txtDestination").value!="")  {
//            _$("ctl00_plhBody_hidDestSearchQuery").value = _$("ctl00_plhBody_txtDestination").value;
//            gDstSQ(_$("ctl00_plhBody_txtDestination").value); }
//        _$("ctl00_plhBody_txtDestination").focus(); _$("divDestMessage").style.display = "none"; return false;
//    }
//    if(_$("ctl00_plhBody_hotelCheckin").value=="") { alert("Check-in date can not be blank!"); return false; }
//    if(_$("ctl00_plhBody_hotelCheckout").value=="") { alert("Check-out date can not be blank!"); return false; }
//    if(_cObj(_$("txtEmail")) && _$("txtEmail").value != "" && _$("txtEmail").value != "Please enter your email") {
//        if(!echeck(_$("txtEmail").value)) { alert("Please enter valid email address!"); return false; }
//        else { saveSearchEmail(_$("txtEmail").value); }
//    }
//    if(_$("ctl00_plhBody_ddlRooms") != null) { var _rooms = _$("ctl00_plhBody_ddlRooms").value; var _rmV;
//        if(_rooms>1) {  var _adultV = _$("ctl00_plhBody_ddlAdult").value;
//            for(var _rmC=1; _rmC<_rooms; _rmC++) { var _adN = "ddlAdult" + _rmC; var _adV = _$(_adN).value; _adultV += ":" + _adV }
//            var _chV = _$("ctl00_plhBody_ddlChildren").value;
//            for(var _rmC=1; _rmC<_rooms; _rmC++) { var _adN = "ddlChildren" + _rmC; var _adV = _$(_adN).value; _chV += ":" + _adV }
//            var _infantValue = _$("ctl00_plhBody_ddlInfants").value;
//            for(var _rmC=1; _rmC<_rooms; _rmC++) { var _adN = "ddlInfants" + _rmC; var _adV = _$(_adN).value; _infantValue += ":" + _adV }
//            _rmV = _adultV + ";" + _chV + ";" + _infantValue; _$("ctl00_plhBody_hidRoomValues").value = _rmV;
//        }
//    }
//    var _dsN, _dsV, _rsN, _rsV, _cInV, _cOutV ; 
//    if(_$("ctl00_plhBody_hidDestText").value == "") { _dsN = _$("ctl00_plhBody_hidDestText").value; _dsV = _$("ctl00_plhBody_hidDestValue").value; }
//    if(_$("ctl00_plhBody_hidResortName").value == "") { _rsN = _$("ctl00_plhBody_hidDestText").value; _rsV = _$("ctl00_plhBody_hidDestValue").value; }
//    _cInV = _$("ctl00_plhBody_checkinValue").value; _cOutV = _$("ctl00_plhBody_checkoutValue").value;
//    var _adsV, _chdV, _infV, _drV, _rtV, _bdV, _rV;
//    _adsV = _$("ctl00_plhBody_ddlAdult").value; _chdV = _$("ctl00_plhBody_ddlChildren").value; _infV = _$("ctl00_plhBody_ddlInfants").value;
//    _rtV = _$("ctl00_plhBody_ddlRating").value; _bdV = _$("ctl00_plhBody_ddlBoard").value; _drV = _$("ctl00_plhBody_ddlDuration").value; _rV = _$("ctl00_plhBody_ddlRooms").value;
//    _$("ctl00_plhBody_hidOptionValues").value = _drV + "|" + _bdV + "|" + _rtV + "|" + _rV + "|" + _adsV + "|" + _chdV + "|" + _infV;
//    //Create QueryString for Price Result Page
//    var _dsV, _cid, _sid, _cityid, _locId, _hId, _type, _dId, _rsId, _airId, _cInD, _cOutD, _lrN, _aid, _dstN, _board;
//    if(_$("ctl00_plhBody_hidDestValue").value != "") {
//        _dsV = _$("ctl00_plhBody_hidDestValue").value.split(',');
//        _cid = _dsV[0]; _sid = _dsV[1]; _cityid = _dsV[2]; _locId = _dsV[3]; _hId = _dsV[4]; _type = _dsV[5];
//        if (_type != "C") { _dId = _locId; _locId = "0"; _rsId = _$("ctl00_plhBody_hidResortId").value; }
//        else { _dId = "0"; _locId = _$("ctl00_plhBody_hidResortId").value; _rsId = "0"; }
//    }
//    _airId = "0";
//    _cInD = _$("ctl00_plhBody_checkinValue").value; _cOutD = _$("ctl00_plhBody_checkoutValue").value;
//    _lrN = _$("ctl00_plhBody_hidResortName").value; _aid = _$("ctl00_plhBody_hidAffiliateId").value;
//    _dstN = _$("ctl00_plhBody_hidDestText").value; _board = _$("ctl00_plhBody_ddlBoard").value;
//    var _iataC; if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2' && _cObj(_$("ctl00_plhBody_ddlAirport"))) _iataC = _$("ctl00_plhBody_ddlAirport").value;if(_iataC =='-1'){alert('Please select a departure airport'); return false; } 
//    var sb = _cid;  sb += "|"; sb += _sid; sb += "|"; sb += _cityid; sb += "|"; sb += _locId; sb += "|"; sb += _dId; sb += "|"; sb += _rsId; sb += "|"; sb += _airId; sb += "|"; sb += _hId; sb += "|"; sb += _cInD; sb += "|";
//    sb += _cOutD; sb += "|"; sb += _drV; sb += "|"; sb += _bdV; sb += "|"; sb += _board; sb += "|"; sb += _rtV; sb += "|"; sb += _rV; sb += "|"; sb += _adsV; sb += "|"; sb += _chdV; sb += "|"; sb += _infV;
//    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') {sb += "|"; sb += _iataC; }
//    _$("ctl00_plhBody_hidPriceReqValues").value = sb;
//    //var theDate = new Date(); var rU;
//    //if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') rU= "/Search/ManipPriceResultFnH.aspx?pagedlp=HomePrice&aid="+_aid+"&v="+sb+"&dt="+ theDate.getTime();
//    //else rU= "/Search/AjaxImpl.aspx?pagedlp=HomePrice&aid="+_aid+"&v="+sb+"&dt="+ theDate.getTime();
//    //var XmlHttp = CreateXmlHttp();
//    //if(XmlHttp) { XmlHttp.open("GET", rU, false); XmlHttp.setRequestHeader("Content-Type", "application/xml; charset=utf-8"); XmlHttp.send(null); var responseText = XmlHttp.responseText; }
//    var _dNm = _$("ctl00_plhBody_hidDestText").value; 
//    var _hNm = "",hdHotel=_$("ctl00_plhBody_hidHotelname"); if(_cObj(hdHotel)) if(hdHotel.value != "") _hNm = hdHotel.value
//    var _dcPrm = "City Name : " + _dNm +" ; City Id : "+_dsV+" ; ";
//    if(_hNm!= "") var _dcPrm = "Hotel Name : " + _hNm +" ; ";
//    if(_cObj(_rsN)) if(_rsN != "") _dcPrm += "Location Name : " + _rsN +" ; Location Id : "+_rsV+" ; ";
//    _dcPrm += "Check In : "+_cInV+" ; Check Out : "+_cOutV+" ; Duration : "+_drV+ " ; ";
//    _dcPrm += "Rating : "+_rtV+" ; Adults : "+_adsV+" ; Childrens : " +_chdV+ " ; Infants : "+_infV;
//    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _dcPrm += "Airport : "+_iataC;
//    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _flag = "F";
//    if(_cObj(_flag)) cDCS(_flag, _dcPrm, _dNm)
//    // For Price Page Request
//    var _sb = _cid; _sb += "||"; _sb += _sid; _sb += "||"; _sb += _cityid; _sb += "||"; _sb += _locId; _sb += "||"; _sb += _dId; _sb += "||"; _sb += _type; _sb += "||"; _sb += _rsId; _sb += "||"; _sb += _airId; _sb += "||"; 
//    _sb += _hId; _sb += "||"; _sb += _cInD; _sb += "||";  _sb += _cOutD; _sb += "||"; _sb += _drV; _sb += "||"; _sb += _bdV; _sb += "||"; _sb += _board; _sb += "||"; _sb += _adsV; _sb += "||"; _sb += _chdV; _sb += "||"; 
//    _sb += _infV; _sb += "||"; _sb += _rV; _sb += "||"; _sb += _rtV; _sb += "||"; _sb += _aid; _sb += "||"; _sb += _lrN; _sb += "||"; _sb += _dstN; _sb += "||"; _sb += _dsV; _sb += "||"; _sb += _hNm;
//    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') { _sb += "||"; _sb += _iataC;  }
//    _$("hidPriceRequestValues").value = _sb;
//    //Create Cookie Items
//    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') crCk("FnHHotelly", _sb, 1)
//    else crCk("Hotelly", _sb, 1)
//    var _dVal = _$("ctl00_plhBody_hidDestText").value.split(", "); var _rName = _$("ctl00_plhBody_hidResortName").value; var _rsVal = _$("ctl00_plhBody_hidResortId").value;
//    if(_rsVal == "") _rsVal = "0";
//    var _postPage = ""; if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _postPage = "/Search/FlightHotelResult/";
//    else _postPage = "/Search/HotelResult/";
//    _postPage += _dVal[1] + "/"; _postPage += _dVal[0] + "/";
//    if(_lrN == "" || _lrN == "-- Any --") _lrN = "Any";
//    _postPage += _lrN + "/"; _postPage += _cInV + "/"; _postPage += _cOutV + "/";
//    _postPage += _cid + "_" + _cityid + "_" + _rsVal + "_" + _drV + "_" + _adsV  + "_" + _chdV; 
//    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _postPage += "_" + _iataC;
//    _postPage = ReplaceAll(_postPage, ".", ""); _postPage += ".aspx"; _postPage = urlUnEx(_postPage);
//    if(_cObj(_$("hidSearchBoxVal"))) {
//        try {
//            if(_cObj(window.parent.document.getElementById("ctl00_plhBody_hidAId"))) {
//                window.parent.document.myformPrice.target='_self'; window.parent.document.myformPrice.hidPriceResult.value = _sb; 
//                window.parent.document.myformPrice.method = "POST"; window.parent.document.myformPrice.action = _postPage; window.parent.document.myformPrice.submit();
//            }
//            else { 
//                document.myformPrice.target='_blank'; document.myformPrice.hidPriceResult.value = _sb; 
//                document.myformPrice.method = "POST"; document.myformPrice.action = _postPage; document.myformPrice.submit();
//            }
//        }
//        catch(e) {
//            document.myformPrice.target='_blank'; document.myformPrice.hidPriceResult.value = _sb;   
//            document.myformPrice.method = "POST"; document.myformPrice.action = _postPage; document.myformPrice.submit();
//        }
//    }
//    else {
//        document.myformPrice.target='_self'; document.myformPrice.hidPriceResult.value = _sb; 
//        document.myformPrice.method = "POST"; document.myformPrice.action = _postPage; document.myformPrice.submit();
//    }
//    return false;
//}

function cDCS(_flag, _dcPrm, _dNm)
{
//    if(_flag == "1") { DCS(1, 0, 'Home Page', 'Compare Prices', _dNm, _dcPrm ); }
    if(_flag == "2") { DCS(1, 0, 'Search Results', 'Compare Prices', _dNm, _dcPrm ); }
    if(_flag == "3") { DCS(1, 0, 'Dynamic Results', 'Compare Prices', _dNm, _dcPrm ); }
    if(_flag == "4") { DCS(1, 0, 'Search Box', 'Compare Prices', _dNm, _dcPrm ); }
    if(_flag == "5") { DCS(1, 0, 'DDLP', 'Compare Prices', _dNm, _dcPrm ); }
//    if(_flag == "F") { DCS(1, 0, 'Home Page', 'FnH Compare Prices', _dNm, _dcPrm ); }
//    if(_flag == "FH"){ DCS(1, 0, 'FnH Search Results', 'Compare Prices', _dNm, _dcPrm ); }
}
function dMDS()
{
    var ddlDidYouMean = _$("ctl00_plhBody_ddlDidYouMeanDest"); _$("divDestMessage").style.display = "none"; var w = _$("ctl00_plhBody_ddlDidYouMeanDest").selectedIndex;
    _$("ctl00_plhBody_hidDestText").value = _$("ctl00_plhBody_ddlDidYouMeanDest").options[w].text;  _$("ctl00_plhBody_txtDestination").value = _$("ctl00_plhBody_hidDestText").value;
    _$("ctl00_plhBody_hidDestValue").value = ddlDidYouMean.value;
    var _dId = _$("ctl00_plhBody_hidDestValue").value; _$("ctl00_plhBody_hidResortId").value = "0"; _$("ctl00_plhBody_hidResortName").value = "";
    dSr(_dId); if(_cObj(_$('ctl00_plhBody_ddlHotelName')))hSr(_dId,"-1");var _dsVs = _dId.split(","); var _destType = _dsVs[5]; var _bType = _dsVs[6]; var _hCount = _dsVs[7];
    if(_hCount > 0) _$("lblHotelsCount").innerHTML ="for " + _hCount + " Hotels";
    else _$("lblHotelsCount").innerHTML = "";
    if(_cObj(_$("hidFnH"))) if(_$("hidFnH").value == '2') _$("lblHotelsCount").innerHTML = "";
    _$("ctl00_plhBody_hidDestType").value = _destType; _$("ctl00_plhBody_hidBType").value = _bType;
    if(_cObj(_$('ctl00_plhBody_ddlDuration')))
    {
           if(_destType == "C") {
            if(_bType != "True") { pDr("1", _$("ctl00_plhBody_ddlDuration"));           
                if(_cObj(_$('ctl00_plhBody_hotelCheckin')) &&_$("ctl00_plhBody_hotelCheckin").value != "" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In") { cOutDate("2"); setTimeout("pDur(2)" , 500); }
            }
            else { pDr("1", _$("ctl00_plhBody_ddlDuration"));
                _$("ctl00_plhBody_ddlBoard").value = "HB"; _$("ctl00_plhBody_ddlBoard").disabled=false;
                if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In") { cOutDate("7"); setTimeout("pDur(7)" , 500); }
            }
        }
        else { pDr("1", _$("ctl00_plhBody_ddlDuration"));  
            if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In") { cOutDate("7"); setTimeout("pDur(7)" , 500); }
        } 
    }    
    _$("divDidYouMeanDest").style.display = "none"; return false;
}
function didYouMeanDestSelected() { dMDS() }

function gRLId(_rsId)
{
    var _resId = _rsId.split("||"); _$("ctl00_plhBody_hidResortId").value = _resId[0];
    var _hCount = _resId[1]; var w = _$("ctl00_plhBody_ddlResort").selectedIndex;
    _$("ctl00_plhBody_hidResortName").value = _$("ctl00_plhBody_ddlResort").options[w].text;
    if(_resId != 0) {
        if(_hCount > 0) { _$("lblHotelsCount").innerHTML = "for " + _hCount + " Hotels"; }
        else { _$("lblHotelsCount").innerHTML = ""; }
    }
    else {
        if(_$("hidHcount").value != "") _$("lblHotelsCount").innerHTML = "for " + _$("hidHcount").value + " Hotels";
        else _$("lblHotelsCount").innerHTML = "";
    }
    if(_cObj(_$("hidFnH"))) if(_$("hidFnH").value == '2') _$("lblHotelsCount").innerHTML = "";
}

function gDDf()
{
    var one_day=1000*60*60*24;  var cInV = _$("ctl00_plhBody_checkinValue").value; var cOutV = _$("ctl00_plhBody_checkoutValue").value;
    var x=cInV.split("-"); var y=cOutV.split("-");
    var d1=new Date(x[2],(x[1]-1),x[0]); var d2=new Date(y[2],(y[1]-1),y[0]);
    var month1=x[1]-1; var month2=y[1]-1;
    var _Diff=Math.ceil((d2.getTime()-d1.getTime())/(one_day)); 
    if(_Diff != "NaN") {
        if(_Diff <1) {
            alert("Check-out date must be greater than Check-in date"); _$("ctl00_plhBody_hotelCheckout").value="";
            var _cIn = _$("ctl00_plhBody_checkinValue").value; var x=_cIn.split("-");     
            var d1=new Date(x[2],(x[1]-1),x[0]); var totalDate;
            if(_$("ctl00_plhBody_hidDestType").value !="C") totalDate = new Date(d1.getTime()+(7*one_day));
            else totalDate = new Date(d1.getTime()+(2*one_day));
            var _d = totalDate.getDate().toString();
            if(_d.length ==1) _d = 0+_d;
            var _m = totalDate.getMonth(); _m= (_m+1).toString(); if(_m.length ==1) _m = 0+(_m); var _y = totalDate.getFullYear();
            _$("ctl00_plhBody_hotelCheckout").value = GFD(_d + "-" + _m + "-" + _y); _$("ctl00_plhBody_checkoutValue").value = _d + "-" + _m + "-" + _y;
            var _bType = "False"; if(_cObj(_$("ctl00_plhBody_hidBType"))) _bType = _$("ctl00_plhBody_hidBType").value;
            if(_$("ctl00_plhBody_hidDestType").value !="C") { cOutDate("7"); setTimeout("pDur(7)" , 300); }
            else { if(_bType != "True") { cOutDate("2"); setTimeout("pDur(2)" , 300); }
                else { cOutDate("7");setTimeout("pDur(7)" , 300);}
            }
            hpCal(''); return false;
        }
        else { if(_Diff >30) {
                    alert("Check out date can not be vary from selected duration values!"); _$("ctl00_plhBody_hotelCheckout").value="";
                    var _cIn = _$("ctl00_plhBody_checkinValue").value; var x=_cIn.split("-");     
                    var d1=new Date(x[2],(x[1]-1),x[0]); var totalDate;
                    if(_$("ctl00_plhBody_hidDestType").value !="C") totalDate = new Date(d1.getTime()+(7*one_day));
                    else totalDate = new Date(d1.getTime()+(2*one_day));
                    var _d = totalDate.getDate().toString(); if(_d.length ==1) _d = 0+_d;
                    var _m = totalDate.getMonth(); _m= (_m+1).toString(); if(_m.length ==1) _m = 0+(_m);
                    var _y = totalDate.getFullYear();
                    _$("ctl00_plhBody_hotelCheckout").value = GFD(_d + "-" + _m + "-" + _y); _$("ctl00_plhBody_checkoutValue").value = _d + "-" + _m + "-" + _y;
                    var _bType = "False"; if(_cObj(_$("ctl00_plhBody_hidBType"))) _bType = _$("ctl00_plhBody_hidBType").value;
                    if(_$("ctl00_plhBody_hidDestType").value !="C") { cOutDate("7"); setTimeout("pDur(7)" , 300); }
                    else { if(_bType != "True") { cOutDate("2"); setTimeout("pDur(2)" , 300); }
                        else { cOutDate("7"); setTimeout("pDur(7)" , 300); } 
                    }
                    hpCal(''); return false;
            }
            else { var _duration = _$("ctl00_plhBody_ddlDuration"); _duration.value = _Diff; return true; }
        }
    }
    else { var _duration = _$("ctl00_plhBody_ddlDuration"); _duration.value = 2; return true; }
}
function cOutDate(_dur)
{
    var one_day=1000*60*60*24;
    if(_dur != '--' && _dur != 0) {
        if(_$("ctl00_plhBody_hotelCheckin").value=="" && _$("ctl00_plhBody_hotelCheckin").value != "Check-In")  {
            alert("Check-in date can not be blank!"); var _duration = _$("ctl00_plhBody_ddlDuration"); _duration.value = 1; return false; }
        else { var _cIn = _$("ctl00_plhBody_checkinValue").value;
            var x=_cIn.split("-");  var d1=new Date(x[2],(x[1]-1),x[0]); var totalDate = new Date(d1.getTime()+(_dur*one_day));
            var _d = totalDate.getDate().toString(); if(_d.length ==1) _d = 0+_d;
            var _m = totalDate.getMonth(); _m= (_m+1).toString(); if(_m.length ==1) _m = 0+(_m);
            var _y = totalDate.getFullYear();
            _$("ctl00_plhBody_hotelCheckout").value = GFD(_d + "-" + _m + "-" + _y); _$("ctl00_plhBody_checkoutValue").value = _d + "-" + _m + "-" + _y;
            hpCal('');
        }
    }
    else { _$("ctl00_plhBody_hotelCheckout").value = ""; _$("ctl00_plhBody_checkoutValue").value = ""; }
}
function setDates()
{
    var _dType = _$("ctl00_plhBody_hidDestType").value; _$("ctl00_plhBody_hotelCheckout").value = "";
    var one_day=1000*60*60*24; var _cIn = _$("ctl00_plhBody_checkinValue").value;
    var x=_cIn.split("-"); var d1=new Date(x[2],(x[1]-1),x[0]); var totalDate;
    var _duration = _$("ctl00_plhBody_ddlDuration"); var _bType = "False";
    if(_cObj(_$("ctl00_plhBody_hidBType"))) _bType = _$("ctl00_plhBody_hidBType").value;
    if(_dType != "C" && _dType != "") { cOutDate("7"); setTimeout("pDur(7)" , 500); }
    else { if(_bType != "True") { cOutDate("2"); setTimeout("pDur(2)" , 500); } else { cOutDate("7"); setTimeout("pDur(7)" , 500); } }   
    var _d = totalDate.getDate().toString(); if(_d.length ==1) _d = 0+_d;
    var _m = totalDate.getMonth(); _m= (_m+1).toString(); if(_m.length ==1) _m = 0+(_m);
    var _y = totalDate.getFullYear();
    _$("ctl00_plhBody_hotelCheckout").value = GFD(_d + "-" + _m + "-" + _y); _$("ctl00_plhBody_checkoutValue").value = _d + "-" + _m + "-" + _y;
    hpCal('');
}
//function gDstSQ(_sQr)
//{
//    _$("imgLoading").style.display = "inline"; 
//    var _fnh = '1'; if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
//    if(_sQr != "") {
//        var theDate = new Date(); var rU = "/Search/AjaxImpl.aspx?page=ind&sq="+_sQr +"&fnh="+_fnh+"&dt="+ theDate.getTime();
//         var XmlHttp = CreateXmlHttp();
//         if(XmlHttp) { XmlHttp.onreadystatechange = function(){
//	            if(XmlHttp.readyState == 4) {
//		            if(XmlHttp.status == 200) { sMDst(XmlHttp.responseText); }		
//	            }
//            }
//		    XmlHttp.open("GET", rU,  true);
//		    XmlHttp.send(null);		
//	     }
//    }
//}
function gDstSQ(_sQr)
{
    _$("imgLoading").style.display = "inline"; 
    var _fnh = '1'; if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
    if(_sQr != "") {
        var theDate = new Date(); var rU = "/Search/AjaxHome.aspx?page=ind&sq="+_sQr +"&fnh="+_fnh+"&dt="+ theDate.getTime();
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp) { XmlHttp.onreadystatechange = function(){
	            if(XmlHttp.readyState == 4) {
		            if(XmlHttp.status == 200) { sMDst(XmlHttp.responseText); }		
	            }
            }
		    XmlHttp.open("GET", rU,  true);
		    XmlHttp.send(null);		
	     }
    }
}
//function sMDst(rX)
//{
//    if(rX!="") {  
//        var xD =crXD(rX); var ndD, _ndCity, _ndR;
//        if(_cObj(xD.selectNodes("ISD/UL/li"))) {
//            ndD = xD.selectNodes("ISD/UL/li");
//            if(_cObj(ndD)) {
//                if(ndD.length > 0) {
//                    if(ndD.length == 1) {
//                        var _did = ndD[0].getAttribute("id"); var _tVal = GIH(ndD[0]);
//                        _tVal = ReplaceAll(_tVal,"|", ", "); dLS(_did, _tVal)
//                    }
//                    else {
//                        if(_cObj(_$("divDidYouMeanDest"))) _$("divDidYouMeanDest").style.display = "block";
//                        if(_cObj(_$("destDivContainer"))) _$("destDivContainer").style.display = "none";
//                        if(_cObj(_$("divDestMessage"))) _$("divDestMessage").style.display = "none";
//                        var ddlDidYouMeanDest = _$("ctl00_plhBody_ddlDidYouMeanDest");
//                        var _sQ = _$("ctl00_plhBody_hidDestSearchQuery").value; var _opI;
//                        for (var count = ddlDidYouMeanDest.options.length-1; count >-1; count--) { ddlDidYouMeanDest.options[count] = null; }
//                        _opI = new Option( "-- Please Select --", "",  false, false);
//                        ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = _opI; 
//                        for(var _rCt=0; _rCt < ndD.length; _rCt++) {
//                            var _tV = GIH(ndD[_rCt]); _tV = ReplaceAll(_tV,"|", ", ");
//                            var _dId = ndD[_rCt].getAttribute("id"); var _opI = new Option(_tV, _dId);
//                            ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = _opI;
//                        }
//                    }
//                }
//                else {
//                    _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block";
//                    _$("lblDestErrMessage").innerHTML = "Please enter valid destination!"; _$("lblHotelsCount").innerHTML = "";
//                }
//            }
//        }
//        else if(_cObj(xD.selectNodes("IATA/UL/li"))) {
//            ndD = xD.selectNodes("IATA/UL/li");
//            if(_cObj(ndD)) {
//                if(ndD.length > 0) {
//                    for(var _rCt=0; _rCt < ndD.length; _rCt++) {
//                        var _tV = GIH(ndD[_rCt]); _tV = ReplaceAll(_tV,"|", ", ");
//                        var _dId = ndD[_rCt].getAttribute("id"); var _opI = new Option(_tV, _dId);
//                        ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = _opI;
//                    }
//                }
//            }
//        }
//    }
//    _$("imgLoading").style.display = "none";
//    var ddlResort = _$("ctl00_plhBody_ddlResort"); var _opI;
//    for (var count = ddlResort.options.length-1; count >-1; count--) { ddlResort.options[count] = null; }
//    _opI = new Option( "-- Any --", "0",  false, false); ddlResort.options[ddlResort.length] = _opI; 
//}
function sMDst(rX)
{
    if(rX!="") 
    { 
        var arrData=rX.split('|##');    
        if(arrData[1].length>0)
        {    
            var _opI,_tV,_dId;      
            var JObj = eval('(' + arrData[1] + ')');             
            if(_cObj(_$("divDidYouMeanDest"))) _$("divDidYouMeanDest").style.display = "block";
            if(_cObj(_$("destDivContainer"))) _$("destDivContainer").style.display = "none";
            if(_cObj(_$("divDestMessage"))) _$("divDestMessage").style.display = "none";
            var ddlDidYouMeanDest = _$("ctl00_plhBody_ddlDidYouMeanDest");
            if(_cObj(_$("ctl00_plhBody_hidDestSearchQuery")))
            var _sQ = _$("ctl00_plhBody_hidDestSearchQuery").value; 
            for (var count = ddlDidYouMeanDest.options.length-1; count >-1; count--) { ddlDidYouMeanDest.options[count] = null; }
            _opI = new Option( "-- Please Select --", "",  false, false);
            ddlDidYouMeanDest.options[0] = _opI;               
            for(var i = 0; i < JObj.InSe.length; i++) 
            {
                _tV = JObj.InSe[i].INm;              
                _dId = JObj.InSe[i].IKy;         
                _opI = new Option(_tV, _dId);
                ddlDidYouMeanDest.options[i+1] = _opI;
            }            
        }
        else 
        {
            _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block";
            _$("lblDestErrMessage").innerHTML = "Please enter valid destination!"; _$("lblHotelsCount").innerHTML = "";
        }
    }
    _$("imgLoading").style.display = "none";
    var ddlResort = _$("ctl00_plhBody_ddlResort"); var _opI;
    for (var count = ddlResort.options.length-1; count >-1; count--) { ddlResort.options[count] = null; }
    _opI = new Option( "-- Any --", "0",  false, false); ddlResort.options[ddlResort.length] = _opI; 
}
function clearDestValues()
{
    _$("ctl00_plhBody_hidDestValue").value = ""; _$("ctl00_plhBody_hidDestText").value = ""; _$("ctl00_plhBody_hidResortId").value = ""; _$("ctl00_plhBody_hidResortName").value = ""; return false;
}
function dstKeyDwn(event)
{
    if(_cObj(_$("divDestMessage"))) _$("divDestMessage").style.display = "none";
    if(_cObj(_$("divDestRevMessage"))) _$("divDestRevMessage").style.display = "none";
    if(_cObj(_$("divHotelRevMessage"))) _$("divHotelRevMessage").style.display = "none";
    if (event.keyCode == 8 || event.keyCode == 127) { _$("ctl00_plhBody_hidDestValue").value = ""; }
    if (event.keyCode == 13) { event.returnValue=false; event.cancel = true; _$("ctl00_plhBody_compare_btn").focus(); _$("ctl00_plhBody_compare_btn").click(); }
}
function dSr(_dId)
{   
    _$("imgLoading").style.display = "inline";
    if(_dId!="") {
        var _fnh = '1'; if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
         var theDate = new Date(); var rU = "/Search/AjaxImpl.aspx?page=d&DName="+_dId+"&fnh="+_fnh+"&dt="+ theDate.getTime();
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp) { XmlHttp.onreadystatechange = function() { 
                if(XmlHttp.readyState == 4) {
	                if(XmlHttp.status == 200) { sRsI(XmlHttp.responseText, "DEST"); }		
                }
	        }
    		XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
	     }
    }
}
function sRsI(_rsX, _flag)
{
    var ddlResort = _$("ctl00_plhBody_ddlResort"); var _opI;
    for (var count = ddlResort.options.length-1; count >-1; count--) { ddlResort.options[count] = null; }
    _opI = new Option( "-- Any --", "",  false, false); ddlResort.options[ddlResort.length] = _opI; 
    if(_rsX!="") {  
        var xD =crXD(_rsX);
        var _ndRs, _ndR; _ndRs = xD.selectNodes("DR/R");
        if(_cObj(_ndRs)) {
            if(_ndRs.length > 0) { ddlResort.disabled=false;
                for(var _rCt=0; _rCt < _ndRs.length; _rCt++) {
                   var _tV = _ndRs[_rCt].getAttribute("n");  var _rsId = _ndRs[_rCt].getAttribute("id") + "||" + _ndRs[_rCt].getAttribute("HCount"); 
                   var _opI = new Option(_tV, _rsId); ddlResort.options[ddlResort.length] = _opI;
                }
                if(_flag == "COOKIE") {
                    for(var _rCD=0; _rCD < _ndRs.length; _rCD++) {
                        if(_$("ctl00_plhBody_hidResortId").value == _ndRs[_rCD].getAttribute("id"))  { ddlResort.options.selectedIndex = _rCD+1; }
                    } 
                }
            } 
            else { _ndRs = xD.selectNodes("C/L");
                if(_cObj(_ndRs)) { if(_ndRs.length > 0) { ddlResort.disabled=false;
                        for(var _rCt=0; _rCt < _ndRs.length; _rCt++) {
                           var _tV = _ndRs[_rCt].getAttribute("n");  var _rsId = _ndRs[_rCt].getAttribute("id") + "||" + _ndRs[_rCt].getAttribute("HCount"); 
                           var _opI = new Option(_tV, _rsId); ddlResort.options[ddlResort.length] = _opI;
                        }
                        if(_flag == "COOKIE") {
                            for(var _rC=0; _rC < _ndRs.length; _rC++) {
                                if(_$("ctl00_plhBody_hidResortId").value == _ndRs[_rC].getAttribute("id"))  { ddlResort.options.selectedIndex = _rC+1; }
                            }
                        }
                    }
                    else { ddlResort.disabled=true; }   
                }
                else { ddlResort.disabled=true; }
            }  
        }
        else { ddlResort.disabled=true; }
    }
    _$("imgLoading").style.display = "none";
}

function fRsCk(_dId)
{
    if(_dId!="") {
         var theDate = new Date(); var rU = "/Search/AjaxImpl.aspx?page=d&DName="+_dId +"&dt="+ theDate.getTime();
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp) {
		    XmlHttp.onreadystatechange = function () {
	            if(XmlHttp.readyState == 4) {
	            if(XmlHttp.status == 200) { sRsI(XmlHttp.responseText, "COOKIE"); }		
	            }
	        }
	        XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
	     }
    }
}
function fIaCk(_dId)
{    
    if(_dId!="") {
         var theDate = new Date(); var rU = "/Search/AjaxImpl.aspx?page=IATA&chr="+_dId +"&rq=0&fnh=2&dt="+ theDate.getTime();
         var XmlHttp = CreateXmlHttp();
         if(XmlHttp) { XmlHttp.onreadystatechange = function () {
		    if(XmlHttp.readyState == 4) {
		            if(XmlHttp.status == 200) { IataX(XmlHttp.responseText, "COOKIE"); }		
	            }
	        }
    		XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
	     }
    }
}

function rCk(name)
{
    var ca = document.cookie.split(';'); var nEQ = name + "=";
    for(var i=0; i < ca.length; i++)  {
        var c = ca[i]; while (c.charAt(0)==' ')  c = c.substring(1, c.length);
        if (c.indexOf(nEQ) == 0) {
            var _cValues = c.substring(nEQ.length, c.length).split("||"); 
            if(_cValues.length > 0) {
                _$("ctl00_plhBody_txtDestination").value = _cValues[21]; _$("ctl00_plhBody_hidDestText").value  = _cValues[21];
                _$("ctl00_plhBody_hidDestValue").value = _cValues[22]; _$("ctl00_plhBody_hotelCheckin").value = GFD(_cValues[9]);
                _$("ctl00_plhBody_checkinValue").value = _cValues[9]; _$("ctl00_plhBody_hotelCheckout").value = GFD(_cValues[10]);
                _$("ctl00_plhBody_checkoutValue").value = _cValues[10]; _$("ctl00_plhBody_ddlDuration").value = _cValues[11];
                _$("ctl00_plhBody_ddlRating").value = _cValues[18]; _$("ctl00_plhBody_ddlAdult").value = _cValues[14];
                _$("ctl00_plhBody_ddlChildren").value = _cValues[15]; _$("ctl00_plhBody_ddlInfants").value = _cValues[16];
                _$("ctl00_plhBody_hidResortName").value = _cValues[20]; _$("ctl00_plhBody_hidResortId").value = _cValues[3];
                if(_cObj(_$('hidFnH')) && _$('hidFnH').value == '2') if(_cObj(_$("ctl00_plhBody_ddlAirport"))) _$("ctl00_plhBody_ddlAirport").value = _cValues[24];
                var  _destType = _cValues[5]; _$("ctl00_plhBody_hidDestType").value = _destType;
                var _dVal = _cValues[22].split(","); var _bType = _dVal[6]; _$("ctl00_plhBody_hidBType").value = _bType;
                if(_cObj(_$('ctl00_plhBody_ddlDuration')))
                {
                  if(_destType =="C") {
                        if(_bType != "True") { pDr("0", _$("ctl00_plhBody_ddlDuration"));                     
                            if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "") { setTimeout("pDur('"+_cValues[11]+"')" , 500); }
                        }
                        else { pDr("1", _$("ctl00_plhBody_ddlDuration"));
                            _$("ctl00_plhBody_ddlBoard").value = "HB"; _$("ctl00_plhBody_ddlBoard").disabled=false;
                            _$("ctl00_plhBody_ddlBoard").value = _cValues[13];
                            if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "") { setTimeout("pDur('"+_cValues[11]+"')" , 500); }
                        }
                    }
                    else { pDr("1", _$("ctl00_plhBody_ddlDuration"));                 
                        if(_cObj(_$('ctl00_plhBody_hotelCheckin')) && _$("ctl00_plhBody_hotelCheckin").value != "") {  setTimeout("pDur('"+_cValues[11]+"')" , 500); }
                    }
                }                
                _$("ctl00_plhBody_hidResortId").value = _cValues[3];
                fRsCk(_cValues[22]); erCk(name)
            }    
        }
    }
    return false;
}
function crDVSec()
{
     var _afId = _$("ctl00_plhBody_hidAffiliateId").value;// var divDefMovie = _$("ctl00_plhBody_divDefaultMovie");
     _$("ctl00_plhBody_divDefaultMovie").innerHTML = '<embed type="application/x-shockwave-flash" src="http://s1.slipstreamvideo.com/player/vidplayer_ssv20.swf?v=1.0.9" style="" id="ssvplayer_48464" name="ssvplayer_48464" quality="high" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" flashvars="stage_width=396&amp;stage_height=294&amp;sname=2560&amp;location=http://localhost:3597/Search/HomePage.aspx&amp;ssv_skin=thin&amp;ssv_autoPlay=false" align="middle" height="294" width="396">';
     //var ssvplayer = new SSVPlayer(); ssvplayer.vwidth = 396; ssvplayer.vheight = 270; ssvplayer.video = 2560; ssvplayer.player_interface = 1; ssvplayer.skin = "thin"; ssvplayer.autoPlay = false; ssvplayer.load(divDefMovie);
//     var _vdU = document.getElementById("ctl00_HtlyVidDir").value + "/HotellyHomePage.flv";
//     WVE(_vdU,_$("ctl00_plhBody_divDefaultMovie"),"293", "396" , "0" , "/Search/Images/"+_afId+"/HotellyHomePlayer.gif"); 
}
function crDfPly(vURL, height, width,dv,vDir)
{
    try{
        if(_cObj(dv)){ cldv(dv); }
        var dvChild = crE('DIV'); dvChild.id="divC"; dv.appendChild(dvChild);
        var s1 = new SWFObject("/Search/Player/player.swf?skin=/Search/Player/skin.swf","ply",width,height,"9","#FFFFFF");
        s1.addParam("allowfullscreen","true"); s1.addParam("allowscriptaccess","always"); s1.addParam("flashvars","logo=Player/watermark_logo_bw.gif&file="+vURL); s1.write('divC');
   }catch(e){}
}
function homeTab(_v)
{
    if(_cObj(_$('hidFnH'))) _$('hidFnH').value = _v
    if(_v == '1') {
        _$('hotel_label').className = "selected"; _$('flightandhotel_label').className = "";
        _$('lblCin').innerHTML = "Check-in date:"; _$('lblCout').innerHTML = "Check-out date:";
        _$('divAir').style.display = "none"; clearVal("e.g. Paris"); rCk("Hotelly");
    }
    else {
        _$('hotel_label').className = ""; _$('flightandhotel_label').className = "selected";
        _$('lblCin').innerHTML = "Departure dates:"; _$('lblCout').innerHTML = "Return dates:";
        _$('divAir').style.display = "block"; clearVal("e.g. Costa Del Sol"); dIS('IATA', '184', '0'); rCk("FnHHotelly");
    }
}
function clearVal(_ch)
{
    _$("divDestMessage").style.display = "none"; _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "none";
    _$("ctl00_plhBody_txtDestination").value=""; _$("ctl00_plhBody_txtDestination").value= _ch; _$("lblDestErrMessage").innerHTML = "";
    _$("lblHotelsCount").innerHTML = ""; _$("ctl00_plhBody_hidDestValue").value =""; _$("ctl00_plhBody_hidDestSearchQuery").value = "";
    _$("ctl00_plhBody_hotelCheckin").value=""; _$("ctl00_plhBody_hotelCheckout").value=""; _$("ctl00_plhBody_hidDestText").value = "";
    _$("ctl00_plhBody_hidDestValue").value = ""; _$("ctl00_plhBody_hidResortName").value = ""; _$("ctl00_plhBody_hidOptionValues").value = "";
    _$("ctl00_plhBody_hidResortId").value =""; _$("ctl00_plhBody_checkinValue").value = ""; _$("ctl00_plhBody_checkoutValue").value = "";
    _$("ctl00_plhBody_hidPriceReqValues").value = ""; _$("hidPriceRequestValues").value = "";
    setDfDt("ctl00_plhBody_hotelCheckin", 7, "ctl00_plhBody_checkinValue"); _$("ctl00_plhBody_ddlDuration").selectedIndex = "7";  setDfDt("ctl00_plhBody_hotelCheckout", 14, "ctl00_plhBody_checkoutValue");
    var ddlResort; var ddlAirport;var ddlBoard;
    if(_cObj(_$("ctl00_plhBody_ddlResort"))) ddlResort = _$("ctl00_plhBody_ddlResort");
    if(_cObj(_$("ctl00_plhBody_ddlAirport"))) ddlAirport = _$("ctl00_plhBody_ddlAirport"); 
    if(_cObj(_$("ctl00_plhBody_ddlBoard"))) ddlBoard = _$("ctl00_plhBody_ddlBoard");
    var _opI;  for (var count = ddlResort.options.length-1; count >-1; count--){ ddlResort.options[count] = null; }
    _opI = new Option( "-- Any --", "",  false, false); ddlResort.disabled=false; ddlResort.options[ddlResort.length] = _opI; 
    var _optionAir; for (var count = ddlAirport.options.length-1; count >-1; count--) { ddlAirport.options[count] = null; }
    _optionAir = new Option( "--Select--", "-1",  false, false); ddlAirport.disabled=false; ddlAirport.options[ddlAirport.length] = _optionAir; 
    var _optionBrd; for (var count = ddlBoard.options.length-1; count >-1; count--) { ddlBoard.options[count] = null; }
    _optionBrd = new Option( "--Select---", "-1",  false, false); ddlBoard.disabled=false; ddlBoard.options[ddlAirport.length] = _optionAir; 
    return false;
}
function saveSearchEmail(_email)
{
    var _aid = _$("ctl00_plhBody_hidAffiliateId").value;
    var theDate = new Date(); var rU = "/Search/AjaxImpl.aspx?analytics=email&aid="+_aid+"&e="+_email+"&dt="+ theDate.getTime();
    var XmlHttp = CreateXmlHttp();
    if(XmlHttp) { XmlHttp.open("GET", rU, false); XmlHttp.setRequestHeader("Content-Type", "application/xml; charset=utf-8"); XmlHttp.send(null); }    
}

// Amit: For FnH change
function validatePriceSearch(_flag)
{   
    _rqDest += 1;
    if(_$("divDestMessage").style.display != "none") _$("divDestMessage").style.display = "none";
    if(_cObj(_$("divDestRevMessage"))) if(_$("divDestRevMessage").style.display != "none") _$("divDestRevMessage").style.display = "none";
    if(_cObj(_$("divHotelRevMessage"))) if(_$("divHotelRevMessage").style.display != "none") _$("divHotelRevMessage").style.display = "none";
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2')
    {
         if(_$("ctl00_plhBody_txtDestination").value=="" || _$("ctl00_plhBody_txtDestination").value=="e.g. Paris" || _$("ctl00_plhBody_txtDestination").value=="e.g. Costa Del Sol")  {
            _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block"; _$("lblDestErrMessage").innerHTML = "Please enter a destination first!"; _$("lblHotelsCount").innerHTML = ""; return false;  }
        
        if(_$("ctl00_plhBody_hidDestValue").value =="" && _$("divHlnk").style.display == "none"){_$("divHlnk").style.display = "block";rstArRe();return false;}             
        
        if(_$("ctl00_plhBody_hidDestValue").value =="" && _$("divHlnk").style.display == "block")
            {_$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block"; _$("lblDestErrMessage").innerHTML = "Please enter valid destination!"; _$("lblHotelsCount").innerHTML = ""; return false;  }
    }
    else
    {
        if(_$("ctl00_plhBody_txtDestination").value=="" || _$("ctl00_plhBody_txtDestination").value=="e.g. Paris" || _$("ctl00_plhBody_txtDestination").value=="e.g. Costa Del Sol")  {
        _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block"; _$("lblDestErrMessage").innerHTML = "Please enter a destination first!"; _$("lblHotelsCount").innerHTML = ""; return false;  }
        if(_$("ctl00_plhBody_hidDestValue").value =="") { _$("divDestMessage").style.display = "none";
            if(_$("ctl00_plhBody_txtDestination").value!="")  {
            _$("ctl00_plhBody_hidDestSearchQuery").value = _$("ctl00_plhBody_txtDestination").value;
            gDstSQ(_$("ctl00_plhBody_txtDestination").value); }
        _$("ctl00_plhBody_txtDestination").focus(); _$("divDestMessage").style.display = "none"; return false;}  
    }
    
    if(_$("ctl00_plhBody_hotelCheckin").value=="") 
    {
        if(_cObj(_$('hidFnH')) && _$('hidFnH').value == '2')
            alert("Departure date can not be blank!"); 
         else       
            alert("Check-in date can not be blank!"); 
        return false; 
    }
    if(_$("ctl00_plhBody_hotelCheckout").value=="") 
    {
        if(_cObj(_$('hidFnH')) && _$('hidFnH').value == '2')
            alert("Return date can not be blank!"); 
        else        
            alert("Check-out date can not be blank!"); 
        return false;
    }
    if(_cObj(_$("txtEmail")) && _$("txtEmail").value != "" && _$("txtEmail").value != "Please enter your email") {
        if(!echeck(_$("txtEmail").value)) { alert("Please enter valid email address!"); return false; }
        else { saveSearchEmail(_$("txtEmail").value); }
    }
    if(_$("ctl00_plhBody_ddlRooms") != null) { var _rooms = _$("ctl00_plhBody_ddlRooms").value; var _rmV;
        if(_rooms>1) {  var _adultV = _$("ctl00_plhBody_ddlAdult").value;
            for(var _rmC=1; _rmC<_rooms; _rmC++) { var _adN = "ddlAdult" + _rmC; var _adV = _$(_adN).value; _adultV += ":" + _adV }
            var _chV = _$("ctl00_plhBody_ddlChildren").value;
            for(var _rmC=1; _rmC<_rooms; _rmC++) { var _adN = "ddlChildren" + _rmC; var _adV = _$(_adN).value; _chV += ":" + _adV }
            var _infantValue = _$("ctl00_plhBody_ddlInfants").value;
            for(var _rmC=1; _rmC<_rooms; _rmC++) { var _adN = "ddlInfants" + _rmC; var _adV = _$(_adN).value; _infantValue += ":" + _adV }
            _rmV = _adultV + ";" + _chV + ";" + _infantValue; _$("ctl00_plhBody_hidRoomValues").value = _rmV;
        }
    }
    var _dsN, _dsV, _rsN, _rsV, _cInV, _cOutV ; 
    if(_$("ctl00_plhBody_hidDestText").value == "") { _dsN = _$("ctl00_plhBody_hidDestText").value; _dsV = _$("ctl00_plhBody_hidDestValue").value; }
    if(_$("ctl00_plhBody_hidResortName").value == "") { _rsN = _$("ctl00_plhBody_hidDestText").value; _rsV = _$("ctl00_plhBody_hidDestValue").value; }
    _cInV = _$("ctl00_plhBody_checkinValue").value; _cOutV = _$("ctl00_plhBody_checkoutValue").value;
    var _adsV, _chdV, _infV, _drV, _rtV, _bdV, _rV;
    _adsV = _$("ctl00_plhBody_ddlAdult").value; _chdV = _$("ctl00_plhBody_ddlChildren").value; _infV = _$("ctl00_plhBody_ddlInfants").value;
    _rtV = _$("ctl00_plhBody_ddlRating").value; _bdV = _$("ctl00_plhBody_ddlBoard").value; _drV = _$("ctl00_plhBody_ddlDuration").value; _rV = _$("ctl00_plhBody_ddlRooms").value;
    _$("ctl00_plhBody_hidOptionValues").value = _drV + "|" + _bdV + "|" + _rtV + "|" + _rV + "|" + _adsV + "|" + _chdV + "|" + _infV;
    //Create QueryString for Price Result Page
    var _dsV, _cid, _sid, _cityid, _locId, _hId, _type, _dId, _rsId, _airId, _cInD, _cOutD, _lrN, _aid, _dstN, _board;
    _dstN = _$("ctl00_plhBody_hidDestText").value; var _dVal = _dstN.split(", ");
    if(_$("ctl00_plhBody_hidDestValue").value != "") {       
        _dsV = _$("ctl00_plhBody_hidDestValue").value.split(',');
        /*_cid = _dsV[0]; _sid = _dsV[1]; _cityid = _dsV[2]; _locId = _dsV[3]; _hId = _dsV[4]; _type = _dsV[5];
        if (_type != "C") { _dId = _locId; _locId = "0"; _rsId = _$("ctl00_plhBody_hidResortId").value; }
        else { _dId = "0"; _locId = _$("ctl00_plhBody_hidResortId").value; _rsId = "0"; }*/
        if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2')
        {
           _hId=0; _cid = _dsV[0]; _sid = _dsV[1]; _cityid = _dsV[2]; _dId = "0"; _locId = _dsV[4]; _type = _dsV[5];_rsId = "0";            
        }
        else
        {
           _hId=0; _cid = _dsV[0]; _sid = _dsV[1]; _cityid = _dsV[2]; _dId = "0";_locId = _$("ctl00_plhBody_hidResortId").value; _rsId = "0";_type = _dsV[5];
           _dstN=_dVal[1]+", "+_dVal[0]; _dVal=_dstN.split(', '); 
        }
        
    }
    _airId = "0";
    _cInD = _$("ctl00_plhBody_checkinValue").value; _cOutD = _$("ctl00_plhBody_checkoutValue").value;
    _lrN = _$("ctl00_plhBody_hidResortName").value; _aid = _$("ctl00_plhBody_hidAffiliateId").value;
    var _iataC,ddlApt=_$("ctl00_plhBody_ddlAirport"); if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2' && _cObj(ddlApt)) _iataC = ddlApt.value;if(_iataC =='-1'){alert('Please select a departure airport'); return false; } 
    _board = _$("ctl00_plhBody_ddlBoard").value;if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2' && _board =='-1'){alert('Please select a Board Basis'); return false; } 
    var _dNm = _$("ctl00_plhBody_hidDestText").value; 
    var _hNm = "",hdHotel=_$("ctl00_plhBody_hidHotelname"); if(_cObj(hdHotel)) if(hdHotel.value != "") _hNm = hdHotel.value
    var _dcPrm = "City Name : " + _dNm +" ; City Id : "+_dsV+" ; ";
    if(_hNm!= "") var _dcPrm = "Hotel Name : " + _hNm +" ; ";
    if(_cObj(_rsN)) if(_rsN != "") _dcPrm += "Location Name : " + _rsN +" ; Location Id : "+_rsV+" ; ";
    _dcPrm += "Check In : "+_cInV+" ; Check Out : "+_cOutV+" ; Duration : "+_drV+ " ; ";
    _dcPrm += "Rating : "+_rtV+" ; Adults : "+_adsV+" ; Childrens : " +_chdV+ " ; Infants : "+_infV;
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _dcPrm += "Airport : "+_iataC;
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _flag = "F";
    if(_cObj(_flag)) cDCS(_flag, _dcPrm, _dNm)
    // For Price Page Request
    if(_locId==' ' ||_locId=='')_locId='0';if(_adsV=='')_adsV='2';if(_chdV=='')_chdV='0';
//    var _sb = _cid; _sb += "||"; _sb += _sid; _sb += "||"; _sb += _cityid; _sb += "||"; _sb += _locId; _sb += "||"; _sb += _dId; _sb += "||"; _sb += _type; _sb += "||"; _sb += _rsId; _sb += "||"; _sb += _airId; _sb += "||"; 
//    _sb += _hId; _sb += "||"; _sb += _cInD; _sb += "||";  _sb += _cOutD; _sb += "||"; _sb += _drV; _sb += "||"; _sb += _bdV; _sb += "||"; _sb += _board; _sb += "||"; _sb += _adsV; _sb += "||"; _sb += _chdV; _sb += "||"; 
//    _sb += _infV; _sb += "||"; _sb += _rV; _sb += "||"; _sb += _rtV; _sb += "||"; _sb += _aid; _sb += "||"; _sb += _lrN; _sb += "||"; _sb += _dstN; _sb += "||"; _sb += _dsV; _sb += "||"; _sb += _hNm;
    var _sb = _cid+"||"+_sid+"||"+_cityid+"||"+_locId+"||"+_dId+"||"+_type+"||"+_rsId+"||"+_airId+"||"+_hId+"||"+_cInD+"||"+_cOutD+"||"+_drV+"||"+_bdV;
    _sb +="||"+_board+"||"+_adsV+"||"+_chdV+"||"+_infV+"||"+_rV+"||"+_rtV+"||"+_aid+"||"+_lrN+"||";
    var tmp_sb=_sb;
    _sb+=_dstN+"||"+_dsV+"||"+_hNm;
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') { _sb += "||"+_iataC+"||"+ddlApt.options[ddlApt.selectedIndex].text; }
    
    //Create Cookie Items    
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') crCk("FnHHotelly", _sb, 1)
    else {var cVal=tmp_sb+_dVal[1]+", "+_dVal[0]+"||"+_dsV+"||"+_hNm; crCk("Hotelly", cVal, 1);}
    _$("hidPriceRequestValues").value = _sb;
    
    var _rName = _$("ctl00_plhBody_hidResortName").value; var _rsVal = _$("ctl00_plhBody_hidResortId").value;
    if(_rsVal == "") _rsVal = "0";
    var _postPage = "";      
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2')
    {
     _postPage = "/Search/FlightHotelResult/";
     _postPage += _dVal[0] + "/"+_dVal[1] + "/"+_dVal[2] + "/";
    }
    else
    {
     _postPage = "/Search/HotelResult/";
     _postPage += _dVal[0] + "/"+_dVal[1] + "/";
     if(_lrN == "" || _lrN == "-- Any --") _lrN = "Any"; _postPage += _lrN + "/"; 
    }
    _postPage += _cInV + "/"; _postPage += _cOutV + "/";
    _postPage += _cid + "_" + _cityid + "_" + _locId + "_" + _drV + "_" + _adsV  + "_" + _chdV; 
    if(_cObj(_$("hidFnH")) && _$('hidFnH').value == '2') _postPage += "_" + _iataC;
    _postPage = ReplaceAll(_postPage, ".", ""); _postPage += ".aspx"; _postPage = urlUnEx(_postPage);
    //return false;
    if(_cObj(_$("hidSearchBoxVal"))) {
        try {
            if(_cObj(window.parent.document.getElementById("ctl00_plhBody_hidAId"))) {
                window.parent.document.myformPrice.target='_self'; window.parent.document.myformPrice.hidPriceResult.value = _sb; 
                window.parent.document.myformPrice.method = "POST"; window.parent.document.myformPrice.action = _postPage; window.parent.document.myformPrice.submit();
            }
            else { 
                document.myformPrice.target='_blank'; document.myformPrice.hidPriceResult.value = _sb; 
                document.myformPrice.method = "POST"; document.myformPrice.action = _postPage; document.myformPrice.submit();
            }
        }
        catch(e) {
            document.myformPrice.target='_blank'; document.myformPrice.hidPriceResult.value = _sb;   
            document.myformPrice.method = "POST"; document.myformPrice.action = _postPage; document.myformPrice.submit();
        }
    }
    else {
        document.myformPrice.target='_self'; document.myformPrice.hidPriceResult.value = _sb; 
        document.myformPrice.method = "POST"; document.myformPrice.action = _postPage; document.myformPrice.submit();
    }
    return false;
}
function ClrSPN(_tV)
{
     _tV = ReplaceAll(_tV, "<b>","");     
     _tV = ReplaceAll(_tV, "</b>","");    
     _tV = ReplaceAll(_tV, "<B>","");     
     _tV = ReplaceAll(_tV, "</B>","");  
   return _tV;       
}
function pDr(_value, ddlResort)
{
    var opI;
    try{
        for (var count = ddlResort.options.length-1; count >-1; count--) { ddlResort.options[count] = null; }
        if(_value == "0") 
        { 
                var _op1 = crOp("7"); 
                ddlResort.appendChild(_op1); 
                var _op2 = crOp("10"); 
                ddlResort.appendChild(_op2);
                var _op3= crOp("14"); 
                ddlResort.appendChild(_op3);
        }
        else
        {
            for(var i=1; i<=30; i++)
            { 
                var op = crOp(i); ddlResort.appendChild(op); 
            }
        }          
        if(_cObj(_$('hidFnH')) && _$('hidFnH').value == '2')
        {
            if (bName == "Microsoft Internet Explorer")                
                setTimeout("pDur(7)" , 1);
             else
                 pDur(7);  
        }
        else
        {            
            if (bName == "Microsoft Internet Explorer")                
                setTimeout("pDur(2)" , 1);
             else
                 pDur(2);             
         }  
     }
     catch(e){}          
             
}

                            if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/Search/JavaScript/HomePage.js'); 
                            if( !window._combinedScripts ) { window._combinedScripts = []; } 
                            window._combinedScripts.push('/Search/JavaScript/HomePage.js');
// For IntelliSearch, By Gourav Kumar, RateGain IT Solution
var who, ESC=27, TAB=9, ALT=18, UP=38, DOWN=40, LEFT=37, RIGHT=39, ENTER=13, SHIFT=16, lastKey=0, DEL = 46, _rqDestRev = 0, _rqDest=0, _rqHotelRev = 0;
function keyDown(e)
{
    var pK = document.all? window.event.keyCode:e.which; var pK2 = String.fromCharCode(pK).toLowerCase();  lastKey=pK; 
    if(who!=null) { who(pK, pK2); }
}
function keysInit(callback)
{ 
    document.onkeydown = keyDown; who=callback;
    if (document.layers) { document.captureEvents(Event.KEYPRESS); } 
}
function noEnter() { return lastKey!=ENTER; }
var itC,crsl,tg, psl, tBG, _stop, _val;
var chs=3; 
function clrCntrls()
{
    _$("divDestMessage").style.display = "none"; _$("divDidYouMeanDest").style.display = "none";    
    _$("ctl00_plhBody_txtDestination").value=""; _$("lblDestErrMessage").innerHTML = "";  
    clrHOCntrls();
   _$('ctl00_plhBody_txtDestination').focus();    
}
function clrHOCntrls()
{      
    _$("lblHotelsCount").innerHTML = "";
    _$("ctl00_plhBody_hidResortName").value = "";
    _$("ctl00_plhBody_hidResortId").value ="";    
    var ddlResort = _$("ctl00_plhBody_ddlResort");     
    var _opI;  for (var count = ddlResort.options.length-1; count >-1; count--){ ddlResort.options[count] = null; }
    _opI = new Option( "-- Any --", "",  false, false); ddlResort.disabled=false; ddlResort.options[ddlResort.length] = _opI;     
    return false;
}
function dsKUp(event)
{
    if(_$("divDestMessage").style.display != "none") _$("divDestMessage").style.display = "none";
    if(_$("divDidYouMeanDest").style.display != "none") _$("divDidYouMeanDest").style.display = "none";
    if(_cObj(_$("divDestRevMessage"))) if(_$("divDestRevMessage").style.display != "none") _$("divDestRevMessage").style.display = "none";
    if(_cObj(_$("divHotelRevMessage"))) if(_$("divHotelRevMessage").style.display != "none") _$("divHotelRevMessage").style.display = "none";
    if(_$("ctl00_plhBody_hidDestValue").value != "") {
        if (event.keyCode == 8 || event.keyCode == 127 || event.keyCode == DEL || (event.keyCode >= 46 && event.keyCode <=90)) {
             if(_cObj(_$("destDivContainer"))) if(_$("destDivContainer").style.display != "none") _$("destDivContainer").style.display = "none";
            _$("ctl00_plhBody_hidDestValue").value = ""; var _cCnt = _$("ctl00_plhBody_txtDestination").value;
            if(_cCnt.length >= 3) { _rqDest +=1; dIS("destIntelli",_cCnt,_rqDest) }
            if(_cCnt.length ==0){clrCntrls();}  
        }
        else { hdChc(); }
    }
    else { var cCt = _$("ctl00_plhBody_txtDestination").value;
        if(cCt.length >= 3) {   
            if(event.keyCode== DOWN || event.keyCode == UP || event.keyCode == ENTER) {
                if (event.keyCode == ENTER) {
                    event.returnValue=false; event.cancel = true;
                    _$("ctl00_plhBody_compare_btn").focus(); _$("ctl00_plhBody_compare_btn").click();
                }
                if(tg.style.display == "block") { setValue(crsl); }
                else return false;
            }
            else {
                if(event.keyCode == 8 || (event.keyCode >= 46 && event.keyCode <=90)) {
                     _rqDest +=1; dIS("destIntelli",cCt,_rqDest) }
                else return false;
            }
        }
        else { if(cCt.length == 0){ hdChc();clrCntrls();} }
    }
}

function htRKUp(event)
{
    if(_$("divHotelRevMessage").style.display != "none") _$("divHotelRevMessage").style.display = "none";
    if(_$("divDidYouMeanHotelRev").style.display != "none") _$("divDidYouMeanHotelRev").style.display = "none";
    if(_cObj(_$("divDestRevMessage"))) if(_$("divDestRevMessage").style.display != "none") _$("divDestRevMessage").style.display = "none";
    if(_cObj(_$("divDestMessage"))) if(_$("divDestMessage").style.display != "none") _$("divDestMessage").style.display = "none";
    if(_$("ctl00_plhBody_hidHotelRevValue").value != "") {
        if (event.keyCode == 8 || event.keyCode == 127 || event.keyCode == DEL || (event.keyCode >= 46 && event.keyCode <=90)) {
            if(_cObj(_$("hotelRevDivContainer"))) if(_$("hotelRevDivContainer").style.display != "none") _$("hotelRevDivContainer").style.display = "none";
            _$("ctl00_plhBody_hidHotelRevValue").value = ""; var _cCnt = _$("ctl00_plhBody_txtHotelVideo").value;
            if(_cCnt.length >= 3) { _rqHotelRev +=1; dIS("hotelRevIntelli",_cCnt, _rqHotelRev) }
        }
        else { hdChc(); }
    }
    else { var cCt = _$("ctl00_plhBody_txtHotelVideo").value;
        if(cCt.length >= 3) {   
            if(event.keyCode== DOWN || event.keyCode == UP || event.keyCode == ENTER) {
                if (event.keyCode == ENTER) {
                    event.returnValue=false; event.cancel = true;
                    _$("ctl00_plhBody_ibtnHotelRev").focus(); _$("ctl00_plhBody_ibtnHotelRev").click();
                    return false;
                }
                if(tg.style.display == "block") { setValue(crsl); }
                else return false;
            }
            else {
                if(event.keyCode == 8 || (event.keyCode >= 46 && event.keyCode <=90)) {
                    _rqHotelRev +=1; dIS("hotelRevIntelli",cCt, _rqHotelRev) }
                else return false;
            }
        }
        else { if(cCt.length == 0) hdChc(); }
    }
}
function dsRKUp(event)
{
    if(_$("lblDestRevErrMessage").innerHTML != "Coming Soon...") if(_$("divDestRevMessage").style.display != "none") _$("divDestRevMessage").style.display = "none";
    if(_$("divDidYouMeanDestRev").style.display != "none") _$("divDidYouMeanDestRev").style.display = "none";
    if(_cObj(_$("divHotelRevMessage"))) if(_$("divHotelRevMessage").style.display != "none") _$("divHotelRevMessage").style.display = "none";
    if(_cObj(_$("divDestMessage"))) if(_$("divDestMessage").style.display != "none") _$("divDestMessage").style.display = "none";
    if(_cObj(_$("ctl00_plhBody_ibtnDestRev"))) if(_$("ctl00_plhBody_ibtnDestRev").disabled != false) _$("ctl00_plhBody_ibtnDestRev").disabled = false;
    if(_$("ctl00_plhBody_hidDestRevValue").value != "") {
        if (event.keyCode == 8 || event.keyCode == 127 || event.keyCode == DEL || (event.keyCode >= 46 && event.keyCode <=90)) {
            if(_cObj(_$("destRevDivContainer"))) if(_$("destRevDivContainer").style.display != "none") _$("destRevDivContainer").style.display = "none";
            _$("ctl00_plhBody_hidDestRevValue").value = ""; var _cCnt = _$("ctl00_plhBody_hidDestRevValue").value;
            if(_cCnt.length >= 3) { _rqDestRev+=1; dIS("destRevIntelli",_cCnt, _rqDestRev) }
        }
        else {
            if(event.keyCode == ENTER) if(_$("lblDestRevErrMessage").innerHTML == "Coming Soon...") _$("ctl00_plhBody_hidDestRevValue").value = "";
            hdChc(); }
    }
    else { var cCt = _$("ctl00_plhBody_txtDestVideo").value;
        if(cCt.length >= 3) {
            if(event.keyCode== DOWN || event.keyCode == UP || event.keyCode == ENTER) {
                if (event.keyCode == ENTER) {
                    event.returnValue=false; event.cancel = true;
                   _$("ctl00_plhBody_ibtnDestRev").focus(); _$("ctl00_plhBody_ibtnDestRev").click();
                }
                if(tg.style.display == "block") { setValue(crsl); }
                else return false;
            }
            else {
                if(event.keyCode == 8 || (event.keyCode >= 46 && event.keyCode <=90)) {
                    _rqDestRev+=1; dIS("destRevIntelli",cCt, _rqDestRev) }
                else return false;
            }
        }
        else { if(cCt.length == 0) hdChc(); }
    }
}
function cnIS() { keysInit(null); clIS(); }
function clIS() 
{
    if (tg!=null) { tg.style.display = 'none'; tg.innerHTML = ""; }
    if (tBG!=null) { tBG.style.display = 'none'; }
    _stop = true;
}
function iDsIS()
{
    cnIS(); var body = _$e("body")[0]; _val = 'D'; tg = _$('destDiv');
    if (!tg)  { tg = crE("div"); tg.id = "destDiv"; tg.style.zIndex = 51; tg.style.position = 'absolute'; tg.style.display = 'none'; tg.style.width = 'auto'; body.appendChild(tg); }
    tBG = _$('destIFrame');
    if (!tBG) { tBG = crE("destIFrame"); tBG.id = "destIFrame"; tBG.style.zIndex = 50; tBG.setAttribute('scrolling', 'no'); tBG.setAttribute('frameborder', '0'); tBG.style.position = "absolute"; tBG.style.display = "none"; body.appendChild(tBG);}
    keysInit(keypressed); _ls = ""; crsl=-1; psl=-1; _stop = false;
}
function iHRIS()
{
    cnIS(); var body = _$e("body")[0]; _val = 'HR'; tg = _$('hotelRevDiv');
    if (!tg) { tg = crE("div"); tg.id = "hotelRevDiv"; tg.style.zIndex = 51; tg.style.position = 'absolute'; tg.style.display = 'none'; tg.style.width = 'auto'; body.appendChild(tg); }
    tBG = _$('hotelRevIFrame');
    if (!tBG) { tBG = crE("hotelRevIFrame"); tBG.id = "HotelRevIFrame"; tBG.style.zIndex = 50; tBG.setAttribute('scrolling', 'no'); tBG.setAttribute('frameborder', '0'); tBG.style.position = "absolute"; tBG.style.display = "none"; body.appendChild(tBG);}
    keysInit(keypressed); _ls = ""; crsl=-1; psl=-1; _stop = false;
}
function iDRIS()
{
    cnIS(); var body = _$e("body")[0]; _val = 'DR'; tg = _$('destRevDiv');
    if (!tg) { tg = crE("div"); tg.id = "destRevDiv"; tg.style.zIndex = 51; tg.style.position = 'absolute'; tg.style.display = 'none'; tg.style.width = 'auto'; body.appendChild(tg); }
    tBG = _$('destRevIFrame');
    if (!tBG) { tBG = crE("destRevIFrame"); tBG.id = "destRevIFrame"; tBG.style.zIndex = 50; tBG.setAttribute('scrolling', 'no'); tBG.setAttribute('frameborder', '0'); tBG.style.position = "absolute"; tBG.style.display = "none"; body.appendChild(tBG); }
    keysInit(keypressed); _ls = ""; crsl=-1; psl=-1; _stop = false;
}
function gSbIdx(elem)
{
    var list = gISL(); var rIdx = 0;
    for (var i=0; i < list.childNodes.length; i++) { if (elem == list.childNodes[i]) { rIdx = i; break; } }
    return rIdx;
}
function sbMOut(event) { var obj = event ? event.target : this; crsl = -1; selChc(-1); }
function sbMDwn(event) { var obj = event ? event.target : this; crsl = gSbIdx(obj); setValue(crsl); clIS(); }
function sbMOvr(event) { var obj = event ? event.target : this; crsl = gSbIdx(obj); selChc(crsl); }

function shChc() 
{
    tg.style.display = 'inline';
    if (sbShBGIf())  { tBG.style.display = 'inline'; }
    if (_sboxminwidth > tg.offsetWidth)  { tBG.style.width = _sboxminwidth + "px"; tg.style.width = _sboxminwidth + "px"; } 
    else { tBG.style.width = tg.offsetWidth + "px"; }
    tBG.style.height = tg.offsetHeight + "px"; tBG.style.top = tg.style.top; tBG.style.left = tg.style.left;
}
function hdChc() 
{
    if (_cObj(tg)) tg.style.display = 'none';
    if (_cObj(tBG)) tBG.style.display = 'none';
}
function gISL() 
{
    var ul;
    for (var i=0; i < tg.childNodes.length; i++) {
       var node = tg.childNodes[i];
       if (node.nodeName == 'UL') { ul = node; break; }
    }
    return ul;
}
function setValue(newi)
{
    if (newi<0) { _ls=""; }
    else if (itC > 0) {
        var list = gISL(); if (list == null || list.childNodes == null) return; 
        var selected = list.childNodes[newi]; hdChc();
        var value="";
        if (bName == "Microsoft Internet Explorer"){value=selected.innerText;}
        else{value=selected.textContent;}
        switch(_val) {
            case 'D': 
                dLS(selected.id, value)
                if(_$("ctl00_plhBody_hidDestValue").value != "") _$('destDiv').style.display = "none";
                break;
            case 'HR': 
                HRLS(selected.id, value)
                if(_$("ctl00_plhBody_hidHotelRevValue").value != "") _$('hotelRevDiv').style.display = "none";
                break;
            case 'DR': 
                DRLS(selected.id, value)
                if(_$("ctl00_plhBody_hidDestRevValue").value != "") _$('destRevDiv').style.display = "none";
                break;
        }
    }
}
function selChc(newi) 
{
    crsl = newi; var list = gISL();
    if (list.childNodes.length > 0) {
        if (psl >= 0) {
            var prev = list.childNodes[psl];
            if(_cObj(prev)) {
                if(prev.className) { prev.className = prev.className.replace(/ *listItem/, ""); } 
                else { prev.className = ''; }
            }
        }
        if (newi >= 0){
            if (list.childNodes.length > 0) {
                var cur = list.childNodes[newi];
                if(_cObj(cur)) cur.className = "listItem";
            }
            psl = newi;
        }
    }
}
var prsd=0;
function keypressed(keyCode, keyvalue)
{
    prsd = new Date().getTime();
    if((_cObj(_$("destDiv")) && _$("destDiv").style.display != "none" ) || (_cObj(_$("hotelRevDiv")) && _$("hotelRevDiv").style.display != "none" ) || (_cObj(_$("destRevDiv")) && _$("destRevDiv").style.display != "none" ))
    {
        switch (keyCode) {
            case LEFT:
            case UP:
                crsl = crsl - 1;
                if (crsl<0) { crsl=0; }
                selChc(crsl);
                break;
            case RIGHT:
            case DOWN:
                crsl++;
                if (crsl>=itC) { crsl=itC-1; }
                selChc(crsl);
                break;
            case ENTER:
                if (itC>0) { setValue(crsl); clIS(); }
                hdChc();
                break;
            case ESC:
                clIS();
                break;
            case TAB:
                if (crsl>=0&&crsl<itC) { setValue(crsl); }
                hdChc();
                break;
            case ALT:
            case SHIFT:
                break;
            default:
                setValue(-1);
        }
    }
    else { return false; }
}
function sbNoEnter()  { var v = (_stop==null || _stop!=true); _stop = false; return (v ? true: noEnter()); }
function sbShBGIf() { return ( window.opera ) ? false : true; }
function gSAmt()
{
    var sAmt = document.body.scrollTop;
    if (typeof window.innerWidth != 'undefined') {
        if (sAmt == 0 && document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop != 0) {
            sAmt = document.documentElement.scrollTop;
        }
    } else if (typeof document.documentElement != 'undefined'
         && typeof document.documentElement.scrollTop !=
         'undefined' && document.documentElement.scrollTop != 0) {
           if (sAmt == 0) { sAmt = document.documentElement.scrollTop; }
     }
    return sAmt;
}
function destfocus()
{
    if(_$("ctl00_plhBody_txtDestination").value == "e.g. Paris" || _$("ctl00_plhBody_txtDestination").value == "Destination" || _$("ctl00_plhBody_txtDestination").value=="e.g. Costa Del Sol")
        _$("ctl00_plhBody_txtDestination").value = "";
    iDsIS();
}
function emailFocus() { if(_$("txtEmail").value == "Please enter your email") _$("txtEmail").value = ""; }
function cancelEmail() { if(_$("txtEmail").value == "") _$("txtEmail").value = "Please enter your email"; }
function hRf()
{
    if(_$("ctl00_plhBody_txtHotelVideo").value == "e.g. Napoleon Hotel Paris")
        _$("ctl00_plhBody_txtHotelVideo").value = "";
    iHRIS();
}
function dRf()
{
    if(_$("ctl00_plhBody_txtDestVideo").value == "e.g. Paris")
        _$("ctl00_plhBody_txtDestVideo").value = "";
    iDRIS();
}
function sDsI()
{
    if(_$("ctl00_plhBody_hidDestValue").value == "") {
        if(_$("destDivContainer").style.display != "none") {
            setValue(crsl); cnIS();
            if(_$("ctl00_plhBody_txtDestination").value == "") if(_$("hidFnH").value == '1') _$("ctl00_plhBody_txtDestination").value = "e.g. Paris";
                else _$("ctl00_plhBody_txtDestination").value = "e.g. Costa Del Sol";
        }
    }
}
function sHtRI()
{
    if(_$("ctl00_plhBody_hidHotelRevValue").value == "") {
        if(_$("hotelRevDivContainer").style.display != "none") {
            setValue(crsl); cnIS();
            if(_$("ctl00_plhBody_txtHotelVideo").value == "") _$("ctl00_plhBody_txtHotelVideo").value = "e.g. Napoleon Hotel Paris";
        }
    }
    
}
function sDsRI()
{
    if(_$("ctl00_plhBody_hidDestRevValue").value == "") {
        if(_$("destRevDivContainer").style.display != "none") {
            setValue(crsl); cnIS();
            if(_$("ctl00_plhBody_txtDestVideo").value == "") _$("ctl00_plhBody_txtDestVideo").value = "e.g. Paris";
        }
    }
}

                            if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/Search/JavaScript/intelli.js'); 
                            if( !window._combinedScripts ) { window._combinedScripts = []; } 
                            window._combinedScripts.push('/Search/JavaScript/intelli.js');
// For Video Upload page Review section, By Gourav Kumar, RateGain IT Solution
//function dIS(_page, _chr, _rq)
//{   
//    if(_chr!="") { var _fnh = '1';
//        if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
//         var tD = new Date(); var rU = "/Search/AjaxImpl.aspx?page="+_page+"&chr="+_chr +"&rq="+_rq+"&fnh="+_fnh+"&dt="+ tD.getTime();
//         var XmlHttp = CreateXmlHttp();
//         if(XmlHttp) {
//		    XmlHttp.onreadystatechange = function() { 
//                if(XmlHttp.readyState == 4) {
//	                if(XmlHttp.status == 200) { 
//	                    switch (_page)
//                        {
//                            case 'destIntelli':  dIXDB(XmlHttp.responseText); break;
//	                    }
//	                }
//                }
//	        }
//    		XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
//	     }
//    }
//}
//function dIXDB(rX)
//{
//    if(rX!="") {  
//        var _sQ = _$("ctl00_plhBody_txtDestination").value; var xD = crXD(rX);
//        if(_cObj(xD.selectNodes("ISD/UL/li"))) {
//            var ndD = xD.selectNodes("ISD/UL/li");
//            if(_cObj(ndD)) {
//                if(xD.selectSingleNode("ISD").getAttribute("RCntr") == _rqDest) {
//                    if(ndD.length > 0) {
//                        var dv = _$("destDiv"); dv.style.display = 'block'; cldv(dv); var _ul = crE('UL');
//                            for(var rCt=0; rCt < ndD.length; rCt++) {
//                                var tV = GIH(ndD[rCt]); tV = ReplaceAll(tV,"|", ", "); var dId = ndD[rCt].getAttribute("id"); var _li = crDLI(dId, tV); _ul.appendChild(_li);
//                            }
//                            itC = ndD.length; dv.style.display = "inline"; dv.zIndex = "1000"; dv.appendChild(_ul);
//                            var dsDvCn =  _$("destDivContainer"); dsDvCn.style.display = 'block'; var bName = navigator.appName;
//                            if (bName == "Microsoft Internet Explorer")  {
//                                var iF = _$("destIFrame"); iF.style.display = 'block'; iF.style.width = dv.offsetWidth-2; iF.style.height = dv.offsetHeight-2;
//                                iF.style.left = _$("destDivContainer").style.left; iF.style.top = _$("destDivContainer").style.top;
//                            }
//                            selChc(0)
//                    }
//                    else { _$("destIFrame").style.display = 'none'; _$("destDiv").style.display = 'none'; }
//                }
//                else { _$("destIFrame").style.display = 'none'; _$("destDiv").style.display = 'none'; }
//            }
//        }
//    }
//}
//function crDLI(dId, tV)
//{
//    var _li = crE('LI'); _li.id = dId; _li.innerHTML = tV;
//   _li.onmousedown = function() { dLS(dId, tV); };
//   _li.onmouseover = function() { _cursel = -1; selChc(-1); _li.className = 'listItem'; };
//   _li.onmouseout = function() { _li.className = ''; };
//   return _li
//}

//function dLS(dId, tV)
//{
//    _$("destIFrame").style.display = 'none'; _$("destDiv").style.display = 'none'; _$("ctl00_plhBody_txtDestination").value = tV; _$("divDestMessage").style.display = "none";
//    _$("divDidYouMeanDest").style.display = "none"; _$("ctl00_plhBody_hidDestValue").value = dId; _$("ctl00_plhBody_hidDestText").value = tV;
//    var dId = _$("ctl00_plhBody_hidDestValue").value; _$("ctl00_plhBody_hidResortId").value = "0"; _$("ctl00_plhBody_hidResortName").value = "";    _$("imgLoading").style.display = "inline";
//    dSr(dId); hSr(dId,"-1"); var dV = dId.split(","); var dTy = dV[5]; var _bType = dV[6]; _$("ctl00_plhBody_hidDestType").value = dTy;
//    return false;
//}
//function dMDS()
//{    
//    var ddlDidYouMean = _$("ctl00_plhBody_ddlDidYouMeanDest"); _$("divDestMessage").style.display = "none";
//    var w = _$("ctl00_plhBody_ddlDidYouMeanDest").selectedIndex; _$("ctl00_plhBody_hidDestText").value = _$("ctl00_plhBody_ddlDidYouMeanDest").options[w].text;
//    _$("ctl00_plhBody_txtDestination").value = _$("ctl00_plhBody_hidDestText").value; _$("ctl00_plhBody_hidDestValue").value = ddlDidYouMean.value;
//    var dId = _$("ctl00_plhBody_hidDestValue").value; _$("ctl00_plhBody_hidResortId").value = "0"; _$("ctl00_plhBody_hidResortName").value = ""; _$("imgLoading").style.display = "inline";
//    dSr(dId); hSr(dId,"-1"); var dV = dId.split(","); var dTy = dV[5]; _$("ctl00_plhBody_hidDestType").value = dTy; _$("divDidYouMeanDest").style.display = "none";   
//    return false;
//}
function clearDestValues()
{
    _$("ctl00_plhBody_hidDestValue").value = ""; _$("ctl00_plhBody_hidDestText").value = ""; _$("ctl00_plhBody_hidResortId").value = ""; _$("ctl00_plhBody_hidResortName").value = ""; return false;
}
//function dSr(dId)
//{   
//    if(dId!="") {
//         var tD = new Date(); var rU = "/Search/AjaxImpl.aspx?page=d&DName="+dId +"&dt="+ tD.getTime(); var XmlHttp = CreateXmlHttp();
//         if(XmlHttp) { XmlHttp.onreadystatechange = function() { 
//                if(XmlHttp.readyState == 4) {
//	                if(XmlHttp.status == 200) { sRI(XmlHttp.responseText, "DEST"); } } }
//		 	XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
//	     }
//    }
//}
//function sRI(rsX, _flag)
//{   
//    var ddlResort = _$("ctl00_plhBody_ddlResort"); var opI;
//    for (var count = ddlResort.options.length-1; count >-1; count--) { ddlResort.options[count] = null; }
//    opI = new Option( "-- Any --", "",  false, false); ddlResort.options[ddlResort.length] = opI; 
//    if(rsX!="") {  
//        var xD = crXD(rsX); var ndRs, ndR; ndRs = xD.selectNodes("DR/R");
//        if(_cObj(ndRs)) {
//            if(ndRs.length > 0) { ddlResort.disabled=false;
//                for(var rCt=0; rCt < ndRs.length; rCt++) {
//                   var tV = ndRs[rCt].getAttribute("n");  var rId = ndRs[rCt].getAttribute("id") + "||" + ndRs[rCt].getAttribute("HCount"); 
//                   var opI = new Option(tV, rId); ddlResort.options[ddlResort.length] = opI;
//                }
//            } 
//            else { ndRs = xD.selectNodes("C/L");
//                if(_cObj(ndRs)) {
//                    if(ndRs.length > 0) { ddlResort.disabled=false;
//                        for(var rCt=0; rCt < ndRs.length; rCt++) {
//                           var tV = ndRs[rCt].getAttribute("n");  var rId = ndRs[rCt].getAttribute("id") + "||" + ndRs[rCt].getAttribute("HCount"); 
//                           var opI = new Option(tV, rId); ddlResort.options[ddlResort.length] = opI;
//                        }
//                    }
//                    else { ddlResort.disabled=true; }   
//                }
//                else { ddlResort.disabled=true; }
//            }  
//        }
//        else { ddlResort.disabled=true; }
//    }
//}
function gRLId(rId)
 {
    _$("ctl00_plhBody_hidResotval").value = rId; var rsId= _$("ctl00_plhBody_hidResotval").value;
    var w = _$("ctl00_plhBody_ddlResort").selectedIndex; _$("ctl00_plhBody_hidResottxt").value = _$("ctl00_plhBody_ddlResort").options[w].text;
    destId=_$("ctl00_plhBody_hidDestValue").value;   var _resId = rId.split("||"); _$("ctl00_plhBody_hidResortId").value = _resId[0];  
     _$("imgLoading1").style.display = "inline"; hSr(destId,rsId);   
}
function gHId()
{
    var w = _$("ctl00_plhBody_ddlHotelName").selectedIndex; _$("ctl00_plhBody_hidHotelText").value=_$("ctl00_plhBody_ddlHotelName").options[w].text;
    _$("ctl00_plhBody_hidHotelValue").value=_$("ctl00_plhBody_ddlHotelName").options[w].value; 
}
function hSr(dId,_LocID)
{
    if(dId!="") {
         var tD = new Date(); var rU = "/Search/AjaxImpl.aspx?page=d&DestID="+dId +"&LocID="+_LocID+"&dt="+ tD.getTime(); var XmlHttp = CreateXmlHttp();
         if(XmlHttp) { XmlHttp.onreadystatechange = function() { 		       
                if(XmlHttp.readyState == 4) { if(XmlHttp.status == 200) { pHts(XmlHttp.responseText); } } }            		   
		    XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
	     }
    }
}
function pHts(ht)
{    
    _$("ctl00_plhBody_hidHotelsxml").value=ht; var ddlHotel = _$("ctl00_plhBody_ddlHotelName"); var opI;
    for (var count = ddlHotel.options.length-1; count >-1; count--) { ddlHotel.options[count] = null; }
    opI = new Option( "-- Any --", "",  false, false); ddlHotel.options[ddlHotel.length] = opI; 
    if(ht!="") {  
        var xD = crXD(ht); var ndHt, ndR; var ndLH = xD.selectNodes("HBDL/UL/li");
        if(_cObj(ndLH)) {
            if(ndLH.length > 0) { ddlHotel.disabled=false;
                for(var rCt=0; rCt < ndLH.length; rCt++) {
                   var HN = GIH(ndLH[rCt]); var HId = ndLH[rCt].getAttribute("Hid");  var opI = new Option(HN, HId); ddlHotel.options[ddlHotel.length] = opI;
                }
            } 
            else { ddlHotel.disabled=true; }
        }
        else { ddlHotel.disabled=true; }
    }
    _$("imgLoading").style.display = "none"; _$("imgLoading1").style.display = "none";
    return false;
}
function validateVideoReview()
{
    _rqDest += 1;
    if(_$("ctl00_plhBody_video_title").value=="") { alert("Title can not be blank!"); return false; }
    if(_$("ctl00_plhBody_video_title").value.length > 100)  { alert("Title can not be more then 100 words!"); return false; }
    if(_$("ctl00_plhBody_video_desc").value=="")  { alert("Description text can not be blank!"); return false; }
    if(_$("ctl00_plhBody_video_desc").value.length > 350)  { alert("Description text can not be More than 350 words!"); return false; }
    if(_$("ctl00_plhBody_review_name").value=="")  { alert("Name can not be blank!"); return false; }
    if(_$("ctl00_plhBody_review_email").value=="")  { alert("E-mail can not be blank!"); return false; } 
    if(_$("divDestMessage").style.display != "none") _$("divDestMessage").style.display = "none";
    if(_cObj(_$("divDestRevMessage"))) if(_$("divDestRevMessage").style.display != "none") _$("divDestRevMessage").style.display = "none";
    if(_cObj(_$("divHotelRevMessage"))) if(_$("divHotelRevMessage").style.display != "none") _$("divHotelRevMessage").style.display = "none";            
    if(_$("ctl00_plhBody_txtDestination").value=="" || _$("ctl00_plhBody_txtDestination").value=="e.g. Paris")  {        
        _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block";
        _$("lblDestErrMessage").innerHTML = "Please enter a destination first!"; _$("lblHotelsCount").innerHTML = ""; return false;
    }
    if(_$("ctl00_plhBody_hidDestValue").value =="") { _$("divDestMessage").style.display = "none";
        if(_$("ctl00_plhBody_txtDestination").value!="")  {
            _$("ctl00_plhBody_hiddSrQuery").value = _$("ctl00_plhBody_txtDestination").value;
            //gDLBSQ(_$("ctl00_plhBody_txtDestination").value);
             gDstSQ(_$("ctl00_plhBody_txtDestination").value);
        }        
        _$("ctl00_plhBody_txtDestination").focus(); _$("divDestMessage").style.display = "none"; return false;
    }
       
    if(_$("ctl00_plhBody_hidDestValue").value =="") { alert("Your destination is invalid"); _$("ctl00_plhBody_txtDestination").value = ""; _$("ctl00_plhBody_txtDestination").focus(); return false; }   
    //if( _$("ctl00_plhBody_FileUpload1").value == "" && _$("ctl00_plhBody_UploadControl").value == "") { alert("Please upload a video"); return false; }
    if( _$("ctl00_plhBody_FileUpload1").value == "") { alert("Please upload a video"); return false; }
   if(_$("ctl00_plhBody_disclaimer").checked==false) { alert("Please select the agreement!"); return false; }
   //if(_$("ctl00_plhBody_FileUpload1").value !=null && _$("ctl00_plhBody_FileUpload1").value!="") {
   if(_$("ctl00_plhBody_FileUpload1").value !=null) {
        var fname=/(.*?)\.(wmv|dat|mp4|mpeg|rm|3gp|swf|flv|mpg|avi|asf|mod|mov)/;
       if(_$("ctl00_plhBody_FileUpload1").value.toLowerCase().search(fname)==-1) {
          alert("This video file is not supported.Supported video formats are: .wmv|.dat|.mp4|.mpeg|.rm|.3gp|.swf|.flv|.mpg|.avi|.asf|.mod|.mov"); 
          return false;  
        }
    }    
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(_$("ctl00_plhBody_review_email").value)) { return (true) }
    else { alert("Invalid e-mail address! Please re-enter."); return (false) }
}
//function gDLBSQ(sQ)
//{
//    _$("imgLoading").style.display = "inline"; var _fnh = '1'; if(_cObj(_$('hidFnH')) && _$('hidFnH').value != "") _fnh = _$('hidFnH').value;
//    if(sQ != "") {
//        var tD = new Date(); var rU = "/Search/AjaxImpl.aspx?page=ind&sq="+sQ +"&fnh="+_fnh+"&dt="+ tD.getTime(); var XmlHttp = CreateXmlHttp();
//         if(XmlHttp) {
//		    XmlHttp.onreadystatechange = function(){
//	            if(XmlHttp.readyState == 4) { if(XmlHttp.status == 200) { sMD(XmlHttp.responseText); } } }
//		    XmlHttp.open("GET", rU,  true); XmlHttp.send(null);		
//	     }
//    }
//}
//function sMD(rX)
//{
//    if(rX!="") {  
//        var xD = crXD(rX); var ndD, _ndCity, ndR,ddlDidYouMeanDest;
//        if(_cObj(xD.selectNodes("ISD/UL/li"))) { ndD = xD.selectNodes("ISD/UL/li");
//            if(_cObj(ndD)) { if(ndD.length > 0) {
//                    if(ndD.length == 1) { var _did = ndD[0].getAttribute("id"); var _tVal = GIH(ndD[0]); _tVal = ReplaceAll(_tVal,"|", ", "); dLS(_did, _tVal) }
//                    else {
//                        if(_cObj(_$("divDidYouMeanDest"))) _$("divDidYouMeanDest").style.display = "block";
//                        if(_cObj(_$("destDivContainer"))) _$("destDivContainer").style.display = "none";
//                        if(_cObj(_$("divDestMessage"))) _$("divDestMessage").style.display = "none";
//                        ddlDidYouMeanDest = _$("ctl00_plhBody_ddlDidYouMeanDest"); var _sQ = _$("ctl00_plhBody_hiddSrQuery").value; var opI;
//                        for (var count = ddlDidYouMeanDest.options.length-1; count >-1; count--) { ddlDidYouMeanDest.options[count] = null; }
//                        opI = new Option( "-- Please Select --", "",  false, false); ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = opI; 
//                        for(var rCt=0; rCt < ndD.length; rCt++) {
//                            var tV = GIH(ndD[rCt]); tV = ReplaceAll(tV,"|", ", "); var dId = ndD[rCt].getAttribute("id");
//                            var opI = new Option(tV, dId); ddlDidYouMeanDest.options[ddlDidYouMeanDest.length] = opI;
//    } 
//    if(ddlDidYouMeanDest.length <= 1) {
//        _$("divDidYouMeanDest").style.display = "none"; _$("divDestMessage").style.display = "block";
//        _$("lblDestErrMessage").innerHTML = "Please enter valid destination!"; _$("lblHotelsCount").innerHTML = "";
//    } } } } } } 
//    _$("imgLoading").style.display = "none";
//    var ddlResort = _$("ctl00_plhBody_ddlResort"); var opI;
//    for (var count = ddlResort.options.length-1; count >-1; count--) { ddlResort.options[count] = null; }
//    opI = new Option( "-- Any --", "0",  false, false); ddlResort.options[ddlResort.length] = opI; 
//}
function ValidateContactsEmail()
{
    var _to = _$("ctl00_plhBody_recipient_list").value; 
    if(_to=="") { alert("To Email address can not be blank!"); return false; }
    else { var _toIds, _indx;
        if(_to.indexOf('" <')!=-1) {
            _toIds = _to.split('>, "'); _to = '';
            for(var i = 0;i<_toIds.length; i++) { _indx = _toIds[i].indexOf('<'); _to =_to + ','+ _toIds[i].substring(_indx+1,_toIds[i].length); }
            _to = _to.substring(1,_to.length-1);
        }
        var _temp = ReplaceAll(_to, ";", ","); _toIds = _temp.split(",");
        for(var _count = 0; _count<_toIds.length; _count++) {   
            if (echeck(_toIds[_count].trim())==false) {
		        alert("Please enter valid email address"); _$("ctl00_plhBody_recipient_list").value = ""; _$("ctl00_plhBody_recipient_list").focus(); return false;
	        }
        }
    }
    if(_$("ctl00_plhBody_txtComments").value.length > 1000) { alert("Comments can not be more then 1000 words!"); return false; }
    return true;
}
function echeck(email)
{
    if(email.length <= 0) { return false; }
    var splitted = email.match("^(.+)@(.+)$"); if(splitted == null)  return false;
    if(splitted[1] != null ) { var regexp_user=/^\"?[\w-_\.\+]*\"?$/; if(splitted[1].match(regexp_user) == null)  return false; }
    if(splitted[2] != null) { var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
        if(splitted[2].match(regexp_domain) == null) { var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/; if(splitted[2].match(regexp_ip) == null)  return false; }
        return true;
    }
    return false;
}
 function _cObj(obj) { if(obj==null || typeof obj=='undefined') return false;  else return true; }
function checkEmail()
{
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(_$("ctl00_plhBody_review_email").value)) { return (true) }
    alert("Invalid e-mail address! Please re-enter."); return (false)
}
function LatestReview()
{
    var lRw=_$("hidLatestReview").value; var dv = document.getElementById("reviews"); var xD = crXD(lRw);
    if(_cObj(xD)) { var ndLR= xD.selectNodes("LRs/R"); var h5,h6,p,strong,br,a,strong1; 
        h5 = crE('h5'); h5.appendChild(crTN("Latest Review")); dv.appendChild(h5);
        if(_cObj(ndLR)) { if(ndLR.length > 0) {
                for(var rCt=0; rCt < ndLR.length; rCt++) {
                     var _title = GIH(ndLR[rCt].selectSingleNode("t"));  h6=crE('h6'); h6.appendChild(crTN(_title)); dv.appendChild(h6);
                     var _uname = ndLR[rCt].getAttribute("un");  var _date = ndLR[rCt].getAttribute("dt"); p = crE('p');
                     strong=crE('strong'); strong.appendChild(crTN(_uname)); p.appendChild(strong); br = crE('br'); p.appendChild(br);
                     strong1=crE('strong'); strong1.appendChild(crTN(_date)); p.appendChild(strong1); dv.appendChild(p);
                     var  _des = GIH(ndLR[rCt].selectSingleNode("d"));  leng=_des.length;
                   if(leng > 455) { var dsp=_des.substring(0,455); p = crE('p');
                        p.appendChild(crTN(dsp)); p.appendChild(crTN("[")); a = crE("A"); a.id = "Read_more"; a.href = "javascript: void(0);";
                        a.appendChild(crTN("Read on..")); p.appendChild(a); p.appendChild(crTN("]"));
                    }
                    else { p = crE('p'); p.appendChild(crTN(_des)); }                       
                     dv.appendChild(p);                        
                }
            }
         }
    }
}
function LatestVideoReview()
{
    var lRw=_$("ctl00_plhBody_hidLatestvideoReview").value; var dv = _$("reviews"); var xD = crXD(lRw);
    if(_cObj(xD)) { var ndLR = xD.selectNodes("LVs/LV"); var h5,h6,p,strong,br,a,strong1,img,lnk;
         h5 = crE('h5'); h5.appendChild(crTN("Latest Review")); dv.appendChild(h5);var afId = _$("ctl00_plhBody_hidAffiliateId").value;
        if(_cObj(ndLR)) { if(ndLR.length > 0) {
            for(var rCt=0; rCt < ndLR.length; rCt++) {
                var _title = ndLR[rCt].getAttribute("rt"); h6=crE('h6'); h6.appendChild(crTN(_title)); dv.appendChild(h6);
                var _uname = ndLR[rCt].getAttribute("u"); var _date = ndLR[rCt].getAttribute("dt"); 
                p = crE('p'); strong=crE('strong'); strong.appendChild(crTN(_uname)); p.appendChild(strong); br = crE('br'); p.appendChild(br);
                strong1=crE('strong'); strong1.appendChild(crTN(_date)); p.appendChild(strong1); dv.appendChild(p);
                var ndL= ndLR[rCt].selectSingleNode("VI"); var vimN = ndL.getAttribute("n"); var vimU =ndL.getAttribute("u");
                var vimA = ndL.getAttribute("a"); var vimTy= ndL.getAttribute("t"); var _ndV = ndLR[rCt].selectSingleNode("V");
                lnk = crIRV(_ndV, vimN, vimU, vimA,afId); dv.appendChild(lnk); 
                var _des = ndLR[rCt].getAttribute("rd"); var lnk=ndLR[rCt].getAttribute("l"); leng=_des.length;
                if(leng > 100) { var dsp=_des.substring(0,100); p = crE('p'); p.appendChild(crTN(dsp)); p.appendChild(crTN("["));
                    a = crE("A"); a.id = "Read_more"; a.href = lnk; a.appendChild(crTN("View Video..")); p.appendChild(a); p.appendChild(crTN("]"));
                }
                else { p = crE('p'); var _hr= crE('HR'); p.appendChild(crTN(_des)); p.appendChild(_hr); }
                dv.appendChild(p); }
            }
        }
    }
}
function crIRV(_ndVd, vimN, vimU, vimA,afId)
{
    var img = crE("IMG"); img.title=vimN; img.style.height='75px';
    img.style.width='100px'; img.alt=vimA; img.src = playIcon(afId, 1);  img.style.background = "url('"+vimU+"')";
    var lnk = crE("A"); lnk.href = "Javascript:void(0);"; lnk.onclick = function () { RVP(_ndVd); }; lnk.appendChild(img);    
    return lnk;
}
function RVP(_node)
{
    if(_cObj(_$("ctl00_plhBody_divDefaultMovie"))) rmOP(); var tblVd= PVS(_node,3, "VU",_$("ctl00_plhBody_hidAffiliateId").value);
    var dvVP = _$("divVideoPopUp"); cldv(dvVP); var _ru, vcg = '';
    if(_cObj(_node)) {    _$("hdnCurrentVideoXml").value = xS(_node);
        if(_cObj(_node.selectSingleNode("MD").getAttribute("c"))) { vcg = _node.selectSingleNode("MD").getAttribute("c"); }
        if(_cObj(_node.getAttribute("ru"))) { _ru = _node.getAttribute("ru");  } }
    var _hdID, _hdName, _hdAdd, _hdStars, CnN, CtN;
    if(_cObj(_node.selectSingleNode("HD").getAttribute("id")))  {
        _hdID  = _node.selectSingleNode("HD").getAttribute("id"); _hdName  = _node.selectSingleNode("HD").getAttribute("n");  _hdAdd = _node.selectSingleNode("HD").getAttribute("lrname"); 
        _hdStars = _node.selectSingleNode("HD").getAttribute("r"); CnN = _node.selectSingleNode("HD").getAttribute("CnName"); CtN = _node.selectSingleNode("HD").getAttribute("CtName");
    } 
    var imU, _ndI; 
    if(_cObj(_node.selectSingleNode("IS/I[@t='T']"))) _ndI = _node.selectSingleNode("IS/I[@t='T']");
    else _ndI = _node.selectSingleNode("IS/I");
    if(_cObj(_ndI)) { if(_cObj(_ndI.getAttribute("u"))) { imU = _ndI.getAttribute("u"); }
        if(_cObj(_ndI.getAttribute("p"))) if(_ndI.getAttribute("p") == _YTID) if(imU.indexOf("http:")!= 0) imU = _YTIMG + "" + _node.getAttribute("dl") + "/" + imU; }
    _$("ctl00_plhBody_hidPopUpNodeXml").value = _hdID + "||" + _hdName + "||" + _hdAdd + "||" + _hdStars + "||" + imU;
    if(_cObj(_$("hidPopValues"))) _$("hidPopValues").value = CtN+ ", " + CnN ;
    var tblHI = VDSI(_hdID, _hdName, _hdAdd, _hdStars);
    var tbl,tbdy,tr,td; tbl=crE('TABLE'); tbl.border='0'; tbl.width='100%'; tbdy=crE('TBODY'); tbl.appendChild(tbdy); tr=crE('TR'); tbdy.appendChild(tr); td=crE('TD');
    if(_cObj(tblHI)) dvVP.appendChild(tblHI);
    tr.appendChild(td); td=crE('TD'); td.rowSpan = 2; td.vAlign="top"; td.innerHTML = _$("popupRightBanner").value; tr.appendChild(td);
    tr=crE('TR'); tbdy.appendChild(tr); td=crE('TD'); td.appendChild(tblVd); tr.appendChild(td); dvVP.style.width="780px"; dvVP.appendChild(tbl);
    var dvV = _$("dvVideo"); var _url = dvV.innerHTML; WVE(_url,dvV,"293", "396" , "1" ); _videoPopUp();
    var _id, _type; _id = _node.getAttribute("id"); _type = "V"; uS(_id, _type, vcg); 
    if(_url.indexOf("easytobook.com") != -1) videoClick(_ru, _id);
}

                            if(typeof(Sys)!=='undefined') Array.add(Sys._ScriptLoader._getLoadedScripts(), '/Search/JavaScript/WReview.js'); 
                            if( !window._combinedScripts ) { window._combinedScripts = []; } 
                            window._combinedScripts.push('/Search/JavaScript/WReview.js');

                if(typeof(Sys)!=='undefined')             
                {                
                    if(typeof(Sys._ScriptLoader) !== 'undefined')
                    {                                    
                        Sys._ScriptLoader.isScriptLoaded = function Sys$_ScriptLoader$isScriptLoaded(scriptSrc) 
                        {                                                    
                            var dummyScript = document.createElement('script');
                            dummyScript.src = scriptSrc;
                            var result = Array.contains(Sys._ScriptLoader._getLoadedScripts(), scriptSrc);
                            if( result === true ) return true;
                            result = Array.contains( window._combinedScripts, scriptSrc );
                            if( result === true ) return true;                            
                            var scriptTags = document.getElementsByTagName('script');
                            for(var i = 0; i < scriptTags.length; i ++ ) if( scriptTags[i].src == dummyScript.src ) return true;
                            return false;
                        }
                    }                    
                }