//var e_dep_date="";
//var e_ret_date="";
//var e_dst="";
//------------------Validate Date Input---------------------------------
function ValidateDataInput()
{
    var errMsg="";
    if(oa("txtDst")=="")
        errMsg += "<li>" + e_dst+"</li>";
        
    if(errMsg =="")
        return true;        
    else
    {
        Error(errMsg);
        return false;
    }
}
function IsTimeout(ret_text)
{
    return ret_text=="Timeout";
}
function RedirectLogin()
{
    window.location=SerUrl+'login.aspx?to=1';
}
function EndRequestAndValidate(str,objId)
{
    if(IsTimeout(str))RedirectLogin();
    else if(o(objId)!=null) o(objId).innerHTML=str;
}
function ValidateSession(ret_text) {
    if (IsTimeout(ret_text)) { RedirectLogin(); return false; }
    else
        return true;
}
$(document).ready(function(){
    $.ajaxSetup({
        random: Math.random(),
        cache: false,
        error: function(XMLHttpRequest, textStatus, errorThrown) {
            if (IsTimeout(XMLHttpRequest.responseText)) { RedirectLogin(); return;}
            else throw(errorThrown);
        }
    });
});
function AirCompareData7()
{
    if(ConvertDate(oa('txtDep')) < new Date())
             o('txtDep').value = getDateToStr(new Date());
    compareDate(ConvertDate(oa('txtDep')),ConvertDate(oa('txtRet')),'txtRet',5,true);
    $('#txtRet').datepicker( "option" , 'minDate' , ConvertDate(oa('txtDep')));
}
function AirCompareData()
{
    compareDate(ConvertDate(oa('txtDep')),ConvertDate(oa('txtRet')),'txtRet',0,false);
}
//---------------------------Search Fare--------------------------------------------------------------------
//window.onload = function () 
//{
//	focusInput('txt_focus', 'txt');
//}

function OT(detail_id,dst,owrtoj,via) //Open Terms
{
    //window.open('terms.aspx?rpid='+detail_id+'&dst='+dst+'&Owrtoj='+owrtoj+'&via='+via+'','popup','top=10,left=100,width=700,height=600,scrollbars=1,resizable=yes,dependent=yes').focus();
    window.open('terms.aspx?rpid='+detail_id+'&dst='+dst+'&Owrtoj='+owrtoj+'&via='+via+'','popup', '').focus();
}
function at(detail_id)
{
    var objs=o('fare_result').getElementsByTagName('div');
    for(var i=0;i<objs.length;i++)
    {
        if(objs[i].id.indexOf('dv_')>=0 && objs[i].style.display!='none')
        {
            objs[i].style.display='none';
            o(objs[i].id.replace("dv_","dvs_")).style.display='';
            
        }
    }
    a(detail_id,"TermsInfo.aspx","rpid="+detail_id+"&dst=&Owrtoj=1&via=","post",atf,true); 
    o("dv_"+detail_id).innerHTML=sloading;  
}
function atf(str,detail_id)
{
    o("dvs_"+detail_id).style.display='none';
    o("dv_"+detail_id).style.display="";
    o("dv_"+detail_id).innerHTML="<a href='#' onclick=\"Restore("+ detail_id +")\">Details<<<</a><br />"+str+"<a href='#' onclick=\"Restore("+ detail_id +")\">Details<<<</a>";
    ScrollToControl("dv_"+detail_id,30);
}
function Restore(detail_id)
{
    o("dvs_"+detail_id).style.display="";
    o("dv_"+detail_id).style.display="none";
}
function SD(detail_id,via)
{
    ShowLoading(hloading);
    a("","FareScheduleResult.aspx","detail_id="+detail_id +"&via="+via,"post",sdf,true);
}

function sdf(responseText,objId)
{
    //window.location.href = 'FareScheduleResult.aspx';
    window.open('FareScheduleResult.aspx?par='+responseText,"_self","_self",0);
}
var loading="<img src='"+SerUrl+"images/loading.gif' />";
var sloading="<img src='"+SerUrl+"images/s_loading.gif' />";
var hloading="<img src='"+SerUrl+"images/hbload.gif' />";
function Search()
{
    if(!ValidateDataInput())
        return;
    sld();
    var current_page=GetCurrentPage();
    if(current_page=="Index.aspx")
    {
        current_page="Air/Search.aspx";
    }
    window.location=SerUrl+"Air/Search.aspx"+"?"+GetParameter(),"","","selft";
}

function ShowAdvSearch()
{
    var divAdv = o("advSearch");
    if(divAdv.style.display=='none')
    {
        divAdv.style.display='';
        o('imgAdv').src=SerUrl+'images/mp1.gif';
    }
    else
    {
        divAdv.style.display='none';
        o('imgAdv').src=SerUrl+'images/mp.gif';
    }
}   

