    document.body.onkeydown = handleKeyDown; window.onkeydown = handleKeyDown;
    function handleKeyDown(e) {
        e = e || event; if (e.keyCode == 27) {
            oCal.hideCalendar();
        }
    }

    function clearText() {
        var oDest = document.getElementById(sSearchClientID + 'txtDest');
        if (oDest != null && oDest.value.trim().length > 0) { oDest.value = ""; }
    }
    
    function OnDateKeyPress(e) {
        e = e || event; if (e.keyCode == 9) {
            return true;
        }
        else { return false; }
    }
    function AdjustWidthLiveSearch() {
        var obj = document.getElementById('LiveSearchExtender_completionListElem');
        AdjustLocationIndicatorStyle(obj);
    }
    
    function GetSelectedItemValue(source, eventArgs) {
        var oHdnValue = document.getElementById(sSearchClientID + "hdnSelectedItemValue");
        if (oHdnValue != null) { if (eventArgs.get_value() != null) { oHdnValue.value = eventArgs.get_value(); } }
    }
function ShowHideLocationList(oFlag)
{
    var oLocationLbl = document.getElementById(sSearchClientID + 'lblLocationText');
    var oImg1 = document.getElementById('img1');
    var oDivLocationDD = document.getElementById('divLocationList');             
    if(oImg1 != null && oLocationLbl != null && oDivLocationDD != null)
    {
        if(oImg1.title == "Expand")
        {             
           oDivLocationDD.style.display = "block";  
           oDivLocationDD.style.visibility = "visible";
           oImg1.src = "/images/icons/icon_minus.gif";             
           oImg1.title = "Collapse";
           oLocationLbl.innerHTML = "Remove list of Locations";  
           oLocationLbl.title = "Remove list of Locations";                              
        }
        else if(oImg1.title == "Collapse")        
        {              
           oImg1.src = "/images/icons/icon_plus.gif";             
           oImg1.title = "Expand";
           oLocationLbl.innerHTML = "Show list of Locations";     
           oDivLocationDD.style.display = "none";        
           oLocationLbl.title = "Show list of Locations";                              
        }        
    }
}
function ChangeSearchImage()
{   
    var oSearchImg = document.getElementById(sSearchClientID + 'btnSubmit');
    var oImgActLink = "/Images/search_btn_bg_hover.gif";
    var oImgInActLink = "/Images/search_btn_bg.gif";
    var oImgSrc = oSearchImg.src;  
    if(oSearchImg != null && oImgSrc != null)
    {        
        if(oImgSrc.indexOf(oImgInActLink) != -1)
        {           
           oSearchImg.src = oImgActLink;    
        }
        else if(oImgSrc.indexOf(oImgActLink) != -1)       
        {
           oSearchImg.src = oImgInActLink;
        }
    }
}

function ValidateDestinationSelection() {
    var oDestText = document.getElementById(sSearchClientID + 'txtDest');
    var oDiv = document.getElementById('ErrorDiv');
    var oDivLocationDD = document.getElementById('divLocationList');
    var oDest = document.getElementById(sSearchClientID + 'ddDest');

    if (oDestText != null && oDiv != null && oDivLocationDD != null) {
        oDiv.style.display = "none";
        var bDestListVisible = "true";
        if (oDestText.value.length < 1 && oDivLocationDD.style.display == "none") {
            if (bDestListVisible == "True") {
                ShowHideLocationList('true');
            }
            else {
                oDiv.innerHTML = "Please enter your destination.";
            }
            oDiv.style.display = "block";
            return false;
        }
    }
    ShowWaitPage();
    return true;
}
