// 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;
                        }
                    }                    
                }