function GetParameter()
{
    var owrtoj=1;
    if(o('ckrt').checked)
        owrtoj=1;
    else if(o('ckow').checked)
        owrtoj=0;
    else if(o('ckoj').checked)
        owrtoj=2;
    var parameter="do_search_air=1"
    + "&org=" + o('slOrg').value
    + "&dst=" + o('txtDst').value 
    + "&dst_two=" + o('txtDstTwo').value 
    + "&airline=" + o('txtAirline').value
    + "&class=" + o('slClass').value
    + "&rt=" + (o('ckrt').checked?"1":"0")
    + "&owrtoj=" + owrtoj
    + "&fare_cat=" + o('slFareCat').value
    + "&direct=" + (o('ckdt').checked?"1":"0")
    + "&dep_date=" + o('txtDep').value
    + "&ret_date=" + o('txtRet').value
    + "&simple_result=" + ((o('cksr')!=null && o('cksr').checked)?"1":"0");
    if(o("advSearch")!=null)
    {
        parameter+="&weekday="+(o("ckweekday").checked?"1":"0");
        parameter+="&travel="+(o("cktravel_period").checked?"1":"0");
        parameter+="&validity="+(o("ckvalidity").checked?"1":"0");
        parameter+="&eff="+(o("ckeff").checked?"1":"0");
    }
    return parameter;
}
function PackageSearch()
{
    sld();
    var parameter="?do_search_pkg=1"
    + "&pkg_code=" + o('txtPkgCode').value
    + "&pkg_type=" + o('slPkgType').value
    + "&area_id=" + o('slPkgArea').value
    + "&country_id=" + o('slPkgCountry').value 
    + "&airline_id=" + o('slPkgAirline').value
    + "&city=" + o('slCity').value
    window.location=SerUrl+"Pkg/Search.aspx"+parameter,"","","selft";
}
function HotelSearch()
{
    if(o('txtHtlCity')==null)return;
    if(oa('txtHtlCity')=="")
    {
        Error(getAttibuteValue('txtHtlCity','isempty'));
        o('txtHtlCity').focus();
        return;
    }
    sld();
    var param="?do_search_htl=1"+
              "&countrycode="+o('txtHtlCountry').value+
              "&citycode="+o('txtHtlCity').value+
              "&indate="+o('txtChkIn').value+
              "&outdate="+o('txtChkOut').value+
              "&htlname="+o('txtHtlName').value+
              (o('htlIsInstOnly').checked? "&isInst=Y":"");
    window.location=SerUrl+"Htl/Search.aspx"+param,"","","selft";
}
function HtlRate(id)
{
    sld();
    window.location=SerUrl+"Htl/RateDetail.aspx?ID="+id;
}
function HotelMoreRate(htlCode)
{
    sld();
    var param="?do_search_htl=1"+
              "&countrycode="+o('txtHtlCountry').value+
              "&citycode="+o('txtHtlCity').value+
              "&htlcode="+htlCode+
              "&indate="+o('txtChkIn').value+
              "&outdate="+o('txtChkOut').value+
              "&morerate=Y"+
              "&htlname="+o('txtHtlName').value;
    window.location=SerUrl+"Htl/Search.aspx"+param,"","","selft";
}
function setHtlSch(cityCode,htlName,indate,outdate)
{
    if(o('txtHtlCity')==null){return;}
    o('txtHtlCity').value=cityCode;
    o('txtChkIn').value=indate;
    o('txtChkOut').value=outdate;
    o('txtHtlName').value=htlName;
    HotelSearch();
}
function swHtlTerms(params,isSchBySummary)
{    
    var termSchBySummary=isSchBySummary? "&tbs=1":"";
    window.open(SerUrl+'Htl/Terms.aspx?P='+params+termSchBySummary,'popup', 'width=830,height=500,scrollbars=yes,left=250,top=150');
}
function swHtlBkgInf(id,uid)
{
    sld();
    window.location=SerUrl+"Admin/HtlBookingInf.aspx?MType=H&BkgRef="+id+"&UID="+uid;
}
function swHtlEmail()
{
    window.open(SerUrl+'Htl/EmailToCust.aspx','popup', 'width=810,height=700,scrollbars=yes');
}
function HtlReserve(sId, str, msg, ckbMulId, formId, txtRateTypeId,trPaxCssName,roomCountErrMsg)
{
    var obj = o(sId);
    var ckbMul=o(ckbMulId);
    var hasSel = false;
    for(var i=0;i<=obj.getElementsByTagName("select").length-1;i++)
    {
        var sel=obj.getElementsByTagName("select")[i];
        if(sel!=null && sel.id.indexOf(str)>=0)
        {
            var s=sel.id.split('_');
            if ((s[1] == "R" || s[1] == "S") && sel.value > 0)
            {sld();hasSel=true;break;}
        }
    }
    if (!hasSel) {
        MsgBox(msg, "", true);
        return;
    }
    if (ckbMul != null && ckbMul.checked) {
        var l = $('tr.' + trPaxCssName).length;
        var num=0;
        $('#RateList select[id^="Item_"]').each(function() {
        if (this.id.split('_')[1] == 'R' || this.id.split('_')[1] == 'S')
                num += parseInt(this.value);
        });
        if (num <= l)
            o(formId).submit();
        else
        {MsgBox(roomCountErrMsg, "Information", true);return;}    
    }
    else {
        $.get(SerUrl + "Htl/Callback.aspx", { type: 6, r: Math.random(), RateType: oa(txtRateTypeId) });
        o(formId).submit();
    }
}
function HtlEnableAppBkg(chk, dvId,submitBtnId,guestListId) {
    $dvBkgRef = $('#' + dvId);
    $guestList = $('#' + guestListId);
    if (chk.checked) {
        $dvBkgRef.show();
        if($guestList.html()!='') $guestList.show();
        ChgBtnEnable(submitBtnId,false);
    }
    else {
        $dvBkgRef.hide();
        $guestList.hide();
        ChgBtnEnable(submitBtnId, true);
    }
}
function HtlCheckLastSeg(txtBkgRefId,txtRateTypeId,submitBtnId,guestListId) {
    if (IsEmpty(oa(txtBkgRefId))) {
        o(txtBkgRefId).className = 'txtrq';
        return;
    }
    else {
        o(txtBkgRefId).className = 'txt';
        sld('content');
        $.getJSON(SerUrl + 'Htl/Callback.aspx', { type: 3, BkgRef: oa(txtBkgRefId), RateType: oa(txtRateTypeId), r: Math.random() },
        function(data) {
            if (!ValidateSession(data)) return;
            if (data.success) {
                $.get(SerUrl + "Htl/Callback.aspx", { type: 5, BkgRef: oa(txtBkgRefId), r: Math.random() }, function(result) {
                    $('#' + guestListId).html(result);
                    $('#' + guestListId).show();
                    ChgBtnEnable(submitBtnId, true); CloseMsgBox();
                });
            }
            else
            { CloseMsgBox(); MsgBox(data.message, 'Information', true); }
        })
    }
}
//passenger list
function HtlPaxSelChg(listId,selObj,tablePrefix,trPrefix,selPaxNumPrefix,selPaxPrefix) {
    if(selObj.value=='')
        return;
    var keys = selObj.id.split('-')[1].split('_');
    var $sels = $("#" + listId + " select[id^='" + selPaxPrefix + "']");
    $sels.each(function(index) {
        if (selObj.id != this.id && selObj.value == this.value) {
            if ($(selObj).attr("oldvalue") == '')
                DelPaxRow(trPrefix + this.id.split('-')[1], true, tablePrefix, trPrefix, selPaxNumPrefix, selPaxPrefix);
            else {//switch old value
                $(this).attr("oldvalue", this.value);
                this.value = $(selObj).attr("oldvalue");
            }
        }
    });
}
function AddPaxRow(roomID,delBtnStr,tablePrefix,trPrefix,selPaxNumPrefix,selPaxPrefix) {
    var tab = o('tb-' + roomID); //first row is the title
    var $paxRows = $(tab).find('tr[id^="'+trPrefix+'"]');
    var trFirst = $paxRows[0];
    var paxNum = parseInt($paxRows[$paxRows.length-1].id.split('-')[1].split('_')[2]);
    var tr = tab.insertRow(tab.rows.length);
    tr.id = trPrefix + roomID + "_" + (paxNum + 1);
    var tdSel = tr.insertCell(0);
    tdSel.innerHTML = ReplaceStr(trFirst.cells[0].innerHTML, trFirst.id.split('-')[1], 'g', tr.id.split('-')[1]);
    $(tdSel).find("select").val("");
    var tdDel = tr.insertCell(1);
    $(tdDel).html("<span class='Hand2' onclick=\"DelPaxRow('" + tr.id + "',true,'"+tablePrefix+"','"+trPrefix+"','"+selPaxNumPrefix+"','"+selPaxPrefix+"')\">" + delBtnStr + "</span>");
    $(tdDel).addClass("tdl");
    $(tdSel).css('width', 140);
    $(tr).addClass("tdl");
    
}
function ChgPaxNum(selObject,delBtnStr,tablePrefix,trPrefix,selPaxNumPrefix,selPaxPrefix) {
    var diff = 0;
    var roomID = selObject.id.split('-')[1];
    var rows=$('#'+tablePrefix +roomID+' tr[id^="'+trPrefix+'"]');
    diff = selObject.value - rows.length;
    if (diff == 0) return;
    else if (diff > 0) { for (i = 0; i < diff; i++) AddPaxRow(roomID, delBtnStr, tablePrefix, trPrefix, selPaxNumPrefix, selPaxPrefix); }
    else {
        diff = 0 - diff;
        rows.each(function(i) 
        { 
            if(i>=rows.length-diff) DelPaxRow(this.id,false,tablePrefix,trPrefix,selPaxNumPrefix,selPaxPrefix);
        });
            
     }
}
function DelPaxRow(trID, chgSel,tablePrefix,trPrefix,selPaxNumPrefix,selPaxPrefix) {
    var keys = trID.split('-')[1].split('_');
    var roomID = keys[0] + '_' + keys[1];
    var tab = o(tablePrefix+ roomID);
    var tr = o(trID);    
    if( $(tab).find('tr[id^="'+trPrefix+'"]').length==1) {
        $('#'+selPaxPrefix+tr.id.split('-')[1]).val("");
     }
    else
        tab.deleteRow(tr.rowIndex);
    $('table[id^="' + tablePrefix + '"]').each(function() { $(this).find('tr[id^="'+trPrefix+'"]:eq(0)').find('td:eq(1)').html(""); });
    if (chgSel) { o(selPaxNumPrefix + roomID).value = $(tab).find('tr[id^="'+trPrefix+'"]').length; }
}
//passenger list end

