﻿function GetSearchTitle(obj) {
    var titleobj = obj;
    //alert(obj);
    var searchboxobj = document.getElementById("selbox");
    // alert(obj);
    searchboxobj.innerHTML = obj;
    // alert(obj);
    document.getElementById("pulldownmenu").style.display = "none";

}
function JumpSearch() {
    var searchboxtxt = document.getElementById("selbox").innerHTML;
    var searchvaluetxt = document.getElementById("txt_search").value;
    if (searchboxtxt == "优惠券") {

        window.location.href = "../Coupon/S_|" + encodeURI(searchvaluetxt)+".htm";
    }
    else if (searchboxtxt == "商户") {
        window.location.href = "../BC/S_|" + encodeURI(searchvaluetxt)+".htm";
    }
    else if (searchboxtxt == "折扣快报") {
        window.location.href = "../BC/D_" + encodeURI(searchvaluetxt)+".htm?sectype=";
    }
    else if (searchboxtxt == "产品") {
        window.location.href = "../OnSale/OnSaleSearchList.aspx?keyword=" + encodeURI(searchvaluetxt);
    }
    else if (searchboxtxt == "精彩活动") {
        window.location.href = "../Activity/S_" + encodeURI(searchvaluetxt)+".htm";
    }
    else if (searchboxtxt == "热门专题") {
        window.location.href = "../BC/R_" + encodeURI(searchvaluetxt)+".htm";
    }
    else if (searchboxtxt == "乐享时尚") {
        window.location.href = "../BC/H_" + encodeURI(searchvaluetxt)+".htm?sectype=";
    }
    else if (searchboxtxt == "VELO公告") {
        window.location.href = "../Home/AnnouncementList.aspx?keyword=" + encodeURI(searchvaluetxt);
    }
    else if (searchboxtxt == "积分商户") {
        window.location.href = "../BC/CommercialList.aspx?enjoytype=9&sectype=&keyword=" + encodeURI(searchvaluetxt);
    }
}

var objlogin = '';

function JudgeIsLoginOrNot(type, myind, bname, content, logopath) {
    if (type == "mycoupon") {
        var strurl = "../Userinfo/pop/PopCoupon_" + myind +".htm";
        window.open(strurl, "PrintCoupon", "height=600, width=510, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");
    }
    else {

        if (objlogin != "") {
            if (type == "printe") {
                var strurl = "../Userinfo/pop/PrintCoupon.aspx?bname=" + encodeURI(bname) + "&content=" + escape(content) + "&couponid=" + myind;
                //SetMainFloatURL(strurl,800,600,false,300,150);
                window.open(strurl, "PrintCoupon", "height=400, width=720, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");
            }
            else if (type == "sms") {

                var strurl = "../Userinfo/pop/TelDownload.aspx?couponid=" + myind + "&bcid=" + bname;
                window.open(strurl, "PrintCoupon", "height=280, width=300, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");
            }

            else {
                var strurl = "../Userinfo/pop/Favorites.aspx?BCEID=" + myind + "&BCID=" + bname;
                if (myind == "") {
                    strurl = "../Userinfo/pop/Favorites.aspx?BCID=" + bname;
                }
                window.open(strurl, "PrintCoupon", "height=500, width=510, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");
            }

        }
        else {
            //alert("请先登陆！");
            var fname = window.location.href;
            window.location.href = "../Userinfo/Login.aspx?RtnURL=" + fname;
        }
    }
}

function chosecityon() {
    document.getElementById("chosecity").className = "block";
}
function chosecityoff() {
    document.getElementById("chosecity").className = "none";
}
function openShutManager(AA, BB, CC, DD, EE) {
    var sourceObj = typeof AA == "string" ? document.getElementById(AA) : AA;
    var targetObj = typeof BB == "string" ? document.getElementById(BB) : BB;
    var openTip = DD || "";
    var shutTip = EE || "";
    if (targetObj.style.display != "none") {
        if (CC) return;
        targetObj.style.display = "none";
        if (openTip && shutTip) {
            sourceObj.innerHTML = shutTip;
        }
    } else {
        targetObj.style.display = "block";
        if (openTip && shutTip) {
            sourceObj.innerHTML = openTip;
        }
    }
}

function subHeadSearch() {
    if (event.keyCode == 13) {

        document.all.HeadSearch.focus();
        document.all.HeadSearch.click();
    }
}

function pdmclose() {

    if (document.activeElement.id != "selbox") {

        (pulldownmenu).style.display = "none";
    }
}
window.document.onclick = pdmclose;
 