﻿// JScript 文件
// JScript 文件
function JSAddFavorite()
{
if(window.sidebar&&"object"==typeof(window.sidebar)&&"function"==typeof(window.sidebar.addPanel))
    {window.sidebar.addPanel(document.title,document.location.href,"")}
else{
    if(document.all&&"object"==typeof(window.external))
	    {window.external.addFavorite(document.location.href,document.title)}
    }
return false
}
$(function(){var b=$(".menu-hd");var a=$(".menu-bd");b.mouseover(function(c){obj=b.offset();b.css({width:"48px",background:"#ffffff",height:"21px",border:"1px solid #bfbfbf","border-bottom":"1px solid #ffffff"});a.show()}).mouseleave(function(c){if($(c.relatedTarget).attr("class")=="menu-bd"){a.hide()}});a.mouseleave(function(){b.css({width:"48px",background:"none",height:"21px",border:"none"});$(this).hide()})});

//搜索框相关开始
var TB=TB||{};
TB.Header=function(){var f=function(u){return typeof(u)!="string"?u:document.getElementById(u)},r=navigator.userAgent.toLowerCase(),n=/msie/.test(r)&&!/opera/.test(r),k=n&&!/msie 7/.test(r)&&!/msie 8/.test(r),l="http://list.taobao.com/browse/cat-0.htm";
var h={getCookie:function(v){var u=document.cookie.match("(?:^|;)\\s*"+v+"=([^;]*)");
return(u&&u[1])?decodeURIComponent(u[1]):""},parseQueryParams:function(A){var x={};
var v=A.split("&");
for(var y=0,z=v.length;y<z;++y){var w=v[y],B=w.search("=");
var C=w.substring(0,B);
var u=w.substring(B+1,w.length);x[decodeURIComponent(C)]=decodeURIComponent(u)}return x},trim:function(u){return u.replace(/^\s+|\s+$/g,"")},hasClass:function(v,u){v=f(v);
if(!v||!u||!v.className){return false}return(" "+v.className+" ").indexOf(" "+u+" ")>-1},addClass:function(v,u){v=f(v);
if(!v||!u){return}if(this.hasClass(v,u)){return}v.className+=" "+u},removeClass:function(v,u){v=f(v);
if(!this.hasClass(v,u)){return}v.className=v.className.replace(new RegExp(u,"g"),"");
if(!this.trim(v.className)){v.removeAttribute(n?"className":"class")}},addEvent:function(w,v,u){w=f(w);
if(!w||!v||typeof(u)!="function"){return}if(w.addEventListener){w.addEventListener(v,u,false)}else{if(w.attachEvent){w.attachEvent("on"+v,u)}}},stopEvent:function(u){if(u.stopPropagation){u.stopPropagation()}else{u.cancelBubble=true}if(u.preventDefault){u.preventDefault()}else{u.returnValue=false}},getElementsByClassName:function(v,A,u,z){if(!f(u)){return}var w=[],y=f(u).getElementsByTagName(A),x=0;
for(;x<y.length;x++){if(h.hasClass(y[x],v)){w[w.length]=y[x];arguments[3]&&arguments[3].call(y[x])}}return w},escapeHTML:function(v){var w=document.createElement("div");
var u=document.createTextNode(v);w.appendChild(u);
return w.innerHTML}};
var s=h.getCookie("_nk_"),i=h.getCookie("uc1"),d=h.parseQueryParams(i),p=h.getCookie("_l_g_")&&s,o=parseInt(d._msg_)||0,j=new Date().getTime();
var q=(document.location.href.indexOf("https://")===0);
function a(w){if(!w){return}var v=h.getElementsByClassName("menu-bd","div",w)[0];
if(!v){return}if(!q){var u=document.createElement("iframe");u.src="about: blank";u.className="menu-bd";w.insertBefore(u,v);w.iframe=u}w.menulist=v;w.onmouseenter=function(){h.addClass(this.parentNode,"hover");
if(q){return}this.iframe.style.height=parseInt(this.menulist.offsetHeight)+25+"px";
this.iframe.style.width=parseInt(this.menulist.offsetWidth)+1+"px"};w.onmouseleave=function(){h.removeClass(this.parentNode,"hover")}}function c(){var u=document.forms.topSearch;
if(!u){return}h.addEvent(u,"submit",function(){if(u.q.value==""){u.action=l}})}

function e(V,U)
{
    var y=f(V),
    J=y&&y.q,
    w=y&&y.type,
    D=y&&y.getElementsByTagName("label")[0],
    C=y&&y.cat,
    R=f("J_TSearchTabs").getElementsByTagName("li"),
    u=R.length,
    O={},
    H=false,
    E=false,
    x="tsearch-tabs-active",
    M=function(X)
    {
        for(var W=0;W<u;W++)
        {
            h[W===X?"addClass":"removeClass"](R[W],x)
        }
    },
    Q=f("J_TSearchCat"),
    T=null,
    v=f("J_TSearchCatHd"),
    z=Q&&Q.getElementsByTagName("div")[0],
    B=z&&z.getElementsByTagName("a")||[],
    G=B.length,
    P,
    F=function(W)
    {
        for(P=0;P<G;P++)
        {
            if(B[P].getAttribute("data-value")===W)
            {
                return B[P]
            }
        }
        return null
    },
    L=function()
    {
        h.removeClass(Q,"tsearch-cat-active")
    },
    S=function()
    {
        h.addClass(Q,"tsearch-cat-active")
    },
    K=function(W)
    {
        for(P=0;P<G;P++)
        {
            h[B[P]===W?"addClass":"removeClass"](B[P],"tsearch-cat-selected")
        }
        L();
        v.innerHTML=W.innerHTML;
        C.value=W.getAttribute("data-value")
    },
    I=function(){J.focus();
    if(n){J.value=J.value}
};

if(!y){return}if(f("J_TSearchTabs")){var N=0,A={"\u5B9D\u8D1D":["item","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5b9d\u8d1d"],"\u5546\u57CE":["NetMall","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5b9d\u8d1d"],"\u6DD8\u5B9D\u5E97\u94FA":["TaoBaoShop","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5546\u54c1"],"\u6253\u6298":["DaZhe","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5e97\u94fa\u540d\u6216\u638c\u67dc\u540d"],"\u56E2\u8D2D":["TuanGou","\u8f93\u5165\u60a8\u60f3\u8981\u7684\u5b9d\u8d1d"]};
//if(!y){return}if(f("J_TSearchTabs")){var N=0,A={"商城":["item","输入您想要的宝贝"],"淘宝商城":["mall","输入您想要的商品"],"店铺":["DaZhe","输入您想要的店铺名或掌柜名"],"团购":["TuanGou","输入您想要的宝贝"]};

for(;N<u;N++){(function(){var Y=N,W=h.trim(R[Y].getElementsByTagName("a")[0].innerHTML),X=A[W];O[X[0]]={index:Y,hint:X[1]};h.addEvent(R[Y],"click",function(Z){h.stopEvent(Z);M(Y);w.value=X[0];D.innerHTML=X[1];I()})})()}}h.addEvent(J,"focus",function(){D.innerHTML=""});h.addEvent(J,"blur",function(){if(h.trim(J.value)===""&&!H){D.innerHTML=O[w.value]["hint"]}});h.addEvent("J_TSearchTabs","mousedown",function(){H=true;E=true;setTimeout(function(){H=false})});h.addEvent("J_TSearchCat","click",function(W){h.stopEvent(W);var X=W.target||W.srcElement;switch(true){case h.hasClass(X.parentNode,"tsearch-cat-hd"):case h.hasClass(X,"tsearch-cat-hd"):S();break;case X.parentNode.nodeName.toLowerCase()==="div":K(X);I();break}});h.addEvent(document,"click",L);h.addEvent(y,"submit",function(){switch(y.type.value){case"item":y.action=J.value===""?l:"http://search.taobao.com/search";y.target="_blank";y.charset="gbk";
break;case"item":y.action="/TuanGou/Search.aspx";y.target="_blank";//宝贝
break;case"NetMall":y.action="/MallShop/Search.aspx";//商城
break;case"TaoBaoShop":y.action="/TaobaoShop/Search.aspx";//淘宝店铺
break;case"DaZhe":y.action="/DaZhe/Search.aspx";//打折
break;case"TuanGou":y.action="/TuanGou/Search.aspx";//团购
//break;case"auction":y.atype.value="a";y.filterFineness.value="1,3";
break}});
D.innerHTML="";
setTimeout(
    function()
    {
        if(!E)
        {
            w.value=(U&&U.searchType)?U.searchType:"item";
            if(document.domain.indexOf("shopsearch.taobao.com")>-1)
            {
                w.value="shop"
            }
            var W=O[w.value];
            D.innerHTML=W.hint;M(W.index)
        }
        if(Q&&(T=F(C.value)))
        {
            K(T)
        }
        if(h.trim(J.value)!=="")
        {
            D.innerHTML=""
        }
        if(U&&U.autoFocus)
        {
            I()
        }
        //y.atype.value="";
        //y.filterFineness.value=""
    }
)}function b(B){var y=f(B);
if(!y){return}var z=y.q;
if(!z){return}
if(!(window.TB&&TB.Suggest)){return}
var v=new TB.Suggest(z,"http://suggest.taobao.com/sug",{resultFormat:"\u7ea6%result%\u4e2a\u5b9d\u8d1d"});
//var A=y.ssid;
//if(A)
//{
//    setTimeout(
//        function()
//        {
//            A.value="s5-e"
//        },0
//    );
//    A.setAttribute("autocomplete","off");
//    v.subscribe("onItemSelect",function(){if(A.value.indexOf("-p1")==-1){A.value+="-p1"}})}var w=y.elements.type;
//    
var u=function(){return w.value};
var x=v._needUpdate;v._needUpdate=function(){var C=u();
return(C==="item"||C==="mall")&&x.call(v)}}function m(u){var v=f(u);
if(!v){return}h.addEvent(v,"click",function(x){h.stopEvent(x);
var w=v.href;
new Image().src="//taobao.alipay.com/user/logout.htm";setTimeout(function(){location.href=w},20)})}function g(){if(document.domain.indexOf(".taobao.net")===-1){return}var x=document.getElementById("header"),w=x?x.getElementsByTagName("a"):[],v=0,u=w.length,y=location.hostname.split(".");
while(y.length>3){y.shift()}y=y.join(".");
for(;v<u;v++){w[v].href=w[v].href.replace("taobao.com",y)}}function t(){if(document.location.href.indexOf("https://")===0){return}var u=document,x=u.getElementsByTagName("head")[0],v=u.createElement("script");v.src="http://a.tbcdn.cn/app/search/monitor.js?t=20100331.js";x.appendChild(v)}return{init:function(v){if(k){var u=h.getElementsByClassName("menu","div","site-nav",function(){a(this)})}g();c();t();m("J_Logout");
if(f("J_TSearch")){e("J_TSearchForm",v);
setTimeout(function w(){if(typeof w.count=="undefined"){w.count=0}w.count++;
if(!(window.TB&&TB.Suggest)){setTimeout(arguments.callee,200)}else{b("J_TSearchForm")}},200)}},writeLoginInfo:function(y){y=y||{};
var z=y.memberServer||"http://member1.taobao.com";
var w=y.loginServer||z;
var C=y.loginUrl||w+"/member/login.jhtml?f=top";
var v=location.href;
var E=/^http.*(\/member\/login\.jhtml)$/i;
if(E.test(v)){v=""}var u=y.redirectUrl||v;
if(u){C+="&redirectURL="+encodeURIComponent(u)}var B=y.logoutUrl||w+"/member/logout.jhtml?f=top";
var A=z+"/member/newbie.htm";
var D=z+"/message/list_private_msg.htm?t="+j;
var F="http://jianghu.taobao.com/admin/home.htm?t="+j;
var x="";
if(p){x='\u60a8\u597d\uff0c<a class="user-nick" href="'+F+'" target="_top">'+h.escapeHTML(unescape(s.replace(/\\u/g,"%u")))+"</a>\uff01";x+='<a id="J_Logout" href="'+B+'" target="_top">\u9000\u51fa</a>';x+='<a href="'+D+'" target="_top">\u7ad9\u5185\u4fe1';
if(o){x+="("+o+")"}x+="</a>"}else{x='\u60a8\u597d\uff0c\u6b22\u8fce\u6765\u6dd8\u5b9d\uff01<a href="'+C+'" target="_top">\u8bf7\u767b\u5f55</a>';x+='<a href="'+A+'" target="_top">\u514d\u8d39\u6ce8\u518c</a>'}document.write(x)}}}();
//搜索框相关结束