function HtlReserveBooking(isAppBkg,dvId,emptyMsg,bkgRef,paxReqMsg)
{
    var sthIsEmpty=false;
    var grp = o(dvId);
    if(grp==null){return false;}
    var inputs=grp.getElementsByTagName("input");
    for(var i=0;i<=inputs.length-1;i++)
    {
        var oo=inputs[i];
        if(!isAppBkg)
        {
            if(PaxNameRequired==0 && (oo.id.indexOf('Bkg_LName')>=0 || oo.id.indexOf('Bkg_FName')>=0))
            {
                if(IsEmpty(oo.value))
                    oo.value='TBA';
            }
        }
        else
        {
            if(oo.id.indexOf('SelPax-')>=0&&oo.value=='')
             {   oo.className='select_rq';   sthIsEmpty=true;}
        }
        if(oo.type.toLowerCase()=="checkbox"||oo.type.toLowerCase()=="text")
        {
            oo.className="txt";
            if(isRequired(oo))
            {
                if(oo.value==""){oo.className="txtrq";sthIsEmpty=true;}
            }
        }
    }
    if(!IsTime(oa('Bkg_AriTime')))
    {
        o('Bkg_AriTime').className='txtrq';sthIsEmpty=true;
    }
    if(!IsTime(oa('Bkg_DepTime')))
    {
        o('Bkg_DepTime').className='txtrq';sthIsEmpty=true;
    }
    if (isAppBkg) {
        $('select[id^="SelPax-"]').each(function() { if (this.value == '') { $(this).parent().addClass("select_rq"); sthIsEmpty = true; } else { $(this).parent().removeClass("select_rq"); } });
    }
    if(sthIsEmpty)
    {
        MsgBox(emptyMsg,"",true);
        return false;
    }
    if(isAppBkg&&$('select[id^="SelPax-"]')[0].length-1>$('select[id^="SelPax-"]').length)
    {
        MsgBox(paxReqMsg,"",true);
        return false;
    }
    sld();
    var params="";
    if(isAppBkg)
        params = getParams(dvId, 'SelPax-') + getParams(dvId, 'Bkg_');
    else
        params = getParams(dvId, 'Bkg_');
    a("",SerUrl+"Htl/Callback.aspx","Type=1&BkgRef="+bkgRef+params,"post",EndHtlReserveBooking,true);
}
function EndHtlReserveBooking(responseTest,objId)
{
    EndRequestAndValidate(responseTest,objId);
    var val=responseTest.split('|');
    if(val[0]=="OK"){window.location.replace(SerUrl+"Htl/Complete.aspx"+encodeURI(val[1]));}
    else if(val[0]=="ERR"){window.location.replace(SerUrl+"Htl/Complete.aspx?Err="+encodeURI(val[1]));}
    else{CM();MsgBox(val.length>=1?val[1]:val,"",true);}
}
function getHtlCityName(sId)
{
    var obj=o(sId);
    if(obj!=null&&htl!=null)
    {
       obj.innerHTML=getCityName(obj.innerHTML,htl);
    }
}
function getCityName(code,ds)
{
    for(i=0;i<ds.length;i++)
    {
        if(ds[i][0].toLowerCase()==code.toLowerCase())
        {
            return ds[i][1];
        }
    }
    return "";
}
function getAirCityName(id)
{
    var obj=o(id);
    if(obj!=null&&c!=null)
    {
       obj.innerHTML=getCityName(obj.innerHTML,c);
    }
}
function getHtlInfo(code, viewType) {
    MsgIframe("Hotel Information", 974, 690, SerUrl, "Htl/Information.aspx?Code=" + code+"&ViewType="+viewType,null);
}
function setGMapLinks(cityCode) {
    if (o('city-map') == null)
        return;
    $.getJSON(SerUrl + 'Htl/Callback.aspx', { type: 7, r: Math.random }, function(data) {
        if (!ValidateSession(data)) return;
        if (data.length == 0)
            return;
        else {
            $('#city-map').show();
            var mapStr = $('#city-map').attr('rs-map');
            for (var i = 0; i < data.length; i++) {
                if (o('map-' + data[i][0]) != null) {
                    $('#map-' + data[i][0]).html("<a href=\"javascript:getHtlInfo('" + data[i][0] + "','M')\">"+mapStr+"</a>").show();
                }
            }
        }
    });
}
function getHtlBestDeals(code)
{
    a("_HtlBestDealsList",SerUrl+"Callback.aspx","type=18&CityCode="+code,"post",EndRequestAndValidate,true);
}
function pks(area_id,country_id)
{
    o('slPkgArea').value=area_id;
    SelectAdd(o('slPkgCountry'),country_id,country_id,0);
    o('slPkgCountry').value=country_id;
    PackageSearch();
}
function ScheduleSearch()
{
    if(!ValidateDataInput())
        return;
    sld();
    a("",SerUrl+"Air/FareScheduleResult.aspx",GetParameter()+"&"+Math.random(),"post",EndScheduleSearch,true);
}
function EndScheduleSearch(responseText,objId)
{
    window.open(SerUrl+'Air/FareScheduleResult.aspx?par='+responseText+"&"+Math.random(),"_self","_self",0);
}
function HtlFilterLocation(obj)
{   
    sld();
    window.location=encodeURI(GetCurrentPage()+'?page=1&filter=' + obj.value);
}
function ChangeSort(value)
{   
    sld();
    window.location=encodeURI(GetCurrentPage()+'?sort='+value );
}
function ChangePageSize(obj,evalCode)
{
    sld();
    if(evalCode!=null&&evalCode!=""){eval(evalCode.replace("{0}",obj.value));}
    else{window.location=GetCurrentPage()+'?size='+obj.value;}
}
function sa(a)
{
    if(o('txtAirline')==null)return;
    o('txtAirline').value=a;
    Search();
}
function gc()
{
    if(o("SearchForm")==null)return;
    o("SearchForm").innerHTML=sloading;
    var current_page=GetCurrentPage();
    var pt;
    if(typeof(PageType)=="undefined")
        pt=="Home";
    else
        pt=PageType;
    var t=0;
    if(pt=="Air"){t=6;}
    if(pt=="Pkg"){t=11;}
    if(pt=="Htl"){t=16;}
    a("SearchForm",SerUrl+"Callback.aspx","type="+t+"&search_type="+current_page,"post",gcf,true,true);
}
function gcf(str,objId)
{
    if(!IsTimeout(str))
    {
        if(typeof(PageType)=="undefined")
            pt="Home";
        else
            pt=PageType;
        if(o('rdoAir')==null)PageType='Htl';
        switch(pt)
        {
            case "Pkg":
                o(objId).innerHTML=str;
                break;
            case "Htl":
                RegCss(SerUrl+"calendar/calendar-brown.css");
                RegJs(SerUrl+"calendar/lang/calendar-en.js");
                o(objId).innerHTML=str;
                break;
            case "Adm":
                o(objId).innerHTML="";                                
                break;
            default:
                o(objId).innerHTML=str;
                SetVisible();                
                new SuggestFromJS('txtDst',null,c,C,10,'Search()','/',true);
                new SuggestFromAjax('txtAirline',null,SerUrl+'Callback.aspx?Type=14',SerUrl+'Callback.aspx?Type=14',null,'Search()',',',true,true);
                if(o('txtDstTwo')!=null)
                {
                    new SuggestFromJS('txtDstTwo',null,c,C,10,'Search()','/',true);
                }
                SetupCalendar();
                break;
        }
        GetHotelDeadline(o('selHdlViewType'));
        GetTicketDeadline();
        if(PageType!='Home'){GetHtlSearchForm();GetPkgSearchForm();}
        GetFareListDir();        
        if(o('rdoAir')==null)
        {   
            if(o('rdoHtl')!=null)
                o('rdoHtl').checked=true;
            else
                if(o('rdoPkg')!=null)o('rdoPkg').checked=true;
        }
    }
    else
    {
        RedirectLogin();
    }
}
var d;
function InitFareListDirBox()
{
    d=new dTree('d','FareListTree',true,SerUrl+"Air/CallBack.aspx?type=2",SerUrl+"Air/CallBack.aspx?type=2",'dvAllPanel',640);
    setTimeout("GetLink('');",200);
}
function GetPkgSearchForm()
{
    if(o("PkgSearchBox")!=null && o('sp-psb')!=null)
    {
        a("PkgSearchBox",SerUrl+"Callback.aspx","type=13","post",EndGetPkgSearchForm,true);
    }
}
function GetTicketDeadline()
{
    var objId='TicketDeadline';
    if(o(objId)!=null)
    {
        $.get(SerUrl+"Callback.aspx",{type:19,r:Math.random()},function f(data){o(objId).style.display='none';EndRequestAndValidate(data,objId);$('#'+objId).fadeIn();});
    }
    else
    {
        GetTopNews('HotNews',21);
    }
}
function GetHotelDeadline(obj)
{
    if(o("HtlDeadline")!=null)
    {
        var vt='';
        if(obj!=null)
        {
            vt=obj.value;
            if(obj!=null) sld('DeadlineGroup');
        }
        a("HtlDeadline",SerUrl+"Callback.aspx","type=20&ViewType="+vt,"post",EndGetHtlDeadline,true);
    }
}

function EndGetHtlDeadline(data,objId)
{
    EndRequestAndValidate(data,objId);
    o(objId).style.display='none';
    $('#'+objId).show('slow');
    CloseMsgBox();
}
function EndGetPkgSearchForm(str,objId)
{
    o("PkgSearchBox").innerHTML=str;
}
function GetHtlSearchForm()
{
    if(o("HtlSearchBox")!=null && o('sp-hsb')!=null)a("HtlSearchBox",SerUrl+"Callback.aspx","type=15","post",EndGetHtlSearchForm,true);
    if(o("HtlBestDeals")!=null)$.get(SerUrl+"Callback.aspx",{type:17,r:Math.random()},function(data){EndRequestAndValidate(data,'HtlBestDeals');$('#HtlBestDeals').fadeIn('fast');});
}
function GetHotelBestDeals(pageIndex,pageSize,sortBy,isAsc)
{
    CommonSearch('Callback.aspx',17,'HtlBestDeals','dv-hotel-best-deals','dv-hotel-best-deals','','',pageIndex,pageSize,sortBy,isAsc);
}
function EndGetHtlSearchForm(str,objId)
{
    o("HtlSearchBox").innerHTML=str;
    if(o('txtHtlCountry')==null||o('txtHtlCity')==null)return;
    new SuggestFromJS('txtHtlCountry',null,htlc,htlc,10,null,null,true,null,"FilterHtlCity()");
    FilterHtlCity();
    $.include(SerUrl+'js/jquery-ui.js',function(){
        RegCss(SerUrl+"css/jquery-ui.css");
        new DateControljQuery('txtChkIn',"cal-CI",HtlCompareData,false,null,null,null,null,'+0',null,2);
        new DateControljQuery('txtChkOut',"cal-CO",HtlCompareData,false,null,null,null,null,ConvertDate(oa('txtChkIn'),'D',1),ConvertDate(oa('txtChkIn'),'D',14),2);
    });
    o('slHtlNights').onchange=HtlSelChange;
}
function FilterHtlCity()
{
    if(oa('txtHtlCountry')=="")
    {new SuggestFromJS('txtHtlCity',null,htl,HTL,10,'HotelSearch()',null,true,null,null);
    }
    else
    {
        var countryCode=oa('txtHtlCountry');
        var tmpCode="";
        var tmp="";
        for(var iTmp=0;iTmp<htl.length;iTmp++)
        {
            if(htl[iTmp][2].toUpperCase()==countryCode)
            {
                tmp+="['"+htl[iTmp][0]+"','"+htl[iTmp][1].replace(",","\,").replace("'","\\'")+"'],";
                tmpCode=countryCode;
            }
            if(tmpCode!=""&&tmpCode!=countryCode){break;}
        }
        tmp="["+tmp.substr(0,tmp.length-1)+"]";
        var htlfcity=eval(tmp);
        new SuggestFromJS('txtHtlCity',null,htlfcity,htlfcity,100,'HotelSearch()',null,true,null,null);
        ClickHtlCity(o("txtHtlCity").value=="");
    }
}
function ClickHtlCity(clear)
{
    var obj=o("txtHtlCity");
    if(obj==null)return;
    if(clear)
    {
        obj.value="";    
        if(Browser.isIE){obj.focus();obj.click();}
        else{obj.click();obj.focus();}
    }
    else
    {
        obj.focus();
    }
}
function HtlCompare(text,most,max)
{
    var s=getCheckID("htllst");
    if(s==""){MsgBox(text,null,true);}
    else if(s.split('|').length>max)
    {MsgBox(most,null,true);}
    else
    {
        sld();
        window.location=SerUrl+"Htl/Compare.aspx?CS="+s;
    }
}
function AreaChanged(area_id)
{
    o("dv_country").innerHTML+=sloading;
    a("dv_country",SerUrl+"Callback.aspx","type=12&pars="+area_id,"post",EndRequestAndValidate,true);
}
function PkgCountryChanged(country_id)
{
    o("dv-city").innerHTML+=sloading;
    a("dv-city",SerUrl+"Pkg/Callback.aspx","type=1&country_id="+country_id,"post",EndRequestAndValidate,true);
}
function GetFareListDir()
{
    if(o("FareListTree")!=null && GetCurrentPage().toLowerCase()=="farelist.aspx")
    {
        InitFareListDirBox();
    }
}

function GetSearchInfo()
{
    if(o("SearchInfo")!=null)
    {
        if(o('hdPrint')==null){
            a("SearchInfo",SerUrl+"Callback.aspx","type=1","post",siff,true);
        }
        else
        {
            var param='?print=Y';
            param+=(o('hdIsSimple')!=null && oa('hdIsSimple')=='Y')? '&simple=Y':'';
            a("SearchInfo",SerUrl+"Callback.aspx"+param,"type=1","post",siffPrint,true);
        }
    }
}
function siff(str,objId)
{
    o(objId).innerHTML=str;
    window.setTimeout("GetFooter()","0");
    getAirCityName('OrgCity');
    getAirCityName('DstCity');
}
function siffPrint(str,objId)
{
    o(objId).innerHTML=str;
    getAirCityName('OrgCity');
    getAirCityName('DstCity');
    AirPrint();
}
function GetFooter()
{
    if(o("FooterInfo")!=null)
    {
        a("FooterInfo",SerUrl+"Callback.aspx","type=2&search_type="+GetCurrentPage(),"post",EndRequestAndValidate,true);
        o("FooterInfo").innerHTML=sloading;
    }
}
function GetTopNews(div_id,new_type)
{
    if (o(div_id) != null && o(div_id).innerHTML == '') {
        $.get(SerUrl+"Callback.aspx",{type:new_type,search_type:GetCurrentPage(),r:Math.random()},function f(data){EndRequestAndValidate(data,div_id);if(o(div_id).style.display!='none'){if(GetCurrentPage()=='Home.aspx')o(div_id).style.backgroundColor='#ffffff';o(div_id).style.display='none';$('#'+div_id).fadeIn();}});
        $('#'+div_id).html(sloading);
    }
}

function SetVisible()
{
    if(o('ckow').checked)
    {
        o('lb_ret').style.display='none';
        o('dv_ret').style.display='none';
    }
    else
    {
        o('lb_ret').style.display='';
        o('dv_ret').style.display='';
    }
    if(o('txtDstTwo')!=null)
    {
        if(o('ckoj').checked)
        {
            if(o('rowojtitle')!=null)o('rowojtitle').style.display='';
            o('rowoj').style.display='';
        }
        else
        {
            if(o('rowojtitle')!=null)o('rowojtitle').style.display='none';
            o('rowoj').style.display='none';
        }
    }
}
var str_tb="<table>{0}</table>";
var str_tr="<tr style='height:25px;'>{0}</tr>";
var str_td="<td>{0}</td>";
var str_row=str_tr.replace("{0}",str_td);
var str_terms="<img src='"+SerUrl+"images/t.gif' style='cursor:hand' onclick=\"OT('{0}','{1}','{2}','{3}')\" />";
var str_schedule="<input type='button' onclick=\"SD({0},'{1}');\" class='btn3' value='{2}' />";
var last_via;
var last_detail_id;
function show_result_info()
{
    if(o("fare_result")==null)return;
    var a;
    var objs=o('fare_result').getElementsByTagName("div");
    for(var i=0;i<objs.length;i++)
    {
        if(objs[i]!=null&&objs[i].id!="")
        {
            var ainfo=objs[i].id.split("_");
            a = ainfo[1];
            if(ainfo.length>0)
            if(ainfo[0]=="a")
            {
                objs[i].innerHTML="<img style='padding-left:1px;' src=\"a/"+ainfo[1]+".gif\" class='Hand' onmouseout=\"close_fare_info()\" onmouseover=\"delay_fare_info('"+a+"','"+objs[i].id+"',"+ainfo[2]+");\"/>";
            }
            else if(ainfo[0]=="vias")
            {
                var detail_id=ainfo[1].trim();
                var vias_content="";
                var terms_content="";
                var schedule_content="";
                var vias=objs[i].innerHTML.split(",");
                for(var j=0;j<vias.length;j++)
                {
                    last_via=vias[j].trim();
                    last_detail_id=detail_id;
                    vias_content+=str_row.replace("{0}",vias[j].trim());
                    var s=str_row.replace("{0}",str_terms.replace("{0}",detail_id).replace("{1}",Dst).replace("{2}",OWRTOJ).replace("{3}",vias[j].trim()));
                    terms_content+="<table cellpadding='0px' cellspacing='0px'><tr><td>"+str_tb.replace("{0}",s)+"</td><td><img src='../images/mp.gif' title='Preview' style='cursor:pointer;' id='pv_bt_"+detail_id+vias[j].trim()+"' onclick=\"PreviewFare('"+detail_id+"','"+Dst+"','"+OWRTOJ+"','"+vias[j].trim()+"');\" /></td></tr></table>";
                    schedule_content+=str_row.replace("{0}",str_schedule.replace("{0}",detail_id).replace("{1}",vias[j].trim()).replace("{2}",ScheduleText));
                }
                objs[i].innerHTML=str_tb.replace("{0}",vias_content);
                objs[i].style.display="";
                $("#terms_"+detail_id).html(terms_content);//str_tb.replace("{0}",terms_content);
                $("#schedule_"+detail_id).html(str_tb.replace("{0}",schedule_content));
            }
        }
    }
    //window.setTimeout("init_terms('"+OWRTOJ+"','"+Dst+"','"+last_detail_id+"','"+last_via+"')","1000");
}
function init_terms(OWRTOJ,Dst,last_detail_id,last_via)
{
    a("",SerUrl+"Air/Terms.aspx","init=1&rpid="+last_detail_id+"&dst="+Dst+"&Owrtoj="+OWRTOJ+"&via="+last_via+"","post",EndRequestAndValidate,true);
}
function PreviewFare(detailId,dst,owrtoj,via)
{
    var objs=o('fare_result').getElementsByTagName('div');
    for(var i=0;i<objs.length;i++)
    {
        if(objs[i].id.indexOf('pv_')>=0 && objs[i].style.display=='' && objs[i].id.indexOf(detailId)<0)
        {
            objs[i].style.display='none';
            o(objs[i].id.replace('pv_','f_')).className='rr';
            o(objs[i].id.replace('pv_','dvs_')).style.display='';
            if(o('cksr').checked)o(objs[i].id.replace('pv_','t_')).style.display='none';
        }
    }
    objs=o('fare_result').getElementsByTagName('img');
    for(var i=0;i<objs.length;i++)
    {
        if(objs[i].id.indexOf('pv_bt_')>=0)
        {
            objs[i].src='../images/mp.gif';
        }
    }
    var row=o('f_'+detailId);
    var row_pv=o('pv_'+detailId);
    if(row.className!='tr-focus')
    {
        row.className='tr-focus';
        row.cells[0].style.backgroundColor='white';
        row.cells[1].style.backgroundColor='white';
        row_pv.className='fare_pv';
        o('pv_bt_'+detailId+via).src='../images/mp1.gif';
        row_pv.style.display='';
        a('pv_'+detailId,SerUrl+"Air/summaryterms.aspx?rpid="+detailId+"&dst="+dst+"&Owrtoj="+owrtoj+"&via="+via,"","post",EndPreview,true);
        if(!o('cksr').checked)sld('pv_'+detailId);
        o('t_'+detailId).style.display='';
        o('dvs_'+detailId).style.display='none';
        
    }
    else
    {
        CloseMsgBox();
        row.className='rr';
        row_pv.style.display='none';
        o('dvs_'+detailId).style.display='';
        o('pv_bt_'+detailId+via).src='../images/mp.gif';
        if(o('cksr').checked)
        {
            o('t_'+detailId).style.display='none';
        }
    }
}
function EndPreview(content,objId)
{
    o(objId).innerHTML=content;
    CloseMsgBox();
}
var fareinfotimeout;
function close_fare_info()
{
    clearTimeout(fareinfotimeout);
    CloseMsgBox();
}
function delay_fare_info(airline,obj_id,detail_id)
{
    fareinfotimeout=setTimeout("show_fare_info('"+airline+"','"+obj_id+"',"+detail_id+")",500);
}
function show_fare_info(airline,obj_id,detail_id)
{
    var left=parseInt(GetPosition(o(obj_id)).left)+160;
    var top=parseInt(GetPosition(o(obj_id)).top)+35;
    
	if(GetBrowser().indexOf("Firefox")<0)
	{
	    top=top-30;
        left=left-67;
	}
	else
    {
	    top=top-30;
        left=left-70;
	}
	
    CM();
    ShowDiv("<div id='fare_info'>&nbsp;&nbsp;"+sloading+"Loading fare info...&nbsp;&nbsp;</div>",0,0,"#CEDCEB","SHADOW",left,top);
    a("fare_info",SerUrl+"Callback.aspx","type=7&airline="+airline+"&detail_id="+detail_id,"post",end_get_fare_info,true);
}

function end_get_fare_info(responseText,objId)
{
    if(!IsTimeout(responseText))
    {
        if(o("fare_info")!=null)
            o("fare_info").innerHTML=responseText;
    }
    else
    {
        RedirectLogin();
    }
    //addEvent(o('fare_info'),"onclick",CloseMsgBox);
}
function SetTermsVisible()
{
    var term_trs=document.getElementsByTagName('tr');for(var i=0;i<term_trs.length;i++){if(term_trs[i].id!=null && String(term_trs[i].id).indexOf('t_')>=0)if(o('cksr').checked)term_trs[i].style.display='none';else term_trs[i].style.display='';}
}
function SetupCalendar()
{
    //RegCss(SerUrl+"calendar/calendar-brown.css");
    //RegJs(SerUrl+"calendar/lang/calendar-en.js");
    $.include(SerUrl+'js/jquery-ui.js',function(){
    RegCss(SerUrl+"css/jquery-ui.css");
    new DateControljQuery('txtDep',"cal-dep",AirCompareData7,false,null,null,null,null,'+0',null,2);
    new DateControljQuery('txtRet',"cal-ret",AirCompareData,false,null,null,null,null,oa('txtDep'),null,2);
    });
}
//-----------------------News----------------------------------
var shown_objects = new Array();
function toggle_object_visible(id)
{
	var obj = o(id);
	if (!obj || !obj.style) return;
	obj.style.display = (obj.style.display=="none") ? "block":"none";
	shown_objects[id]=(obj.style.display=="block");
}
function set_object_visible(id, val)
{
	var obj = o(id);
	if (!obj || !obj.style) return;
	obj.style.display = (val=="Y") ? "block":"none";
	shown_objects[id]=(val=="Y");
}
function hide_all_objects()
{
	for(var i in shown_objects)
	{
		set_object_visible(i,"N");
	}
}
var CurrNewsID=0;
function ShowDetail(a,b)
{
    toggle_object_visible(a,b);
    if(CurrNewsID!=0)
    {
        toggle_object_visible(CurrNewsID,"Y");
        o("A_"+CurrNewsID).style.display='';
    }
	o("A_"+a).style.display='none';
	CurrNewsID=a;
}
function HtlSearch()
{
}
function HtlSelChange()
{
    HtlCktDate(false);
}
function HtlCktDate(txtChange)
{
    var selN=o('slHtlNights');
    if (txtChange == 'txtChkIn') 
    {
        if (ConvertDate(oa('txtChkIn')) < new Date()) {
            o('txtChkIn').value = getDateToStr(new Date());
        }
        o('txtChkOut').value=getDateToStr(DateAdd('d',parseInt(selN.value),ConvertDate(oa('txtChkIn'))));
        return;
    }
    selN.style.color="";
    var num=1;
    var i=daysElapsed(ConvertDate(oa('txtChkOut')),ConvertDate(oa('txtChkIn')));
    if(!txtChange)
    {
        num=parseInt(selN.value,10);
    }
    else
    {
        if(i>14)
        {num=14;
        txtChange=false;
        selN.options[13].selected=true;
        selN.style.color="Red";
        //Error(getAttibuteValue('txtChkOut','msg'));
        }
        else if(i<1){selN.options[0].selected=true;}
        else{selN.options[i-1].selected=true;}
    }
    compareDate(ConvertDate(oa('txtChkIn')),ConvertDate(oa('txtChkOut')),'txtChkOut',num,!txtChange);
}
function HtlCompareData(txtChange)
{
    HtlCktDate(txtChange);
    if(txtChange=='txtChkIn')
    {
        $('#txtChkOut').datepicker( "option" , {minDate: ConvertDate(oa('txtChkIn'),'D',1),maxDate:ConvertDate(oa('txtChkIn'),'D',14)});
    }
}
function Init()
{
//    window.setTimeout("GetSearchInfo()","0");
//    window.setTimeout("gc()","0");
    show_result_info();
    gc();
    GetSearchInfo();
}
$(document).ready(function(){Init();});

//pkg booking
function PkgBkgInit()
{
    new DateControl('txtDep',"cal-dep",null);
}
//end pkg booking
function getCheckID(name,max)
{
    var s="";
    var m=0;
    for(var i=0;i<document.getElementsByName(name).length;i++)
    {
        if(max!=null){if(m>=max){return s.substr(0,s.lastIndexOf('|'));}}
        var o=document.getElementsByName(name)[i]
        if(o.checked)
        {
            s+=o.id+"|";
            m++;
        }
    }
    return s.substr(0,s.lastIndexOf('|'));
}
function showNewsInfo(id)
{
    window.open(SerUrl+'NewsInfo.aspx?ID='+id,'','width=685,scrollbars=yes,left=300,top=100,height=600,resizable=yes');
}
function getMsgCount()
{
    if(o('msg_count')!=null)a("msg_count",SerUrl+"Callback.aspx","type=22","post",EndRequestAndValidate,true);
}
window.setTimeout('getMsgCount();',3000);
if(o('dv_bkg_info')!=null)
{
    a("dv_bkg_info",SerUrl+"Air/Callback.aspx","type=0","post",EndRequestAndValidate,true);
}
function chgHtlRoomTypePrice()
{
    chgHtlRoomTypePrice4Print();
    chgHtlQTY();
}
function chgHtlRoomTypePrice4Print()
{
    var sell=o('rdoSell');
    var net=o('rdoNet');
    var obj=o('RateList');
    var oo=obj.getElementsByTagName("span");
    if(net.checked)
    {
        o('sp-currency').innerHTML=o('sp-currency-net').innerHTML;
    }
    else
    {
        o('sp-currency').innerHTML=o('sp-currency-selling').innerHTML;
    }
    for(var i=0;i<=oo.length-1;i++)
    {
        var sp=oo[i];
        if(sp.id.indexOf('Sell_',0)>=0)
        {
            if(sell.checked){sp.style.display="";}
            else{sp.style.display="none";}
        }
        if(sp.id.indexOf('Net_',0)>=0)
        {
            if(net.checked){sp.style.display="";}
            else{sp.style.display="none";}
        }
    }
}
function chgHtlQTY()
{
    var obj=o("RateList");
    var oSell=o('rdoSell');
    if(oSell==null){oSell=true;}
    else{oSell=oSell.checked;}
    var tot=0;
    for(var i=0;i<=obj.getElementsByTagName("select").length-1;i++)
    {
        var oo=obj.getElementsByTagName("select")[i];
        tot+=oo.value*getAttibuteValue(oo.id,oSell?'sell':'net');
    }
    o("RateTot").value=tot;
}
function PkgDL(id,f,ft,cn,isGetB2C)//Pkg Download
{
    var url=SerUrl+"Pkg/DownloadFile.aspx?pk_vacation_id=" + id + "&FileName=" + f+"&FileType="+ft+"&CityName="+cn+(isGetB2C=="Y"?"&IsGetB2C=Y":"");
    if(ft=='ppt')
        window.location=url;
    else
        window.open(url);
}
function CountryChanged(country_code)
{
    o("dv_city").innerHTML+=sloading;
    a("dv_city",SerUrl+"Common/Callback.aspx","type=0&pars="+country_code,"post",EndRequestAndValidate,true);
}
function HtlShowSearchPrint(v) 
{    
    v = (v=='')?0:v;
    var width=($.browser.msie && $.browser.version=='6.0')? '840':'820';
    window.open('Search4Print.aspx?markup='+ v, 'popup', 'width='+width+',height=750,scrollbars=yes,resizable=yes,left=250,top=50');
}
var HtlSchWidth;
function HtlSearchPrint(print)
{
    function display(enable)
    {
        if(enable)
        {
            if($.browser.msie){
               HtlSchWidth=$('#contentpop>div.divborderpad').css('width');
               $('#contentpop>div.divborderpad').css('width','600px'); 
            }
        }
        else
        {
            if($.browser.msie){
                $('#contentpop>div.divborderpad').css('width',HtlSchWidth); 
            }    
        }
    }
    
    if(print==null)
    {PrintPage("HtlSearchPrint('S');","HtlSearchPrint('E');");}
    else if(print=="S"){display(true);}
    else if(print=="E"){display(false);}
}
var HtlInfoWidth;
function HtlInfoPrint(print) {
    function display(enable) {
        if (enable) {
            o('imgADLogo').style.display = '';
            if ($.browser.msie&&$.browser.version!='6.0') {
                HtlInfoWidth = $('#HtlInfo').width();
                $('#HtlInfo').width('625px');
            }
            
        }
        else {
            o('imgADLogo').style.display = 'none';
            if ($.browser.msie && $.browser.version != '6.0') {
                $('#HtlInfo').width(HtlInfoWidth);
            }
        }
    }
    if (print == null)
    { PrintPage("HtlInfoPrint('S');", "HtlInfoPrint('E');"); }
    else if (print == "S") { display(true); }
    else if (print == "E") { display(false); }
}
function HtlDetailRatePrint(isStart)
 {
    function display(start)
    {
        if(start)
        {
          o('dvBtn').style.display='none';
          if(o('dvTypePannel')!=null){
            o('dvTypePannel').style.display='none'
            if(o('rdoNet').cheked){o('dvSell').style.display='none';o('dvNet').style.display='';}
            else{o('dvSell').style.display='';o('dvNet').style.display='none';}
          }
          else {o('dvSell').style.display='';o('dvNet').style.display='none';}         
        }
        else
        {if(o('dvTypePannel')!=null)o('dvTypePannel').style.display='';
         o('dvSell').style.display='none';o('dvBtn').style.display='';
         o('dvNet').style.display='none';}
    }
    
    if(isStart==null)
    {PrintPage("HtlDetailRatePrint(true);","HtlDetailRatePrint(false);");}
    else if(isStart){display(true);}
    else {display(false);}
 }
function AirShowPrint()
{
    var param='';
    if(o('cksr').checked) param='?simple=Y';
    window.open('SearchForPrint.aspx'+param, 'popup', 'width=810,height=768,scrollbars=yes,resizable=yes,left=250,top=50');
} 
var fareResultWidth; 
function AirPrint(print)
{
    function display(enable)
    {
        if(o('imgADLogo')==null)return;
        if(enable)
        {
            o('imgADLogo').style.display='';
            var width=Browser.isIE?'600px':'950px';
            fareResultWidth=$('#dv-fare-result').width();
            if(Browser.isIE)$('#dv-fare-result').width(width);
        }
        else
        {o('imgADLogo').style.display='none';$('#dv-fare-result').width(fareResultWidth);}
    }
    
    if(print==null)
    {PrintPage("AirPrint('S');","AirPrint('E');");}
    else if(print=="S"){display(true);}
    else if(print=="E"){display(false);}
}
/*Get the link of fare list*/
function GetLink(folder,showexpired,showexpiredfile,showall,pageIndex,pageSize,sort,isAsc,clsLD,iniParm,isRef)
{    
    
    if(!clsLD){sld("dvfl");} 
    var pars;
    pars="type=1";    
    if(!IsEmpty(folder)) { pars+="&folder="+encodeURIComponent(folder);}
    if(!IsEmpty(showexpired))    pars+="&showexpired="+showexpired;
    if(!IsEmpty(showexpiredfile))    pars+="&showexpiredfile="+showexpiredfile;
    if(!IsEmpty(showall))   pars+="&showall="+showall;
    if(!IsEmpty(pageIndex))   pars+="&pageIndex="+pageIndex;
    if(!IsEmpty(pageSize))   pars+="&size="+pageSize;
    if(!IsEmpty(sort))   pars+="&sort="+sort;
    if(!IsEmpty(isAsc))   pars+="&isAsc="+(isAsc?"Y":"N");
    if(!IsEmpty(iniParm))   pars+="&iniParm="+iniParm;
    if(!IsEmpty(isRef) && isRef)   pars+="&isRef=1";
    a("dvListDetail",SerUrl+"Air/CallBack.aspx",pars,"post",EndGetLink,true);
    if(showexpired==null)showexpired='';if(showexpiredfile==null)showexpiredfile='';if(showall==null)showall='';if(showall==null)showall='';
    if(pageIndex==null)pageIndex='null';if(pageSize==null)pageSize='null';if(sort==null)sort='';if(clsLD==null)clsLD=false;if(iniParm==null)iniParm=false;
    o('td-refresh').innerHTML="&nbsp;<input type='button' class='btn3' value='Refresh' onmousedown=\"GetLink('"+folder.replace('\\','\\\\')+"','"+showexpired+"','"+showexpiredfile+"','"+showall+"',"+pageIndex+","+pageSize+",'"+sort+"',"+isAsc+","+clsLD+","+iniParm+",true);\" />";
}
function EndGetLink(str,objId)
{
    CloseMsgBox();
    if(IsTimeout(str))RedirectLogin();
    else 
    {
        o(objId).innerHTML=str;
        o(objId).style.display='none';
        $('#'+objId).fadeIn();
        //if (o('dvFontSize')!=null)         
        //    o('dvFontSize').style.display=o('dvfileList').style.display;
    }
}
function Full()
{
    o('footer').style.display='none';
    o('travel').style.display='none';
    o('header').style.display='none';
    o('dvfl').style.width='1024px';
    o('main').style.width='1280px';
    o('btnly').value='Normal Screen';
    o('dvListDetail').style.display='none';
    $('#dvListDetail').show('fast');
}
function Normal()
{
    o('footer').style.display='';
    o('travel').style.display='';
    o('header').style.display='';
    o('dvfl').style.width='';
    o('main').style.width='974px';
    o('btnly').value='Full Screen';
    o('dvListDetail').style.display='none';
    $('#dvListDetail').fadeIn();
}

function callFeedback(sLang) {
    window.open("http://www.westminstertravel.com/hkwtl/" + sLang + "/feedback/WtlFeedback.php?Area=ADH", "", "left=300,top=100,height=750,width=700,location=no,menubar=no,resizable=yes,titlebar=yes,toolbar=no,scrollbars=yes", "");
}

function showADNewsDetail(id){
    window.open(SerUrl+'NewsDetail.aspx?ID='+id,'','width=685,scrollbars=yes,left=300,top=100,height=600,resizable=yes');
}

function showMarkupBox(){ 
    var left=parseInt(GetPosition(o('markPosition')).left)+72;
    var top=parseInt(GetPosition(o('markPosition')).top)+50;
    
	if(GetBrowser().indexOf("Firefox")<0)
	{
	    top=top-30;
        left=left-67;
	}
	else
    {
	    top=top-30;
        left=left-70;
	}
    markupContent = "<div style='margin-top:5px;width:90px;height:52px;display:block;' onmouseover=\"o('alert_div').style.display=''\" onmouseout=\"o('alert_div').style.display='none';\"  ><input type='text' onmouseover=\"o('alert_div').style.display=''\" id='markup' class='txt' value='' style='ime-mode:disabled;width:40px;' onKeyPress='onlyNumber(this, event)' maxlength='10'  /><div style='margin-top:5px;width:80px;text-align:center;display:block;'><input type='button' class='btn3' value=' + ' onmouseover=\"o('alert_div').style.display=''\" onclick=\"checkMark();\" /></div></div>";
    ShowDiv(markupContent, 90, 52, "#BAD6FE", "", left, top);
}
function checkMark(){
    var markValue = oa('markup');
    markValue = (markValue.indexOf('.')==0)?('0'+markValue):markValue;
    if(markValue.indexOf('.')==(markValue.length-1)){
        markValue = markValue + '0';
    }
    HtlShowSearchPrint(markValue);
}