//jquery.json-2.2.min{{{
(function($){
    $.toJSON=function(o)

    {
        if(typeof(JSON)=='object'&&JSON.stringify)
            return JSON.stringify(o);
        var type=typeof(o);
        if(o===null)
            return"null";
        if(type=="undefined")
            return undefined;
        if(type=="number"||type=="boolean")
            return o+"";
        if(type=="string")
            return $.quoteString(o);
        if(type=='object')

        {
            if(typeof o.toJSON=="function")
                return $.toJSON(o.toJSON());
            if(o.constructor===Date)

            {
                var month=o.getUTCMonth()+1;
                if(month<10)month='0'+month;
                var day=o.getUTCDate();
                if(day<10)day='0'+day;
                var year=o.getUTCFullYear();
                var hours=o.getUTCHours();
                if(hours<10)hours='0'+hours;
                var minutes=o.getUTCMinutes();
                if(minutes<10)minutes='0'+minutes;
                var seconds=o.getUTCSeconds();
                if(seconds<10)seconds='0'+seconds;
                var milli=o.getUTCMilliseconds();
                if(milli<100)milli='0'+milli;
                if(milli<10)milli='0'+milli;
                return'"'+year+'-'+month+'-'+day+'T'+
                hours+':'+minutes+':'+seconds+'.'+milli+'Z"';
            }
            if(o.constructor===Array)
            {
                var ret=[];
                for(var i=0;i<o.length;i++)
                    ret.push($.toJSON(o[i])||"null");
                return"["+ret.join(",")+"]";
            }
            var pairs=[];
            for(var k in o){
                var name;
                var type=typeof k;
                if(type=="number")
                    name='"'+k+'"';
                else if(type=="string")
                    name=$.quoteString(k);else
                    continue;
                if(typeof o[k]=="function")
                    continue;
                var val=$.toJSON(o[k]);
                pairs.push(name+":"+val);
            }
            return"{"+pairs.join(", ")+"}";
        }
    };

    $.evalJSON=function(src)

    {
        if(typeof(JSON)=='object'&&JSON.parse)
            return JSON.parse(src);
        return eval("("+src+")");
    };

    $.secureEvalJSON=function(src)

    {
        if(typeof(JSON)=='object'&&JSON.parse)
            return JSON.parse(src);
        var filtered=src;
        filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');
        filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');
        filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');
        if(/^[\],:{}\s]*$/.test(filtered))
            return eval("("+src+")");else
            throw new SyntaxError("Error parsing JSON, source is not valid.");
    };

    $.quoteString=function(string)

    {
        if(string.match(_escapeable))

        {
            return'"'+string.replace(_escapeable,function(a)

            {
                    var c=_meta[a];
                    if(typeof c==='string')return c;
                    c=a.charCodeAt();
                    return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);
                })+'"';
        }
        return'"'+string+'"';
    };

    var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;
    var _meta={
        '\b':'\\b',
        '\t':'\\t',
        '\n':'\\n',
        '\f':'\\f',
        '\r':'\\r',
        '"':'\\"',
        '\\':'\\\\'
    };

})(jQuery);
//jquery.json-2.2.min}}}


$.extend($,{
    strlen:function(a){
        if(typeof a!="string"){
            return 0
        }
        return a.replace(/[^\x00-\xff]/gi,"xx").length
    }
});
var IXG={};


IXG.DOMAIN={
    ACT_IXUNGOU_COM:'www.ixungou.com',
    ITEM_IXUNGOU_COM:'www.ixungou.com',
    BUY_IXUNGOU_COM:'www.ixungou.com',
    BASE_IXUNGOU_COM:'www.ixungou.com',
    S_IXUNGOU_COM:'www.ixungou.com',
    LIST_IXUNGOU_COM:'www.ixungou.com',
    ST_IXUNGOU_COM:'www.ixungou.com',
    ACT_IXUNGOU_COM:'www.ixungou.com'
};

IXG.prefix={
    st:'/'
};

IXG.createFnQueue=function(a){
    var b=[];
    return{
        add:function(c){
            if($.isFunction(c)){
                b.push(c)
            }
        },
        exec:function(e){
            if(a!==false){
                while(b.length>0){
                    b.shift()(e)
                }
            }else{
                var c=b.length;
                for(var d=0;d<c;d++){
                    if(b[d]()===false){
                        return false
                    }
                }
            }
        },
        clear:function(){
            b.length=0
        }
    }
};

IXG.app={};

IXG.logic={};

IXG.ui={};

IXG.util={};

if($.browser.msie&&parseInt($.browser.version,10)<7){
    try{
        document.execCommand("BackgroundImageCache",false,true)
    }catch(err){}
}
IXG.util.cookie={
    get:function(b){
        var c=new RegExp("(^|;|\\s+)"+b+"=([^;]*)(;|$)");
        var a=document.cookie.match(c);
        return(!a?"":unescape(a[2]))
    },
    add:function(c,b,g,a,f){
        var e=c+"="+escape(b)+"; path="+(g||"/")+(f?("; domain="+f):"");
        if(a>0){
            var h=new Date();
            h.setTime(h.getTime()+a*1000);
            e+=";expires="+h.toGMTString()
        }
        document.cookie=e
    },
    del:function(a,b){
        document.cookie=a+"=;path=/;"+(b?("domain="+b+";"):"")+"expires="+(new Date(0)).toGMTString()
    }
};

IXG.util.post=function(c,f,b){
    IXG.util.post.pIndex=(IXG.util.post.pIndex||0)+1;
    var d=$('<iframe name="pIframe_'+IXG.util.post.pIndex+'" src="about:blank" style="display:none" width="0" height="0" scrolling="no" allowtransparency="true" frameborder="0"></iframe>').appendTo($(document.body));
    var a=[];
    $.each(f,function(h,g){
        a.push('<input type="hidden" name="'+h+'" value="" />')
    });
    if(!/(\?|&(amp;)?)fmt=[^0 &]+/.test(c)){
        c+=(c.indexOf("?")>0?"&":"?")+"fmt=1"
    }
    var e=$('<form action="'+c+'" method="post" target="pIframe_'+IXG.util.post.pIndex+'">'+a.join("")+"</form>").appendTo($(document.body));
    $.each(f,function(h,g){
        e.children("[name="+h+"]").val(g)
    });
    d[0].callback=function(g){
        if(typeof b=="function"){
            b(g)
        }
        $(this).src="about:blank";
        $(this).remove();
        e.remove();
        d=e=null
    };
    if($.browser.msie&&$.browser.version==6){
        d[0].pIndex=IXG.util.post.pIndex;
        d[0].ie6callback=function(){
            e.target="pIframe_"+this.pIndex;
            e.submit()
        };

        d[0].src="/data/html/ie6post.html";
    }else{
        e.submit()
    }
};

IXG.util.parse={
    url:function(){
        var a=function(e){
            var e=(e+"").replace(/(&amp;|\?)/g,"&").split("&");
            var f={};

            var h=e.length;
            for(var d=0;d<h;d++){
                var g=e[d].indexOf("=");
                if(-1==g){
                    continue
                }
                f[e[d].substr(0,g).replace(/[^a-zA-Z0-9_]/g,"")]=unescape(e[d].substr(g+1))
            }
            return f
        };

        var b=location.href.toString().indexOf("#");
        if(b<0){
            b=""
        }else{
            b=location.href.toString().substring(b,location.href.toString().length)
        }
        return{
            search:a(location.search.substr(1)),
            hash:a(b)
        }
    },
    encodeHtml:function(a){
        return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;")
    },
    decodeHtml:function(a){
        return a.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#0?39;/g,"'").replace(/&quot;/g,'"').replace(/&amp;/g,"&")
    },
    timeFormat:function(c,a){
        var e=IXG.util.parse.getTimeInfo(c);
        var b={
            y:e.year,
            m:e.month,
            d:e.date,
            h:e.hour,
            i:e.minute,
            s:e.sec,
            w:e.week
        };

        $.each(b,function(f,d){
            if(f!="y"&&d<10){
                b[f]="0"+d
            }
        });
        return a.replace(/(?!\\)(y|m|d|h|i|s|w)/gi,function(f,d){
            return b[d.toLowerCase()]
        })
    },
    getTimeInfo:function(b){
        var a=["星期天","星期一","星期二","星期三","星期四","星期五","星期六"];
        var c=new Date(b*1000);
        return{
            year:c.getFullYear(),
            month:c.getMonth()+1,
            date:c.getDate(),
            hour:c.getHours(),
            minute:c.getMinutes(),
            sec:c.getSeconds(),
            week:a[c.getDay()]
        }
    }
};

IXG.util.localShare=(function(){
    var c=IXG.createFnQueue(),a=0,b=false;
    return function(d){
        c.add(d);
        if(a==2&&b){
            c.exec(b);
            return
        }
        if(a==1){
            return
        }
        a=1;
        $.ajax({
            url:"/javascript/new20111020/localShare.js",
            dataType:"script",
            crossDomain:true,
            cache:true,
            scriptCharset:"utf-8",
            success:function(){
                IXG.app.localShare(function(){
                    a=2;
                    b=this,c.exec(b)
                })
            }
        })
    }
})();
IXG.util.ping={
    VISIT_INFO_KEY:"vinfo",
    _visMap:["lastVisit"],
    getVisitInfo:function(){
        var b=IXG.util.ping,c=IXG.util.cookie.get(b.VISIT_INFO_KEY);
        c=c.split(",");
        var a={};

        $.each(b._visMap,function(e,d){
            a[d]=c[e]||""
        });
        return a
    },
    setVisitInfo:function(b,e){
        var a=IXG.util.ping,f=a.getVisitInfo(),d={};

        if(arguments.length<2){
            d=b
        }else{
            d[b]=e
        }
        f=$.extend(f,b);
        var c=[];
        $.each(a._visMap,function(h,g){
            c[h]=f[g]||""
        });
        IXG.util.cookie.add(a.VISIT_INFO_KEY,c.join(","),"/",24*3600*365,".ixungou.com")
    },
    init:function(b,d){
        IXG.util.ping.timeStat=(function(){
            var g="http://isdspeed.qq.com/cgi-bin/r.cgi";
            var f=2000;
            var e=1470;
            function h(k,m,l,j){
                var i=(function(n,p,o,q){
                    return function(){
                        var r=[];
                        r.push("flag1="+e);
                        r.push("flag2="+p);
                        r.push("flag3="+o);
                        $.each(n,function(w,t){
                            if(w!=0&&t){
                                r.push(w+"="+t)
                            }
                        });
                        q=q||{};

                        for(var u in q){
                            r.push(u+"="+q[u])
                        }
                        var s=new Image();
                        s.src=g+"?"+r.join("&")
                    }
                })(k,m,l,j);
                setTimeout(i,f)
            }
            return h
        })();
        var a=IXG.util.ping.getVisitInfo(),c=Math.round((new Date()).getTime()/1000);
        if((c-(a.lastVisit||0)>=(5*60))&&IXG.logic.login.getLoginUid()){
            (new Image()).src="http://isdspeed.qq.com/cgi-bin/v.cgi?flag1=320001&flag2=1&flag3=600&1=1&2=0";
            a.lastVisit=c;
            IXG.util.ping.setVisitInfo(a)
        }
        if(IXG.util.cookie.get("visitkey").length!=10){
            IXG.util.cookie.add("visitkey",Math.round((new Date()).getTime()/1000),"/",90*3600*24*365,".ixungou.com")
        }
        $(document).ready(function(){
            if(!b){
                var e=location.host.replace(/\.ixungou\.com/,"");
                b=location.pathname;
                if(location.pathname=="/index.php"||location.pathname=="/json.php"){
                    var g=IXG.util.parse.url();
                    if(g.search.mod){
                        b=location.pathname.substr(0,location.pathname.length-4)+"_"+g.search.mod+"_"+(g.search.act||"page")
                    }
                }
            }
            var f=IXG.util.cookie.get("wsid");
            b="/_site_"+f+"/"+e+b;
        /*$.ajax({
                url:"http://mat1.gtimg.com/mini2009/js/cdn/pingMini.js",
                dataType:"script",
                type:"get",
                cache:true,
                success:function(){
                    pgvMain("",{
                        virtualDomain:"ixungou_"+f+".qq.com",
                        virtualURL:b
                    });
                    window.pp_req_url=document.URL.replace(/^http:\/\/([^\/]+)(\/|$)/,"http://$1/_site_"+IXG.util.cookie.get("wsid")+"/");
                    $.ajax({
                        url:"http://static.paipaiimg.com/js/pp.foot.20100630.js?t=20110726153054",
                        dataType:"script",
                        type:"get",
                        cache:true,
                        success:function(){
                            if(typeof(pgvMain)=="function"){
                                setTimeout(function(){
                                    pgvMain("",{
                                        virtualDomain:d||"ixungou.qq.com",
                                        virtualURL:b,
                                        hot:true
                                    });
                                    $(document).click(function(k){
                                        var i="a,img,button,input,textarea,select",j=k&&k.target;
                                        if(j&&i.indexOf(j.nodeName.toString().toLowerCase())!==-1&&$.isFunction(pgvSendClick)){
                                            while(j&&j.nodeName.toString()!=="BODY"){
                                                var h=j.getAttribute("hotName")||j.getAttribute("hotname");
                                                if(h){
                                                    h=h.toString();
                                                    pgvSendClick({
                                                        virtualDomain:"ixungou.qq.com",
                                                        virtualURL:b,
                                                        hottag:h.replace(/^(I\.)?(.*)$/i,function(m,l,n){
                                                            return f+"."+n
                                                        })
                                                    });
                                                    pgvSendClick({
                                                        virtualDomain:"ixungou_"+f+".qq.com",
                                                        virtualURL:b,
                                                        hottag:h.replace(/^(I\.)?(.*)$/i,function(m,l,n){
                                                            return f+"."+n
                                                        })
                                                    })
                                                }
                                                j=j.parentNode
                                            }
                                        }
                                    })
                                },1)
                            }
                        }
                    })
                }
            })*/
        })
    }
};
(function(a,c,d){
    function b(e){
        var w=function(C,i){
            return(C&&C.hasOwnProperty&&(C instanceof i))
        };

        if(!(w(this,b))){
            return new b(e)
        }
        e=jQuery.extend({},{
            position:"rightBottom",
            distance:20,
            width:"120",
            html:"",
            target:null,
            buttons:null,
            group:null,
            className:"global_tip",
            time:null
        },e||{});
        var o=this,A=c(e.target),x=A.data("tipInstnace");
        if(x){
            x.close()
        }
        b.instance=b.instance||[];
        if(e.group){
            for(var s=0,u=b.instance.length;s<u;s++){
                if(b.instance[s].opt.group===e.group){
                    b.instance[s].close()
                }
            }
        }
        var r=(e.buttons&&!c.isArray(e.buttons))||(c.isArray(e.buttons)&&e.buttons.length>0);
        this.element=c('<div class="'+e.className+'"><div class="content">'+e.html+"</div>"+(r?'<div class="buttons"></div>':"")+'<span class="arrow">◆<span class="inner">◆</span></span></div>').css("width",e.width);
        this.opt=e;
        this.opt.id=new Date().getTime();
        if(r){
            var q=c.map(c.isArray(e.buttons)?e.buttons:[e.buttons],function(C,i){
                return'<a href="#" onclick="return false" class="'+(i==0?"btn_strong":"btn_common")+'">'+C+"</a>"
            }).join("");
            var t=this.element.find(".buttons");
            t.append(q);
            t.find("a").each(function(i){
                c(this).click(function(){
                    if(o.element.triggerHandler("click_"+(i+1))!==false){
                        o.close()
                    }
                })
            }).first().focus()
        }
        this.element.appendTo(document.body);
        if(!r&&e.time){
            this.timer=setTimeout(function(){
                o.close()
            },parseInt(e.time,10))
        }
        var n={},y={},k=parseInt(e.distance,10);
        var h=c.browser.mozilla?12:(c.browser.webkit?12:13);
        var l=c.browser.mozilla?10:(c.browser.webkit?10:10);
        switch(e.position){
            case"leftTop":
                n={
                    bottom:-1*h,
                    right:k
                };

                y={
                    top:-1
                };

                break;
            case"rightTop":
                n={
                    left:k,
                    bottom:-1*h
                };

                y={
                    top:-1
                };

                break;
            case"leftBottom":
                n={
                    top:-1*l,
                    right:k
                };

                y={
                    top:1
                };

                break;
            default:
                n={
                    top:-1*l,
                    left:k
                };

                y={
                    top:1
                };

                break
        }
        var g=c(".arrow",this.element);
        g.css(n);
        c(".inner",this.element).css(y);
        var p=g.offset(),z=A.offset(),j,f;
        switch(e.position){
            case"leftTop":case"rightTop":
                j={
                    x:parseInt(p.left,10)+parseInt(g.width(),10)/2,
                    y:parseInt(p.top,10)+parseInt(g.height(),10)
                };

                f={
                    x:parseInt(z.left,10)+parseInt(A.width(),10)/2,
                    y:parseInt(z.top,10)
                };

                break;
            default:
                j={
                    x:parseInt(p.left,10)+parseInt(g.width(),10)/2,
                    y:parseInt(p.top,10)
                };

                f={
                    x:parseInt(z.left,10)+parseInt(A.width(),10)/2,
                    y:parseInt(z.top,10)+parseInt(A.height(),10)
                };

                break
        }
        var m=this.element.position();
        this.element.css({
            left:parseInt(m.left)-j.x+f.x,
            top:parseInt(m.top)-j.y+f.y
        });
        var o=this;
        o._close=function(){
            o&&o.close()
        };

        c(window).bind("resize",o._close);
        b.instance.push(this);
        A.data("tipInstnace",this);
        for(var B in e){
            if(/^click_\d$/.test(B.toString())){
                this.bind(B,e[B])
            }
        }
    }
    c.extend(b.prototype,{
        bind:function(){
            this.element.bind.apply(this.element,c.makeArray(arguments))
        },
        close:function(){
            clearTimeout(this.timer);
            c(window).unbind("resize",self._close);
            this.element.data("tipInstnace",null);
            for(var f=0,e=b.instance.length;f<e;f++){
                if(b.instance[f].opt.id==this.opt.id){
                    b.instance.splice(f,1);
                    break
                }
            }
            this.element.remove()
        },
        getButtons:function(){
            return this.element.find(".buttons>a")
        },
        getElement:function(){
            return this.element
        },
        isShow:function(){
            return this.element[0].style.display!=="none"
        },
        show:function(){
            this.element[0].style.display="block"
        },
        hide:function(){
            this.element[0].style.display="none"
        }
    });
    a.ui.arrowTip=b
})(IXG,jQuery);
(function(a,c,e){
    function d(f){
        this.opt=c.extend({},{
            tpl:"",
            itemActiveClass:"",
            data:null,
            index:-1,
            url:""
        },f||{});
        this.init()
    }
    d.prototype={
        constructor:d,
        trigger:function(){
            this.element&&this.element.triggerHandler.apply(this.element,Array.prototype.slice.call(arguments,0,arguments.length))
        },
        bind:function(){
            this.element&&this.element.bind.apply(this.element,Array.prototype.slice.call(arguments,0,arguments.length))
        },
        init:function(){
            var g=this,f=this.opt.tpl.toString().replace(/{([^}]+)}/g,function(i,h){
                return e===g.opt.data[h]?"":g.opt.data[h]
            });
            this.element=c(f);
            this.element.hover(function(){
                g.active()
            },function(){
                g.unActive()
            }).click(function(){
                g.trigger("item_click",g.opt.data);
                return false
            })
        },
        active:function(){
            this.element&&this.element.addClass(this.opt.itemActiveClass);
            this.mouseIn=true;
            this.trigger("active",this.opt.index)
        },
        unActive:function(){
            this.mouseIn=false;
            this.element&&this.element.removeClass(this.opt.itemActiveClass);
            this.trigger("unactive")
        },
        remove:function(){
            this.element.remove()
        },
        isActive:function(){
            return !!this.mouseIn
        },
        getData:function(){
            return this.opt.data
        }
    };

    function b(f){
        if(!(this.hasOwnProperty&&this instanceof b)){
            return new b(f)
        }
        this.opt=c.extend({},{
            target:null,
            listOnClass:"",
            delayTime:200,
            elementClass:"autocomplete",
            cache:true,
            itemTPL:"<li>{label}</li>",
            itemActiveClass:"on",
            params:"",
            keyName:"kw",
            cache:true
        },f||{});
        var g=c(this.opt.target);
        if(g.length===0){
            return null
        }
        this.target=g.eq(0);
        this.items=[];
        this.init()
    }
    b.prototype={
        constructor:b,
        keyCode:{
            ALT:18,
            BACKSPACE:8,
            CAPS_LOCK:20,
            COMMA:188,
            COMMAND:91,
            COMMAND_LEFT:91,
            COMMAND_RIGHT:93,
            CONTROL:17,
            DELETE:46,
            DOWN:40,
            END:35,
            ENTER:13,
            ESCAPE:27,
            HOME:36,
            INSERT:45,
            LEFT:37,
            MENU:93,
            NUMPAD_ADD:107,
            NUMPAD_DECIMAL:110,
            NUMPAD_DIVIDE:111,
            NUMPAD_ENTER:108,
            NUMPAD_MULTIPLY:106,
            NUMPAD_SUBTRACT:109,
            PAGE_DOWN:34,
            PAGE_UP:33,
            PERIOD:190,
            RIGHT:39,
            SHIFT:16,
            SPACE:32,
            TAB:9,
            UP:38,
            WINDOWS:91
        },
        resize:function(){
            var g=this.target,f=g.offset();
            this.element.css({
                left:(f.left||0),
                top:(parseFloat(f.top,10)||0)+(parseFloat(g.outerHeight(),10)||0)-(parseFloat(g.css("border-bottom-width"),10)||0)
            })
        },
        init:function(){
            var f=this,i=this.target,h=this.opt,g=c('<ul class="'+h.elementClass+'"></ul>');
            this.element=g;
            c(a).bind("resize",function(){
                f.resize()
            });
            this.resize();
            this.items=[];
            this.target.click(function(){
                if(f.items.length>0){
                    f.show()
                }
            });
            this.target.bind("keydown.autocomplete",function(j){
                f.bindKeyDown(j)
            });
            this.target.bind("keyup.autocomplete",function(k){
                var j=k.keyCode,l=f.keyCode;
                if(j===l.UP||j===l.DOWN||j===l.ENTER||j===l.NUMPAD_ENTER||j===l.LEFT||j===l.RIGHT){
                    return
                }
                f.queryDelaySend()
            });
            this.target.bind("enter.autocomplete",function(){
                f.hide()
            });
            this.target.bind("click.autocomplete",function(){
                f.hide()
            });
            this.target.bind("blur",function(){
                setTimeout(function(){
                    f.hide()
                },200)
            })
        },
        destory:function(){},
        ajax:function(g){
            var f=this;
            f.hide();
            this.term=g;
            this.cache=this.cache||{};

            if(this.opt.cache&&e!==f.cache[g]){
                f.requestSuccess(f.cache[g])
            }else{
                var h={};

                if(f.opt.keyName){
                    h[f.opt.keyName]=g
                }
                f.xhr&&f.xhr.abort();
                f.xhr=c.ajax({
                    type:'post',
                    url:f.opt.url,
                    data:c.extend(h,f.opt.params||{}),
                    async:true,
                    dataType:"json",
                    cache:false,
                    //                    crossDomain:true,
                    scriptCharset:"utf-8",
                    success:function(i){
                        if(f.opt.cache){
                            f.cache[g]=i
                        }
                        f.requestSuccess(i)
                    }
                })
            }
        },
        requestSuccess:function(l){
            var h=this,g={
                response:l
            };

            this.trigger("success",g);
            this.hide();
            if(c.isArray(g.response)){
                for(var k=0,f=g.response.length;k<f;k++){
                    var j=new d({
                        data:g.response[k],
                        tpl:h.opt.itemTPL,
                        itemActiveClass:h.opt.itemActiveClass,
                        itemTPL:h.opt.itemTPL,
                        index:k
                    });
                    this.bindItem(j);
                    this.element.append(j.element);
                    this.items.push(j)
                }
                if(g.response.length>0){
                    this.show()
                }
            }
        },
        bindItem:function(g){
            var f=this;
            g.bind("item_click",function(h,i){
                f.target[0].value=i.value;
                f.hide();
                f.trigger("complete",{
                    from:"click",
                    index:g.index
                })
            });
            g.bind("active",function(l,j){
                for(var k=0,h=f.items.length;k<h;k++){
                    if(k!==j){
                        f.items[k].unActive()
                    }
                }
            })
        },
        bindKeyDown:function(g){
            var f=this,h=f.keyCode;
            switch(g.keyCode){
                case h.UP:
                    if(f.isActive()){
                        f.prev();
                        g.preventDefault()
                    }
                    break;
                case h.DOWN:
                    if(f.isActive()){
                        f.next();
                        g.preventDefault()
                    }
                    break;
                case h.ENTER:case h.NUMPAD_ENTER:
                    f.trigger("enter");
                case h.ESCAPE:
                    f.hide(g);
                    break;
                default:
                    break
            }
        },
        queryDelaySend:function(){
            var f=this;
            clearTimeout(f.delayTimer);
            f.delayTimer=setTimeout(function(){
                var g=f.target[0].value;
                if(f.term!==g){
                    if(c.trim(g)!==""){
                        f.ajax(g)
                    }else{
                        f.term="";
                        f.xhr&&f.xhr.abort();
                        f.hide()
                    }
                }
            },f.opt.delayTime)
        },
        show:function(){
            this.resize();
            this.activeStatus=true;
            this.element&&this.element.addClass(this.opt.listOnClass);
            this.element.appendTo("body");
            this.trigger("show")
        },
        hide:function(){
            this.activeStatus=false;
            this.element&&this.element.removeClass(this.opt.listOnClass);
            this.element.detach();
            for(var g=0,f=this.items.length;g<f;g++){
                this.items[g].remove()
            }
            this.items=[];
            this.trigger("hide")
        },
        getActiveIndex:function(){
            var h=-1;
            for(var g=0,f=this.items.length;g<f;g++){
                if(true===this.items[g].isActive()){
                    h=g;
                    break
                }
            }
            return h
        },
        prev:function(){
            var g=this.getActiveIndex();
            if(-1!==g){
                this.items[g].unActive();
                this.target.val(this.term)
            }
            g=(g===-1?this.items.length:g)-1;
            if(g>-1){
                var f=this.items[g];
                f.active();
                this.target.val(f.getData().value)
            }
        },
        next:function(){
            var g=this.getActiveIndex();
            if(-1!==g){
                this.items[g].unActive();
                this.target.val(this.term)
            }
            if(g+1<this.items.length){
                var f=this.items[g+1];
                f.active();
                this.target.val(f.getData().value)
            }
        },
        isActive:function(){
            return !!this.activeStatus
        },
        trigger:function(){
            this.element&&this.element.triggerHandler.apply(this.element,Array.prototype.slice.call(arguments,0,arguments.length))
        },
        bind:function(){
            this.element&&this.element.bind.apply(this.element,Array.prototype.slice.call(arguments,0,arguments.length))
        }
    };

    IXG.ui.autoComplete=b
})(window,jQuery);
(function(IXG,$,window,undefined){
    var $$=function(path,s){
        this.instance="jswf_"+(new Date).getTime();
        var options=this.options=$.extend({},$$.options,s);
        var id=this.id=options.id||this.instance;
        var container=$(options.container||"<div></div>");
        $$.CallBacks[this.instance]={};

        var params=options.params,vars=options.vars,callBacks=options.callBacks;
        var properties=$.extend({},{
            height:options.height,
            width:options.width
        },options.properties);
        var self=this;
        for(var callBack in callBacks){
            $$.CallBacks[this.instance][callBack]=(function(option){
                return function(){
                    return option.apply(self.object,arguments)
                }
            })(callBacks[callBack]);
            vars[callBack]="IXG.ui.swf.CallBacks."+this.instance+"."+callBack
        }
        params.flashVars=$.param(vars);
        if($.browser.msie){
            properties.classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
            properties.codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0";
            params.movie=path
        }else{
            properties.type="application/x-shockwave-flash";
            properties.data=path
        }
        var build=['<object id="',id,'"'];
        for(var property in properties){
            build.push(" ",property,'="',properties[property],'"')
        }
        build.push(">");
        for(var param in params){
            if(params[param]!==undefined){
                build.push('<param name="',param,'" value="',params[param],'" />')
            }
        }
        build.push("</object>");
        $.each(container,function(i,v){
            v.innerHTML=build.join("")
        });
        this.getObject()
    };

    $.extend($$,{
        options:{
            id:null,
            height:1,
            width:1,
            container:null,
            properties:{
                align:"middle"
            },
            params:{
                quality:"high",
                allowScriptAccess:"always",
                wMode:"transparent",
                swLiveConnect:true,
                menu:false
            },
            callBacks:{},
            vars:{}
        },
        CallBacks:{},
        remote:function(obj,fn){
            var rs=obj.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+"</invoke>");
            return eval(rs)
        }
    });
    $.extend($$.prototype,{
        toElement:function(){
            return this.object
        },
        getObject:function(){
            var self=this;
            this.object=document[this.id]||window[this.id];
            if(!this.object){
                setTimeout(function(){
                    self.getObject()
                },1)
            }
        },
        remote:function(){
            var par=[this.toElement()];
            for(var i=0,len=arguments.length;i<len;i++){
                par.push(arguments[i])
            }
            return $$.remote.apply($$,par)
        }
    });
    $$.getVersion=function(){
        var n=navigator;
        if(n.plugins&&n.mimeTypes.length){
            var plugin=n.plugins["Shockwave Flash"];
            if(plugin&&plugin.description){
                return plugin.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s)+r/,".")+".0"
            }
        }else{
            if(window.ActiveXObject&&!window.opera){
                for(var i=10;i>=2;i--){
                    try{
                        var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
                        if(c){
                            var version=c.GetVariable("$version");
                            return version.replace(/WIN/g,"").replace(/,/g,".")
                        }
                    }catch(e){}
                }
            }
        }
    };

    IXG.ui.swf=$$
})(IXG,jQuery,window);
IXG.ui.drag=(function(){
    var k=null;
    var i=null;
    var g=0;
    var f=0;
    var l=false;
    var j=false;
    var c={};

    function e(p){
        p.stopPropagation();
        p.preventDefault();
        if(!k||!i){
            return
        }
        var n=$(window).scrollLeft();
        var o=$(window).scrollTop();
        var m=g+p.clientX+n;
        var q=f+p.clientY+o;
        m=Math.min(Math.max(m,n),$(window).width()-$(k).outerWidth()+n);
        q=Math.min(Math.max(q,o),$(window).height()-$(k).outerHeight()+o);
        if(m<0){
            m=0
        }
        if(q<0){
            q=0
        }
        if($(k).css("position")=="fixed"){
            $(k).offset({
                left:m,
                top:q
            })
        }else{
            $(k).offset({
                left:m,
                top:q
            })
        }
        l=m;
        j=q
    }
    function b(o){
        o.stopPropagation();
        o.preventDefault();
        if(!k||!i){
            return
        }
        var m=$(window).scrollLeft();
        var n=$(window).scrollTop();
        g=k.offsetLeft-o.clientX-m;
        f=k.offsetTop-o.clientY-n;
        if($(k).css("position")=="fixed"){
            g+=m;
            f+=n
        }
        l=false;
        j=false;
        var p=i&&i.setCapture?i:document;
        $(p).bind("mousemove.moving",e).bind("mouseup.stop",d);
        a(p)
    }
    function d(o){
        if(!i){
            return
        }
        var p=i&&i.setCapture?i:document;
        $(p).unbind("mousemove.moving");
        $(p).unbind("mouseup.stop");
        if(typeof c.onstop=="function"){
            c.onstop.apply(i)
        }
        if(c.fixed&&l!==false&&j!==false){
            var m=$(window).scrollLeft();
            var n=$(window).scrollTop();
            $(k).fixedPosition({
                fixedTo:"top",
                fixedTop:j<n?0:(j-n),
                fixedLeft:l<m?0:(l-m)
            })
        }
        k=null;
        i=null;
        g=0;
        f=0;
        h(p)
    }
    function a(m){
        if(m.setCapture){
            m.setCapture()
        }else{
            if(window.captureEvents||document.captureEvents){
                (window.captureEvents||document.captureEvents)(Event.MouseMove|Event.MouseUp)
            }
        }
    }
    function h(m){
        if(m.releaseCapture){
            m.releaseCapture()
        }else{
            if(window.releaseEvents||document.releaseEvents){
                (window.releaseEvents||document.releaseEvents)(Event.MouseMove|Event.MouseUp)
            }
        }
    }
    return{
        enable:function(o,n,m){
            if(typeof n=="string"){
                n=$("#"+n).get(0)
            }
            if(typeof o=="string"){
                if(!n){
                    n=$("#"+o+"_head").get(0)
                }
                o=$("#"+o).get(0)
            }
            if(!o||!n){
                return
            }
            c=m||{};

            $(n).mousedown(function(p){
                k=o;
                i=n;
                b(p)
            })
        }
    }
})();
IXG.ui.droplist={
    attach:function(){}
};

IXG.ui.modal=(function(){
    var a=null;
    return{
        create:function(c,b){
            var d=null;
            if(!c){
                d=a&&a.length>0?a:$('<iframe src="javascript:void(0)"></iframe>').css({
                    opacity:0,
                    background:"#000",
                    left:"0",
                    display:"none",
                    zIndex:1100,
                    top:"0",
                    position:"absolute"
                });
                d.css({
                    width:$(window).width()+"px",
                    height:$(window).height()+"px"
                });
                d.appendTo($("body")).show();
                if(b){
                    d.fixedPosition({
                        fixedTo:"top",
                        fixedTop:0,
                        fixedLeft:0
                    })
                }else{
                    d.css({
                        left:$(window).scrollLeft(),
                        top:$(window).scrollTop()
                    })
                }
            }else{
                d=$('<iframe style="z-index:-1;width:'+$(c).innerWidth()+"px;height:"+$(c).innerHeight()+'px" src="javascript:void(0)" frameborder="0" scrolling="no" width="100%" height="100%"></iframe>').css({
                    opacity:0,
                    background:"#FFF",
                    left:"0",
                    top:"0",
                    position:"absolute"
                });
                d.appendTo(c)
            }
            return d
        }
    }
})();
IXG.ui.popup={
    _cssLoaded:false,
    _loadCss:function(){
        if(this._cssLoaded){
            return
        }
        this._cssLoaded=true;
        var a=IXG.prefix.st+"css/package_v1.css";
        var b=false;
        $("link").each(function(){
            if($(this).attr("href")==a){
                b=true;
                return false
            }
        });
        if(!b){
            $('<link href="'+a+'" rel="stylesheet" type="text/css" charset="utf-8" />').appendTo($("head"))
        }
    },
    _zIndex:1101,
    create:function(b){
        this._loadCss();
        var i=null,g=null,e=b||{},f=e.height>50;
        e.width=e.width||500;
        e.fixed=e.fixed===false?false:true;
        var c=$('<div style="z-index:'+(++this._zIndex)+";"+(f?("height:"+e.height+"px"):"")+";width:"+e.width+'px;" class="layer_global"><div class="layer_global_main"><div class="layer_global_title"><h3><span class="jian">&gt;</span>'+(e.title||"温馨提示")+'<span></span></h3><button title="关闭"><span class="none">?</span></button></div><div class="layer_global_cont layer_cont_15"></div></div></div/');
        c.appendTo($("body"));
        if(e.fixed){
            c.fixedPosition({
                fixedTo:"top"
            })
        }
        i=c.find(".layer_global_main .layer_global_title")[0];
        g=c.find(".layer_global_main .layer_global_cont")[0];
        if(b.contWidth=="30"){
            $(g).removeClass("layer_cont_15").addClass("layer_cont_30")
        }
        function h(j){
            c.mIframe=IXG.ui.modal.create(j,c.ifFixedPosition())
        }
        function d(k,m){
            if(null==k){
                k=c.width()
            }
            if(null==m){
                m=c.height()
            }
            var n=$(window).width(),j=$(window).height();
            var p=(e.fullscreen&&n<k?0:(n/2-k/2)),l=(e.fullscreen&&j<m?0:(j/2-m/2));
            if(c.ifFixedPosition()){
                c.fixedPosition({
                    fixedTo:"top",
                    fixedLeft:p,
                    fixedTop:l
                })
            }else{
                c.css("left",$(window).scrollLeft()+p+"px");
                c.css("top",$(window).scrollTop()+l+"px")
            }
            if(e.fullscreen&&!c.mDiv){
                var o=$("<div></div>").css({
                    opacity:0.05,
                    background:"#000",
                    display:"none",
                    zIndex:1101,
                    width:$(window).width()+"px",
                    height:$(window).height()+"px"
                }).appendTo("body");
                if(c.ifFixedPosition()){
                    o.fixedPosition({
                        fixedTo:"top",
                        fixedLeft:0,
                        fixedTop:0
                    })
                }else{
                    o.css({
                        left:$(window).scrollLeft(),
                        top:$(window).scrollTop(),
                        position:"absolute"
                    })
                }
                o.show();
                if(!c.ifFixedPosition()){
                    if($.browser.msie){
                        $("html").css({
                            overflow:"hidden"
                        })
                    }else{
                        $("body").css({
                            overflow:"hidden"
                        })
                    }
                }
                c.mDiv=o
            }
            if($.browser.msie&&$.browser.version>=6&&!c.mIframe){
                h(e.fullscreen?null:c)
            }
        }
        function a(j){
            if(e.fullscreen&&c.mDiv){
                c.mDiv.remove();
                c.mDiv=null;
                if(c.mIframe){
                    c.mIframe.remove();
                    c.mIframe=null
                }
                if(!c.ifFixedPosition()){
                    if($.browser.msie){
                        $("html").css({
                            overflow:"scroll",
                            "overflow-x":"hidden"
                        })
                    }else{
                        $("body").css({
                            overflow:"scroll",
                            "overflow-x":"hidden"
                        })
                    }
                }
            }
            if(j!==false&&$.isFunction(e.closeFn)){
                e.closeFn.apply(null)
            }
            c.hide()
        }
        $(i).children("button").click(a);
        IXG.ui.drag.enable(c.get(0),i,{
            fixed:c.ifFixedPosition()
        });
        if(f){
            d(e.width,f?e.height:300)
        }else{
            a()
        }
        return{
            onclose:function(j){
                e.closeFn=j
            },
            close:a,
            hide:a,
            show:function(){
                c.show();
                d()
            },
            paint:function(j){
                if(!$.isFunction(j)){
                    return
                }
                var k={
                    header:i,
                    content:g
                };

                return j.apply(c,[k])
            },
            setAtCenter:d,
            resize:function(j){
                if(!$.isPlainObject(j)){
                    return
                }
                if(j.width){
                    c.css("width",j.width+"px")
                }
                if(j.height>50){
                    c.css("height",j.height+"px");
                    $(g).height(j.height-50)
                }
                d()
            }
        }
    },
    _msgPopup:null,
    showMsg:function(d){
        var a=arguments,b=a[1]||{};
        if($.type(b)!="object"){
            b={};
            $.each({
                1:"type",
                2:"okFn",
                3:"closeFn",
                4:"cancelFn",
                5:"okText",
                6:"cancelText"
            },function(f,e){
                if(a[f]!=null){
                    b[e]=a[f]
                }
            });
            if(b.okText&&b.cancelText){
                b.btns=3
            }
        }
        if(!this._msgPopup){
            this._msgPopup=IXG.ui.popup.create({
                title:"提示",
                width:500,
                height:170,
                fullscreen:1
            })
        }
        var c={
            1:"warn",
            2:"error",
            3:"right"
        };

        if(!(b.type in c)){
            b.type=1
        }
        if(!$.isArray(d)){
            d=[d]
        }
        b.btns=b.btns||1;
        this._msgPopup.paint((function(e){
            return function(f){
                $(f.content).empty().html(' <div class="layer_global_mod">	<b class="icon icon_msg4 icon_msg4_'+c[b.type]+'"></b>'+(d.length>=1?('<h4 class="layer_global_tit">'+d[0]+"</h4>"):"")+"	"+(d.length>=2?("<p>"+d[1]+"</p>"):"")+(d.slice(2,d.length).join(""))+'	<div class="wrap_btn"><a class="btn_strong" href="#" onclick="return false">'+(b.okText||"确定")+'</a> <a class="btn_common" href="#" onclick="return false">'+(b.cancelText||"取消")+"</a></div>	</div>");
                $(".wrap_btn .btn_strong",f.content).click(function(){
                    var g=true;
                    if($.isFunction(b.okFn)){
                        g=b.okFn()!==false
                    }
                    if(g){
                        e.hide(false)
                    }
                })[(b.btns&1)?"show":"hide"]();
                $(".wrap_btn .btn_common",f.content).click(function(){
                    var g=true;
                    if($.isFunction(b.cancelFn)){
                        g=b.cancelFn()!==false
                    }
                    if(g){
                        e.hide(false)
                    }
                })[(b.btns&2)?"show":"hide"]();
                e.show()
            }
        })(this._msgPopup));
        this._msgPopup.onclose($.isFunction(b.closeFn)?b.closeFn:$.noop);
        return this._msgPopup
    }
};
(function(g){
    var e={},c=0,b=null,a=function(){
        if(b===null){
            var i=g('<span id="supportsPositionFixed" style="position:fixed;width:1px;height:1px;top:25px;"></span>').appendTo(g("body"));
            var h=i.offset();
            i.remove();
            b=(h.top-g(window).scrollTop())===25
        }
        return Boolean(b)
    },f=false,d=function(){
        if(f!==false){
            return
        }
        var h=g("body");
        if((h.css("background-image"))=="none"){
            h.css({
                "background-image":"url(/images/new20111020/blank.gif)",
                "background-attachment":"fixed"
            })
        }else{
            h.css("background-attachment","fixed")
        }
        f=true
    };

    g.fn.ifFixedPosition=function(){
        if(!this.attr("id")||this.attr("id").length==0){
            return false
        }
        return !!e[this.attr("id")]
    },g.fn.fixedPosition=function(h){
        var i={
            fixedTo:"bottom",
            fixedTop:0,
            fixedBottom:0,
            fixedLeft:false,
            effect:false,
            effectSpeed:1000
        };

        var h=g.extend(i,h);
        return this.each(function(){
            var j=g(this);
            if(!j.attr("id")||j.attr("id").length==0){
                j.attr("id","positionFixedID"+(c++))
            }
            if(!a()){
                d();
                var k="";
                if(h.fixedTo=="top"){
                    k="$(document).scrollTop()";
                    if(h.fixedTop>0){
                        k+="+"+h.fixedTop
                    }
                }else{
                    k='$(document).scrollTop() - $("#'+j.attr("id")+'").outerHeight() + (document.documentElement.clientHeight || document.body.clientHeight)';
                    if(h.fixedBottom>0){
                        k+="-"+h.fixedBottom
                    }
                }
                j.css("position","absolute");
                if(j.length>0&&j[0].style&&j[0].style.setExpression){
                    j[0].style.setExpression("top","eval("+k+")")
                }else{
                    j.css("top",(h.fixedTop||0)+"px")
                }
                if(h.fixedLeft!==false){
                    j.css("left",g(document).scrollLeft()+(h.fixedLeft-0)+"px")
                }
            }else{
                j.css("position","fixed");
                if(h.fixedTo=="top"){
                    j.css("top",(h.fixedTop||0)+"px")
                }else{
                    j.css("bottom",(h.fixedBottom||0)+"px")
                }
                if(h.fixedLeft!==false){
                    j.css("left",h.fixedLeft+"px")
                }
            }
            e[g(this).attr("id")]=1;
            if(h.effect){
                switch(h.effect){
                    case"fadeIn":
                        j.hide().fadeIn(h.effectSpeed);
                        break;
                    case"slideDown":
                        j.hide().slideDown(h.effectSpeed);
                        break
                }
            }
        })
    }
})(jQuery);
IXG.ui.template={
    fillWithTPL:function(f,g,e,a,b){
        if(!g){
            return
        }
        if(!e&&e!==false){
            e=f+"_tpl"
        }
        a=e===false?(a||""):$("#"+e).html().replace(/^\s*<!--/,"").replace(/-->\s*$/,"");
        var d={};

        a=a.replace(/<@([0-9a-zA-Z_-]+)@>((.|\s)*?)<@_\1@>/g,function(j,i,h){
            d[i]=h;
            return"[#"+i+"#]"
        });
        $.each(d,function(i,h){
            var j=[];
            var k=g[i];
            if(k){
                $.each(k,function(l,m){
                    j.push(IXG.ui.template.fillWithTPL(false,m,false,h.replace(/<_index_>/g,l-0+1)))
                })
            }
            d[i]=j.join("")
        });
        var c=a.replace(/\{([0-9a-zA-Z_-]+)\}/g,function(i,h){
            return g[h]!==undefined?g[h]:""
        }).replace(/\[#([0-9a-zA-Z_-]+)#\]/g,function(i,h){
            return d[h]!==undefined?d[h]:h
        }).replace(/^\s+/,"");
        if(b||f===false){
            return c;
        }else{
                
            $("#"+f).html(c);
        }
    }
};

IXG.ui.tips={
    err:function(c,b,a){
        this._set(c,2,b,a)
    },
    info:function(c,b,a){
        this._set(c,0,b,a)
    },
    warn:function(c,b,a){
        this._set(c,1,b,a)
    },
    suc:function(c,b,a){
        this._set(c,3,b,a)
    },
    help:function(c,b,a){
        this._set(c,4,b,a)
    },
    none:function(b,a){
        this._set(false,0,b,a)
    },
    _set:function(g,b,e,d){
        d=$.extend({
            autoHide:true,
            style:""
        },d||{});
        if(d.style!="inner"&&d.style!="bigtop"){
            d.style=""
        }
        var a="tips"+d.style,c="tipstimeout"+d.style;
        if($(e).data(c)){
            clearTimeout($(e).data(c));
            $(e).removeData(c)
        }
        var f=$(e).data(a),i=d.style=="bigtop"?"big":"";
        if(!f||f.parent().length==0){
            f=$(IXG.logic.constants.getTipStr(g,b,false,i));
            $(e).data(a,f);
            if(d.style=="inner"){
                e.empty().append(f)
            }else{
                if(d.style=="bigtop"){
                    f.insertBefore(e)
                }else{
                    f.insertAfter(e)
                }
            }
        }
        f.hide();
        if(g===false){
            return
        }
        if(b==null||!(b in IXG.logic.constants.tipsLevel)){
            b=0
        }
        var h="";
        if(d.style=="bigtop"){
            h="para_blo para_"+IXG.logic.constants.tipsLevel[b]
        }else{
            h="para_inb para_"+IXG.logic.constants.tipsLevel[b]
        }
        f.empty().html(IXG.logic.constants.getTipStr(g,b,true,i)).removeClass().addClass(h).fadeIn(200);
        if(d.autoHide){
            $(e).data(c,setTimeout(function(){
                f&&f.fadeOut(200)
            },$.type(d.autoHide)=="boolean"?5000:d.autoHide))
        }
    },
    setLoading:function(a){},
    unsetLoading:function(a){},
    swapInput:function(a){
        if(!a||!a.target){
            return null
        }
        a.defaultValue=a.defaultValue||"";
        a.focusClass=a.focusClass||"";
        a.blurClass=a.blurClass||"";
        $(a.target).focus({
            opt:a
        },function(c){
            var b=$(this).val();
            (b==c.data.opt.defaultValue||b=="")&&$(this).val("");
            $(this).removeClass(c.data.opt.blurClass).addClass(c.data.opt.focusClass)
        }).blur({
            opt:a
        },function(c){
            var b=$(this).val();
            if(b==c.data.opt.defaultValue||b==""){
                $(this).val(c.data.opt.defaultValue).removeClass(c.data.opt.focusClass).addClass(c.data.opt.blurClass)
            }else{
                $(this).removeClass(c.data.opt.blurClass).addClass(c.data.opt.focusClass)
            }
        });
        $(a.target).blur();
        return $(a.target)
    }
};

IXG.ui.page=function(a,j,d,f){
    a+="";
    j-=0;
    d-=0;
    f=f||3;
    if(d<2){
        return""
    }
    var b=j-f,e=j+f;
    str="";
    if(b<=4){
        b=2
    }
    b=b>1?b:2;
    e=e<d?(e<j?j:e):(d-1);
    var k="";
    if(a.indexOf("javascript:")==0){
        k=' href="#" onclick="'+a.substr(11)+';return false"'
    }else{
        k=' href="'+a+'"'
    }
    str+=j==1?'<span class="page-start"><b>&lt;</b>上一页</span>':("<a"+k.replace(/\{page\}/g,j-1)+' class="page-prev"><b>&lt;</b>上一页</a>');
    str+=j==1?'<span class="page-this">1</span>':("<a"+k.replace(/\{page\}/g,1)+">1</a>");
    if(b!=2){
        str+='<span class="page-break">...</span>'
    }
    for(var g=b;g<e+1;g++){
        if(g==j){
            str+='<span class="page-this">'+j+"</span>"
        }else{
            str+="<a"+k.replace(/\{page\}/g,g)+">"+g+"</a>"
        }
    }
    if(e!=d-1){
        str+='<span class="page-break">...</span>'
    }
    str+=j!=d?("<a"+k.replace(/\{page\}/g,d)+">"+d+"</a>"):('<span class="page-this">'+d+"</span>");
    str+=j!=d?("<a"+k.replace(/\{page\}/g,j+1)+' class="page-next">下一页<b>&gt;</b></a>'):'<span class="page-end">下一页<b>&gt;</b></span>';
    var h=a.indexOf("javascript:")==0?"$.globalEval('"+a.substr(11).replace(/'/g,"\\'").replace(/\{page\}/g,"'+a+'")+"')":("location.href='"+a.replace(/'/g,"\\'").replace(/\{page\}/g,"'+a+'")+"'"),c="var a=parseInt($('input[name=iptpage]',$(this).parent()).val(),10);a=(!!a&&a>0&&a<="+d+")?a:1;"+h+";";
    str+='<span class="page-skip"> 到第<input type="text" value="'+j+'" maxlength="3" name="iptpage" onkeydown="if(event.keyCode==13){$(\'button[name=go]\',$(this).parent()).click();return false;}">页<button name="go" value="go" onclick="'+c+'return false">确定</button></span>';
    return str
};

IXG.logic.constants={
    userLevelName:{
        0:"星级会员",
        1:"铜牌会员",
        2:"银牌会员",
        3:"金牌会员",
        4:"银皇冠会员",
        5:"金皇冠会员"
    },
    getSmallUrl:function(a,b){
        return this._getPicUrl(a,"small",b)
    },
    getSSUrl:function(a,b){
        //        alert(b);
        return this._getPicUrl(a,"ss",b)
    },
    getMMUrl:function(a,b){
        return this._getPicUrl(a,"mm",b)
    },
    getMiddleUrl:function(a,b){
        return this._getPicUrl(a,"middle",b)
    },
    getBigUrl:function(a,b){
        return this._getPicUrl(a,"mpic",b)
    },
    _getPicUrl:function(b,a,c){
        //        if(b.length>10){
        //            b=b.substr(0,10)
        //            }
        return b;
    },
    tipsLevel:{
        0:"info",
        1:"warn",
        2:"error",
        3:"right",
        4:"help"
    },
    getTipStr:function(g,h,f,d){
        if(g==null){
            return""
        }
        if(h==null||!(h in IXG.logic.constants.tipsLevel)){
            h=0
        }
        if(h==0||h==4){
            h=1
        }
        var a=IXG.logic.constants.tipsLevel[h],c="";
        if(d=="big"){
            if($.type(g)!="array"){
                g=[g]
            }
            var e=[];
            if(g.length>1){
                var b=g.shift();
                $.each(g,function(i,j){
                    e.push("<p>"+j+"</p>")
                });
                g.unshift(b)
            }
            if(e.length>0){
                e='<div class="bd">'+e.join("")+"</div>"
            }else{
                e=""
            }
            c='<div class="inner"> <b class="icon icon_msg3 icon_msg3_'+a+'"></b><div class="hd"><strong class="tit">'+(g.length>0?g[0]:"")+"</strong></div>"+e+"</div>";
            c=f?c:'<div class="para_blo para_'+a+'">'+c+"</div>"
        }else{
            c='<b class="icon icon_msg0 icon_msg0_'+a+'"></b><span class="para_tit">'+g+"</span>";
            c=f?c:'<p class="para_inb para_'+a+'">'+c+"</p>"
        }
        return c
    },
    goToCart:function(b,a){
        if(!b){
            return
        }
        IXG.util.cookie.add("backurl",location.href,"/",0,".ixungou.com");
        if(typeof b=="object"){
            if(b.pid>0){
                
                IXG.common.addToCart(b.pid);

                IXG.common.addGoodsGift(b.pid);
            }
        }else{
            IXG.common.addSelectedToCart(b);
        }
    },
    allowedWhInfo:{
        "1":" "//地区
    }
};

$.extend(IXG.logic.constants,{
    getWhId:(function(){
        function d(){
            var e=IXG.util.cookie.get("wsid");
            if(IXG.logic.constants.allowedWhInfo[e]){
                return e
            }
            return false
        }
        var a=IXG.createFnQueue(),c=0,b=d();
        return function(e){
            a.add(e);
            if(c==2||b!==false){
                a.exec(b);
                return
            }
            if(c==1){
                return
            }
            c=1;
            $.get("/ajax/getwhid",function(f){
                c=2;
                b=1;
                if(f&&f.errno==0){
                    if(IXG.logic.constants.allowedWhInfo[f.data]){
                        b=f.data
                    }
                }
                IXG.util.cookie.add("wsid",b,"/",30*24*3600,".ixungou.com");
                a.exec(b)
            },"json")
        }
    })()
});
IXG.logic.validate={
    checkURL:function(b){
        var a=/^(https?:\/\/|ftp:\/\/)?(([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;\/]*)?)?(#[a-z][a-z0-9+_\-\.%=&amp;\/]*)?$/i;
        return a.test(b)
    },
    checkMobilePhone:function(b){
        var a=/^((\(\d{3}\))|(\d{3}\-))?1\d{10}$/;
        return a.test(b)
    },
    checkEmail:function(a){
        return/^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/i.test(a)
    },
    checkTelephone:function(d,a){
        var c=/^([0-9]{3}|0[0-9]{3})-[1-9][0-9]{6,7}(-[0-9]{1,6})?$/,b=/^[0-9]{4}-([0-9]{3}|0[0-9]{3})-[0-9]{7,8}$/,a=a||(1|2);
        if(((a&1)==1)&&c.test(d)){
            return true
        }
        if(((a&2)==2)&&b.test(d)){
            return true
        }
        return false
    },
    checkPhone:function(a){
        return this.checkTelephone(a)||this.checkMobilePhone(a)
    },
    checkNumber:function(a){
        return/^[1-9]\d*$/.test(a);
        return true;
    },
    checkChars:function(c,a){
        var b="^[";
        a=a||(1|2|4);
        if((a&1)==1){
            b+="\u4E00-\u9FA5"
        }
        if((a&2)==2){
            b+="a-zA-Z"
        }
        if((a&4)==4){
            b+="0-9"
        }
        b+="]*$";
        return(new RegExp(b,"")).test(c)
    },
    checkOrderId:function(a){
        return a&&a.length==10&&IXG.logic.validate.checkNumber(a)
    },
    lenMon:function(b){
        if(!b||!b.target){
            return null
        }
        b={
            target:b.target,
            minLen:b.minLen||0,
            maxLen:b.maxLen||Infinity,
            sucClass:b.sucClass||"",
            failClass:b.failClass||"",
            tipCtrl:b.tipCtrl||null,
            charLenStyle:b.charLenStyle||false
        };

        function a(){
            var c=$(b.target).val(),d=b.charLenStyle?$.strlen(c):c.length;
            if(b.tipCtrl){
                $(b.tipCtrl).html("<b>"+d+"</b>/"+b.maxLen);
                if(d<b.minLen||d>b.maxLen){
                    $("b",b.tipCtrl).removeClass(b.sucClass).addClass(b.failClass)
                }else{
                    $("b",b.tipCtrl).removeClass(b.failClass).addClass(b.sucClass)
                }
            }
        }
        a();
        return $(b.target).keyup(a).bind("paste",a)
    }
};

IXG.logic.login={
    _loginUser:false,
    _loginPopup:false,
    _userFnQueue:IXG.createFnQueue(),
    _loginFnQueue:IXG.createFnQueue(false),
    _logoutFnQueue:IXG.createFnQueue(false),
    popup:function(a){
        var b=false;
        if(!this._loginPopup){
            b=IXG.ui.popup.create({
                fullscreen:1,
                title:"用户登录",
                width:670
            });
            this._loginPopup=b
        }
        b=this._loginPopup;
        b.paint(function(e){
            var c=window.LOGIN_NO_JUMP?(LOGIN_NO_JUMP===true?IXG_URL:LOGIN_NO_JUMP):location.href;
            $(e.content).empty().html('<iframe src='+IXG_URL+'data/html/login.html#url='+encodeURIComponent(typeof a=="string"?a:c)+'" width="670" height="188" scrolling="no" frameborder="no"></iframe>');
            $(this).addClass("layer_global_login");
            var d=$(e.content).find("iframe")[0];
            d.resize=(function(){
                return function(g,f){
                    _.height=f;
                    _.style.height=f+"px"
                }
            })(d);
            d.callback=function(){
                var f=true;
                if($.isFunction(a)){
                    if(a()===false){
                        f=false
                    }
                }else{
                    if(typeof a=="string"){
                        this.callback=null;
                        location.replace(a);
                        return
                    }
                }
                if(f){
                    b.hide();
                    IXG.logic.login.updateHead()
                }
                this.callback=null
            }
        });
        b.show();
        return b
    },
    login:function(d,c,a,b){
        IXG.util.post("/user/login",{
            account:d,
            password:c
        },function(e){
            if(e&&e.errno==0){
                if($.isFunction(a)){
                    a()
                }
            }else{
                if($.isFunction(b)){
                    b(e&&e.errno?e.errno:null)
                }
            }
        })
    },
    updateHead:function(){
        IXG.logic.constants.getWhId(function(a){
            if(!IXG.logic.constants.allowedWhInfo[a]){
                location.replace(IXG_URL);
                return
            }
            IXG.logic.login.getLoginUser(function(i){
                var f=$("#user_nav .i_welcome").empty(),c=window.LOGIN_NO_JUMP?(LOGIN_NO_JUMP===true?IXG_URL:LOGIN_NO_JUMP):location.href;
                if(i&&i.errno==0){
                    
                    var h=i.data;
                    if(h.ixungouid.toString().indexOf("Login_QQ_")==0){
                        str='<i class="icon_qq">&nbsp;</i>亲爱的QQ用户，';
                        var b=IXG.util.cookie.get("cps_msg").split("|");
                        if(b.length>=2&&b[0]==h.uid){
                            b.shift();
                            str=b.join("|")
                        }else{
                            var g=IXG.util.cookie.get("qq_nick").split("|");
                            if(g.length>=2&&g[0]==h.uid){
                                g.shift();
                                str+=g.join("|");
                                str+="。"
                            }
                        }
                    }else{
                        if(h.ixungouid.toString().indexOf("Login_Alipay_")==0){
                            str=IXG.util.parse.encodeHtml(h.name||h.ixungouid)+" 您好，"
                        }else{
                            if(/^\d+@51fanli$/.test(h.ixungouid.toString())){
                                var b=IXG.util.cookie.get("cps_msg").split("|");
                                if(b.length>=2&&b[0]==h.uid){
                                    str=b[1]
                                }
                            }else{
                                str=IXG.util.parse.encodeHtml(h.ixungouid)+" 您好，"
                            }
                        }
                    }
                    var e=$("#user_nav .i_qq_login");
                    e.next().css("display","none");
                    e.css("display","none");
                    f.html(str+'欢迎来爱寻购网上商城！ [<a href="#"  onclick="return false;" name="quit">退出</a>]');
                    f.find("a[name=quit]").click(IXG.logic.login.logout);
                }else{
                    f.html('您好，欢迎来爱寻购网上商城！ <a href="/login.html" name="navlogin">登录</a> <a href="/register.html">注册</a>');
                //                    var e=$("#user_nav .i_qq_login");
                //                    e.css("display","").html('<a href="#"><i class="icon_qq">&nbsp;</i>QQ登录</a>');
                //                    e.next().css("display","")
                }
            })
        })
    },
    userLogout:function(){
        $.ajax({
            type:"POST",
            url:"/user/logout",
            dataType:"json"
        });
        IXG.util.cookie.del("IXG_USER_ID",".ixungou.com");
    }
    ,
    getLoginUid:function(){
        var a=IXG.util.cookie.get("IXG_USER_ID");
        if(IXG.logic.validate.checkNumber(a)){
            return a
        }
        return false
    },
    forceFlushUser:function(){
        var a=Math.random();
        IXG.util.cookie.add("randpro",a,"/",24*3600,".ixungou.com");
        return a
    },
    _getLoginUser:function(f,e){
        var c=IXG.logic.login,a=$.isFunction(f)?f:$.noop,d=c.getLoginUid();
        if(c._loginUser&&c._loginUser!=false&&c._loginUser.uid==d){
            a(c._loginUser);
            return
        }
        c._userFnQueue.add(a);
        if(c._userLoading){
            return
        }
        c._userLoading=true;
        var b=IXG.util.cookie.get("randpro");
        if(e){
            b=c.forceFlushUser()
        }
        $.ajax({
            type:"POST",
            url:"/ajax/getUserProfileForAjax/"+d+"/"+b,
            success:function(g){
                c._userLoading=false;
                c._userFnQueue.exec(g);
                c._loginUser=g
            },
            dataType:"json",
            cache:true
        })
    },
    _getLoginQQUser:function(d){
        var b='',c=$('<iframe src="about:blank" style="display:none"></iframe>');
        $("body").prepend(c);
        var a=$.isFunction(d)?d:$.noop;
        c[0].callback=function(){
            a();
            $(this).src="about:blank";
            $(this).remove();
            this.callback=null
        };
        if($.browser.msie&&parseInt($.browser.version)<9){
            IXG.util.post.pIndex=(IXG.util.post.pIndex||0)+1;
            c[0].pIndex=IXG.util.post.pIndex;
            c[0].ie6callback=function(){
                this.src=b
            };

            c[0].src="/data/html/ie6post.html"
        }else{
            c[0].src=b
        }
    },
    _refer:null,
    getLoginUser:function(f,c,d){
        var a=IXG.logic.login,b=a.getLoginUid();
        a._refer=a._refer===null?document.referrer:a._refer;
        if(!b){
            var e=IXG.util.cookie.get("cps_info");
            if(c!==false&&((/^\s*linktech\|\|A100060164/i.test(e)&&IXG.util.cookie.get("QQACCT")==2)||(((a._refer!=""&&!/^http:\/\/([a-z0-9]+\.|)ixungou\.com/i.test(document.referrer))||!IXG.util.cookie.get("QQACCT"))&&!e))){
                a._refer="";
                IXG.util.cookie.add("QQACCT",1,"/",0,".ixungou.com");
                //                a._getLoginQQUser(function(){
                a.getLoginUser(function(g){
                    if(g&&g.errno==0){
                        IXG.util.cookie.add("QQACCT",g.data.ixungouid.replace(/^Login_QQ_/i,""),"/",0,".ixungou.com")
                    }
                    $.isFunction(f)&&f(g)
                },false,d)
            //                })
            }else{
                $.isFunction(f)&&f(false)
            }
            a._refer="";
            return
        }
        a._refer="";
        a._getLoginUser(f,d)
    },
    logout:function(a){
        IXG.logic.login.userLogout();
        IXG.util.cookie.del("skey",".ixungou.com");
        IXG.logic.login._logoutFnQueue.exec();
        $.isFunction(a)&&a();
        if(window.LOGIN_NO_JUMP){
            location.replace(LOGIN_NO_JUMP===true?IXG_URL:LOGIN_NO_JUMP)
        }else{
            IXG.logic.login.updateHead();
            IXG.logic.header.getShoppingCart()
        }
    },
    onlogout:function(a){
        $.isFunction(a)&&IXG.logic.login._logoutFnQueue.add(a)
    },
    ifLogin:function(c,b){
        var a=IXG.logic.login.getLoginUid();
        if(!a){
            IXG.logic.login.popup(c&&b?(function(d){
                return function(){
                    var e=[];
                    for(var f=d.length-1;f>=0;f--){
                        e.unshift(d[f])
                    }
                    d.callee.apply(c,e)
                }
            })(b):$.noop);
            return false
        }
        return true
    },
    ifLoginJump:function(){
        var b=IXG.logic.login.getLoginUid();
        if(!b){
            var a=IXG_URL;
            if(!window.skipJumpPage){
                a="/data/html/login.html?url="+encodeURIComponent(location.href)
            }
            location.replace(a);
            return false
        }
        return true
    },
    jump:function(){}
};

IXG.logic.header={
    _Q_SHOW_DEF_TEXT:"输入品牌或商品进行搜索",
    loginStatus:function(){
        IXG.logic.login.updateHead();
        IXG.ui.tips.swapInput({
            target:$("#q_show"),
            defaultValue:IXG.logic.header._Q_SHOW_DEF_TEXT,
            focusClass:"mod_search_txt",
            blurClass:"mod_search_txt no_cur"
        });
//        this.locateRegion();
        this.getShoppingCart();
        this.category.init();
        this.getHotKey();
        //        this.ga();
        this.recordLs();
        this.autoComplete();
        setTimeout(function(){
            if(location.href.match(/^http:\/\/www\.(ixungou)\.com/)){
                $.ajax({
                    url:"/javascript/new20111020/tray_popup.js",
                    cache:true,
                    type:"GET",
                    scriptCharset:"utf-8",
                    dataType:"script",
                    success:function(){
                        IXG.app.tray_popup.launch()
                    }
                })
            }
        },0);
        $(function(){
            logStat.initStat()
        })
    },
    recordLs:function(){
        var a=IXG.util.parse.url();
        $.each(a,function(b,c){
            $.each(c,function(e,d){
                e=(e+"").toLowerCase();
                if(e=="ls"||e=="us"){
                    IXG.util.cookie.add(e,d,"/",7*24*3600,".ixungou.com")
                }
            })
        })
    },
    autoComplete:function(){
        function a(){
            IXG.logic.constants.getWhId(function(c){
                var b=IXG.ui.autoComplete({
                    target:"#q_show",
                    listOnClass:"autocomplete_status_on",
                    itemActiveClass:"status_on",
                    itemTPL:"<li><span>{label}</span></li>",//<cite>约{count}个搜索结果</cite>
                    url:"/ajax/searchKeyword",
                    keyName:"kw",
                    delayTime:250,
                    cache:true
                });
                b.bind("success",function(j,k){
                    var h=k.response,e=[];
                    if(h&&h.list&&h.list.length>0){
                        for(var g=0,d=h.list.length;g<d;g++){
                            var f=h.list[g];
                            e.push({
                                value:f[0],
                                count:f[1],
                                label:f[0]
                            })
                        }
                    }
                    k.response=e
                });
                b.bind("complete",function(){
                    $("#q_show").parents("form").submit()
                })
            })
        }
        $(a)
    },
    _kefuLink:{
//        1:"http://b.qq.com/webc.htm?new=0&sid=4006401878&eid=218808P8z8p8y8x8Q8R8K&o=http://www.ixungou.com&q=7",
//        1001:"http://b.qq.com/webc.htm?new=0&sid=4008286699&eid=218808P8z8p8x8z8y8x8z&o=http://www.ixungou.com&q=7",
//        2001:"http://b.qq.com/webc.htm?new=0&sid=4008280055&eid=218808P8z8p8P8q8R8q8p&o=http://www.ixungou.com&q=7"
    },
    locateRegion:function(){
        var a=$("#i_region");
        if(a.length===0){
            return
        }
        var b=arguments.callee,c=IXG.logic.constants;
        c.getWhId(function(j){
            var i=c.allowedWhInfo[j];
            if(i){
                a.find(".region_hd").html(i)
            }
            $("#user_nav .i_service a").attr("href",IXG.logic.header._kefuLink[j]);
            a.children(":not(.region_hd)").remove();
            if(/^http:\/\/((sz|www)\.|)(ixungou)\.com(\/?|\/(sz|sh|bj))($|\?|#)/.test(location.href)){
                var h=[];
                $.each(c.allowedWhInfo,function(m,l){
                    if(m==j){
                        return
                    }
                    h.push('<li><a href="#" onclick="return false" w="'+m+'">'+l+"</a></li>")
                });
                var e=$('<div class="jump_city"><a class="switch">切换地区<i></i></a><div class="wrap_city"><ul class="city"><li>请选择：</li>'+h.join("")+'</ul><div class="nor">*其他地区用户请选择上海</div><p class="load"></p><p class="f"><span class="icon icon_msg0 icon_msg0_warn"></span>切换失败，请<a href="#" class="switch_fail_btn">返回重试</a></p><a class="close">×</a></div></div>'+(IXG.util.cookie.get("ws_tip")?"":('<div class="ip_tip layout_popup"><div class="layout_inner"><div class="layout_bd"><p>您正在访问<strong class="strong">爱寻购'+i+'站</strong>您也可以手动切换至其他分站</p></div></div><div class="layout_arrow_left"><span class="">◆</span><i>◆</i></div><a href="#" class="close" onclick="return false">X</a></div>'))).appendTo(a);
                e.filter(".ip_tip").find(".close").click(function(){
                    IXG.util.cookie.add("ws_tip",1,"/",24*3600*30,".ixungou.com");
                    e.filter(".ip_tip").hide()
                });
                var d=null,k=function(){
                    if(d){
                        clearTimeout(d);
                        d=null
                    }
                },f=function(){
                    k();
                    if(e.filter(".ip_tip").length>0){
                        e.filter(".ip_tip").find(".close").click()
                    }
                    e.addClass("status_hover")
                },g=function(){
                    k();
                    d=setTimeout(function(){
                        b.hoverSwitch!==true&&e.removeClass("status_hover")
                    },100)
                };

                $(".switch",e).hover(f,g).click(function(){
                    b.hoverSwitch!==true&&e[e.hasClass("status_hover")?"removeClass":"addClass"]("status_hover")
                });
                $(".close",e).click(function(){
                    b.hoverSwitch!==true&&e.removeClass("status_hover")
                });
                $(".wrap_city",e).hover(f,g);
                $(".city li a").click(function(){
                    b.lastClickDom=this;
                    b.hoverSwitch=true;
                    if(!c.allowedWhInfo[$(this).attr("w")]){
                        return
                    }
                    IXG.logic.header.switchSite($(this).attr("w"))
                });
                $(".switch_fail_btn",e).click(function(){
                    b.lastClickDom&&$(b.lastClickDom).triggerHandler("click");
                    return false
                })
            }
        })
    },
    switchSite:function(d){
        var c=arguments.callee;
        if(!this.xhr){
            var b=1.3;
            c.xhr=$.ajax({
                type:"GET",
                timeout:30*1000,
                scriptCharset:"utf-8",
                url:"http://"+IXG.DOMAIN.ST_IXUNGOU_COM+"/static_v1/js/app/switchSite.js?v="+b,
                dataType:"script",
                cache:true,
                crossDomain:true
            })
        }
        var a=$("#i_region");
        c.xhr.done(function(){
            IXG.app.switchSite.tryToSwitchTo(d)
        }).fail(function(){
            a.find(".load").css("display","none");
            a.find(".f").css("display","block");
            a.find(".close").css("display","block")
        });
        a.find(".load").html('<span class="loading_82_21"></span>正在切换到<span class="where">'+IXG.logic.constants.allowedWhInfo[d]+"站</span>……").css("display","block");
        a.find(".city, .nor, .f, .close").css("display","none")
    },
    //    ga:function(){
    //        var a=a||[];
    //        window._gaq=a;
    //        IXG.logic.constants.getWhId(function(c){
    //            window._gaq.push(["_setAccount","UA-10104379-15"]);
    //            window._gaq.push(["_setCustomVar",1,"site_id","site_"+c,2]);
    //            window._gaq.push(["_trackPageview"]);
    //            var b=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";
    //            $(function(){
    //                $.ajax({
    //                    url:b,
    //                    type:"get",
    //                    dataType:"script",
    //                    cache:true,
    //                    async:true
    //                })
    //            })
    //        })
    //    },
    query:function(){
        var a=$("#q_show");
        v=$.trim(a.val()),ret=true;
        if(v===""||v===$.trim(IXG.logic.header._Q_SHOW_DEF_TEXT)){
            a.focus();
            ret=false
        }
        return ret
    },
    getHotKey:function(){
        var a=$("#i_keyword");
        if(a.length===0){
            return
        }
        IXG.logic.constants.getWhId(function(){
            $.ajax({
                type:"GET",
                url:"/ajax/indexHotKeyForAjax",
                success:function(c){
                    if(c&&c.errno==0){
                        a.html(c.data)
                    }
                },
                dataType:"json",
                cache:true
            })
        })
    },
    getShoppingCart:function(){
        var a=$("#i_cart_info");
        if(a.length==0){
            return
        }
        var b=IXG.logic.login.getLoginUid();
        var c=function(d){
            a.html('<i class="bod_left"></i><a href="/flow/cart" target="_blank" class="cart_info" hidefocus="true"><i class="icon_cart">&nbsp;</i>购物车<span class="amount">'+d+'</span>件</a><i class="bod_right"></i>')
        };

        if(b){
            $.getJSON("/ajax/getCartGoodsNumForAjax",function(d){
                c(d&&d.errno==0&&d.data.num||0);
            })
        }else{
            IXG.util.localShare(function(e){
                var d=e.getItem("shoppingcart");
                IXG.logic.constants.getWhId(function(g){
                    var f=0;
                    if(d){
                        $.each(d.list,function(h,i){
                            f+=i[1]-0
                        })
                    }
                    c(f)
                })
            })
        }
    },
    category:{
        config:{
            headIn:10,
            headOut:100,
            panelOut:200,
            liIn:100
        },
        FIRSTTPL:'<ul id="i_sort_list" class="i_sort_list"><@first_list@><li class="i_item" cateid="{id}"><h4 class="i_tit"><a hotname="I.CATEGORY.FIRST.{index}" href="{url}">{text}</a><span class="i_jian">&gt;</span></h4><div class="i_cont"></div></li><@_first_list@></ul>',
        SECONDTPL:'{iframe_str}<div class="i_cont_left"><@second_list@><dl><dt>{second_name}</dt><dd><@third_list@><a hotname="I.CATEGORY.SECOND.{index}"href="{url}">{name}</a><@_third_list@></dd></dl><@_second_list@></div><div class="i_cont_right"><@recommend_list@><dl><dt>{recommend_name}</dt><dd><@recommend_link_list@><a hotname="I.CATEGORY.RECOMMEND.{index}" href="{recommend_link_url}">{recommend_link_name}</a>{recommend_pipe}<@_recommend_link_list@></dd></dl><@_recommend_list@></div>',
        renderFirst:function(){
            var b=this,a=$("#category_panel");
            if(a.length==0){
                return
            }
            if(a.html()==""){
                var d={
                    first_list:[]
                },c=1;
                $.each(window.CATEGORY_CONFIG,function(e,f){
                    d.first_list.push({
                        id:e,
                        index:c++,
                        url:f.url+(f.url==="#"?'" onclick="return false':'" style="cursor:pointer'),
                        text:f.text
                    })
                });
                a.html(IXG.ui.template.fillWithTPL(false,d,false,this.FIRSTTPL))
            }
            a.mouseleave(function(){
                b.clearTimeout();
                b.panelOutTimer=setTimeout(function(){
                    $("#i_sort_list>li").removeClass("i_item_status_on");
                    $("#i_sort_list>li .i_cont_iframe").css({
                        display:"none"
                    });
                    b.needSlide&&$("#category_container").removeClass("i_status_on")
                },b.config.panelOut)
            })
        },
        clearTimeout:function(){
            this.headInTimer&&clearTimeout(this.headInTimer);
            this.headOutTimer&&clearTimeout(this.headOutTimer);
            this.panelOutTimer&&clearTimeout(this.panelOutTimer);
            this.liInTimer&&clearTimeout(this.liInTimer);
            this.headInTimer=0;
            this.headOutTimer=0;
            this.panelOutTimer=0;
            this.liInTimer=0
        },
        renderSecond:function(g){
            var i=this,b=$(g).index(),d=!!($.browser.msie&&$.browser.version==6),h=d?'<iframe class="i_cont_iframe" style="width:0px;height:0px"></iframe>':"";
            dataSource={
                second_list:[],
                recommend_list:[],
                iframe_str:h
            },secondIndex=1;
            $.each(window.CATEGORY_CONFIG[g.attr("cateid")]["list"],function(j,k){
                var l={
                    second_name:k.text,
                    third_list:[]
                },m=1;
                $.each(k.list,function(n,o){
                    l.third_list.push({
                        name:o.text,
                        url:o.url,
                        index:b+"."+secondIndex+"."+m
                    });
                    m++
                });
                dataSource.second_list.push(l);
                secondIndex++
            });
            secondIndex=1;
            $.each(window.CATEGORY_CONFIG[g.attr("cateid")]["recommend"]||{},function(j,l){
                var m={
                    recommend_name:l.name,
                    recommend_link_list:[]
                },k=l.list.length,n=1;
                $.each(l.list,function(o,p){
                    m.recommend_link_list.push({
                        recommend_link_name:p.text,
                        recommend_link_url:p.url,
                        recommend_pipe:(o<k-1)?'<span class="pipe">|</span>':"",
                        index:b+"."+secondIndex+"."+n
                    });
                    n++
                });
                dataSource.recommend_list.push(m);
                secondIndex++
            });
            var f=g.find(".i_cont");
            f.html(IXG.ui.template.fillWithTPL(false,dataSource,false,this.SECONDTPL));
            d&&f.find(".i_cont_iframe").css({
                width:f.width(),
                height:f.height()
            });
            var e=7,a=parseFloat(g.offset()["top"],10)+parseFloat(g.outerHeight(),10),c=parseFloat(f.offset()["top"],10)+parseFloat(f.outerHeight(),10);
            if(c-a<e){
                f.css({
                    top:parseInt(a+e-c)+"px"
                })
            }
        },
        mousehover:function(a){
            $("#i_sort_list>li").removeClass("i_item_status_on");
            $("#i_sort_list>li .i_cont_iframe").css({
                display:"none"
            });
            a.addClass("i_item_status_on");
            a.find(".i_cont_iframe").css({
                display:""
            });
            if(!a.data("rendered")){
                a.data("rendered",true);
                this.renderSecond(a)
            }
        },
        showPanel:function(){
            var a=this;
            a.sendRequest(function(){
                a.renderFirst();
                $("#i_sort_list>li").mouseenter(function(){
                    var b=$(this);
                    a.clearTimeout();
                    a.liInTimer=setTimeout(function(){
                        if(false===b.hasClass("i_item_status_on")){
                            a.mousehover(b)
                        }
                    },a.config.liIn)
                })
            })
        },
        sendRequest:function(b){
            var a=this;
            a.callbackList=a.callbackList||[];
            if(a.jsLoadStatus===3){
                b.call(a)
            }else{
                a.callbackList.push(b);
                if(a.jsLoadStatus==1){
                    a.jsLoadStatus=2;
                    IXG.logic.constants.getWhId(function(c){
                        $.ajax({
                            type:"get",
                            dataType:"script",
                            url:IXG.prefix.st+"javascript/new20111020/data/cat_js_cache.js",
                            crossDomain:true,
                            cache:true,
                            scriptCharset:"utf-8",
                            success:function(){
                                while(a.callbackList.length){
                                    a.callbackList.shift().call(a)
                                }
                            },
                            error:function(){
                                a.jsLoadStatus=1
                            },
                            context:a
                        })
                    })
                }
            }
        },
        init:function(){
            var b=this,a=$("#category_container");
            b.jsLoadStatus=1;
            if(a.length===0){
                return
            }
            var c=b.needSlide=!a.hasClass("i_status_on");
            c&&a.find(">div:first-child").hover(function(){
                b.clearTimeout();
                b.headInTimer=setTimeout(function(){
                    a.addClass("i_status_on");
                    $("#i_sort_list>li").removeClass("i_item_status_on");
                    $("#i_sort_list>li .i_cont_iframe").css({
                        display:"none"
                    });
                    b.showPanel()
                },b.config.headIn)
            },function(){
                b.clearTimeout();
                b.headOutTimer=setTimeout(function(){
                    a.removeClass("i_status_on")
                },b.config.headOut)
            });
            !c&&b.showPanel()
        }
    },
    openKF:function(){
        var b=504,c=404,a=($(window).width()-b)/2,d=($(window).height()-c)/2;
        IXG.logic.constants.getWhId(function(e){
            window.open(IXG.logic.header._kefuLink[e],"_blank","height="+c+",width="+b+",toolbar=no,scrollbars=no,menubar=no,status=no,left="+a+",top="+d+"")
        })
    }
};

logStat={
    getLog:function(g){
        var h=g.target,f,a,d,c,b;
        if(h.getAttribute("lg")){
            d=h
        }else{
            if(h.parentNode&&h.parentNode.tagName=="A"&&h.parentNode.getAttribute("lg")){
                d=h.parentNode
            }
        }
        if(d){
            c=d.getAttribute("lg");
            c=c+(d.getAttribute("pos")?"{|}"+d.getAttribute("pos"):"{|}1");
            if(d.getAttribute("href")&&d.getAttribute("href").indexOf("#")==-1){
                c=c+"{|}"+escape(d.getAttribute("href"))
            }else{
                if(d.getAttribute("title")){
                    c=c+"{|}"+d.getAttribute("title")
                }else{
                    if(d.getAttribute("alt")){
                        c=c+"{|}"+d.getAttribute("alt")
                    }else{
                        if(d.tagName=="INPUT"||d.tagName=="BUTTON"||d.innerText==""){
                            b=(d.id)?d.id:d.name;
                            b=(b)?b:d.tagName;
                            c=c+"{|}"+b
                        }else{
                            c=c+"{|}"+d.innerText
                        }
                    }
                }
            }
            if(d.getAttribute("lgType")){
                c=d.getAttribute("lgType")+"{|}"+c
            }else{
                if(d.getAttribute("target")==="_blank"){
                    c="0{|}"+c
                }else{
                    c="1{|}"+c
                }
            }
            IXG.logic.constants.getWhId(function(i){
                var e={
                    "1":4,
                    "1001":10,
                    "2001":13
                };

                i=e[i]?e[i]:4;
                logStat.chkLog(i+"{|}"+c)
            })
        }
    },
    chkLog:function(f){
        var e="http://search.paipai.com/cgi-bin/clicklog",b;
        var d=IXG.util.cookie.get("visitkey"),c=IXG.util.cookie.get("uid"),a=escape(document.URL);
        b=f.split("{|}");
        if(b[2]){
            e=e+"?srcid="+b[0]+"&uin="+c+"&ls="+b[2]+"&subls="+b[3]+"&visitKey="+d+"&ref="+a+"&herf="+b[4];
            if(b[1]=="1"){
                IXG.util.cookie.add("lgStat",e,"/",0,".ixungou.com")
            }else{
                logStat.loadScript(e+"&t="+(new Date()).getTime(),"chkStatScript")
            }
        }
    },
    chkItem:function(d,c,b,a){
        IXG.logic.constants.getWhId(function(l){
            var m={
                "1":4,
                "1001":10,
                "2001":13
            };

            var i="http://search.paipai.com/cgi-bin/search_log?srcid="+m[l]+"&";
            var j=IXG.util.cookie.get("visitkey"),h=$("#q_show"),k="";
            if(h.length>0){
                k=h.val();
                k=k==="输入品牌或商品进行搜索"?"":k
            }
            var e=IXG.util.cookie.get("uid");
            var f=document.URL;
            var g=i+"pos="+d+"&visitkey="+j+"&uin="+e+"&ref="+escape(f)+"&commid="+c+"&leafclassid="+(b||"")+"&keyword="+k+"&t="+(new Date).getTime();
            if(a===undefined){
                IXG.util.cookie.add("lgStat",g,"/",0,".ixungou.com")
            }else{
                logStat.loadScript(g)
            }
        })
    },
    initStat:function(c){
        if(c){
            for(var a in c){
                this[a]=c[a]
            }
        }
        $(document).bind("click",logStat.getLog);
        var b=IXG.util.cookie.get("lgStat");
        if(b){
            setTimeout(function(){
                logStat.loadScript(b+"?t="+(new Date).getTime());
                IXG.util.cookie.del("lgStat",".ixungou.com")
            },0)
        }
    },
    loadScript:function(a,c,b){
        setTimeout(function(){
            var d=document.createElement("script"),e=new Date().getTime(),f=b||{},g=f.charset||"utf-8";
            c=c?(c+e):e,a=a;
            d.charset=g;
            d.id=c;
            document.getElementsByTagName("head")[0].appendChild(d);
            d.src=a;
            return d
        },0)
    }
};

if(!$.browser.msie){
    HTMLElement.prototype.__defineGetter__("innerText",function(){
        var a="";
        var c=this.childNodes;
        for(var b=0;b<c.length;b++){
            if(c[b].nodeType==1){
                a+=c[b].innerText
            }else{
                if(c[b].nodeType==3){
                    a+=c[b].nodeValue
                }
            }
        }
        return a
    })
}

IXG.common={};

/* *
 * 添加商品到购物车
 */
IXG.common.addToCart=function(goodsId, parentId)
{
    var goods        = new Object();
    var spec_arr     = new Array();
    var gpid_arr     = new Array();
    var fittings_arr = new Array();
    var goods_products_arr = new Array();
    var number       = 1;
    var formBuy      = document.forms['IXG_FORMBUY'];
    var quick		   = 0;

    // 检查是否有商品规格
    if (formBuy)
    {
        spec_arr = IXG.common.getSelectedAttributes(formBuy);

        if (formBuy.elements['number'])
        {
            number = formBuy.elements['number'].value;
        }

        gpid_arr = IXG.common.getSelectedGpid(formBuy);
        

        quick = 1;
    }
    goods.quick    = quick;
    goods.spec     = spec_arr;
    goods.goods_id = goodsId;
    goods.number   = number;
    goods.parent   = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
    $.ajax({
        url: '/flow/add_to_cart',
        type:"post",
        data:({
            'goods':$.toJSON(goods)
        }),
        dataType:"json",
        success: function(data){
            IXG.common.addToCartResponse(data ,goodsId ,gpid_arr);
        }
    });
}

/* *
 * 处理添加商品到购物车的反馈信息
 */
IXG.common.addToCartResponse=function (result ,goods_id ,goods_products_arr)
{
    
    gpid_str = '';

    if (result.error > 0)
    {
        // 如果需要缺货登记，跳转
        if (result.error == 2)
        {
            IXG.ui.popup.showMsg(result.message ,1,function(){
                window.location.href='/user/add_booking/' + result.goods_id + '/' + result.product_spec
            },$.noop,$.noop,"确定","取消");
        //            if (confirm(result.message))
        //            {
        //                location.href = '/user/add_booking/' + result.goods_id + '/' + result.product_spec;
        //            }
        }
        // 没选规格，弹出属性选择框
        else if (result.error == 6)
        {
            IXG.common.openSpeDiv(result.message, result.goods_id, result.parent);
        }
        else
        {
            
            alert(result.message);
        }
    }
    else
    {
        if($.isArray(goods_products_arr)){
            for(var gpid_i=0;gpid_i<goods_products_arr.length;gpid_i++){
                gpid_str += goods_products_arr[gpid_i]+'_';
            }
        }else{
            gpid_str = '0_';
        }

        gpid_str = gpid_str.substr(0,gpid_str.lastIndexOf('_'));
        
        var cartInfo = document.getElementById('IXG_CARTINFO');
        var cart_url = '/cart.html?pid='+goods_id+'&pnum=1&mid=0&gpid='+gpid_str;
        if (cartInfo)
        {
            cartInfo.innerHTML = result.content;
        }

        if (result.one_step_buy == '1')
        {
            location.href = cart_url;
        }
        else
        {
            switch(result.confirm_type)
            {
                case '1' :
                    if (confirm(result.message)) location.href = cart_url;
                    break;
                case '2' :
                    if (!confirm(result.message)) location.href = cart_url;
                    break;
                case '3' :
                    location.href = cart_url;
                    break;
                default :
                    break;
            }
        }
    }
}

/**
 * 获得选定的商品属性
 */
IXG.common.getSelectedAttributes=function (formBuy)
{
    var spec_arr = new Array();
    var j = 0;

    for (i = 0; i < formBuy.elements.length; i ++ )
    {
        var prefix = formBuy.elements[i].name.substr(0, 5);

        if (prefix == 'spec_' && (
            ((formBuy.elements[i].type == 'radio' || formBuy.elements[i].type == 'checkbox') && formBuy.elements[i].checked) ||
            formBuy.elements[i].tagName == 'SELECT'))
            {
            spec_arr[j] = formBuy.elements[i].value;
            j++ ;
        }
    }

    return spec_arr;
}

/**
 * 获得选定的商品属性
 */
IXG.common.getSelectedGpid=function (formBuy)
{
    var goods_products_arr = new Array();
    var j = 0;

    for (i = 0; i < formBuy.elements.length; i ++ )
    {
        var prefix = formBuy.elements[i].name.substr(0, 5);

        if (prefix == 'spec_' && (
            ((formBuy.elements[i].type == 'radio' || formBuy.elements[i].type == 'checkbox') && formBuy.elements[i].checked) ||
            formBuy.elements[i].tagName == 'SELECT'))
            {
            goods_products_arr[j] = $(formBuy.elements[i]).attr('gpid');
            j++ ;
        }
    }

    return goods_products_arr;
}

//生成属性选择层
IXG.common.openSpeDiv=function (message, goods_id, parent)
{
    _alertPopup=false;

    var ixg_alert_div='<div style="text-align:left;">';

    //生成层内内容
    for (var spec = 0; spec < message.length; spec++)
    {
        ixg_alert_div += '<h6 style="text-align:left; background:#ffffff; margin-left:15px;font-size:16px;">' +  message[spec]['name'] + '</h6>';

        if (message[spec]['attr_type'] == 1)
        {
            for (var val_arr = 0; val_arr < message[spec]['values'].length; val_arr++)
            {
                if (val_arr == 0)
                {
                    ixg_alert_div += "<input style='margin-left:15px;margin-right:5px;' gpid="+message[spec]['values'][val_arr].product_id+" type='radio' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' checked /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + '</font> [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />';
                }
                else
                {
                    ixg_alert_div += "<input style='margin-left:15px;margin-right:5px;' gpid="+message[spec]['values'][val_arr].product_id+" type='radio' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + '</font> [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />';
                }
            }
            ixg_alert_div += "<input type='hidden' name='spec_list' value='" + val_arr + "' />";
        }
        else
        {
            for (var val_arr = 0; val_arr < message[spec]['values'].length; val_arr++)
            {
                ixg_alert_div += "<input style='margin-left:15px;' type='checkbox' gpid="+message[spec]['values'][val_arr].product_id+" name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + ' [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />';
            }
            ixg_alert_div += "<input type='hidden' name='spec_list' value='" + val_arr + "' />";
        }
    }
    //    ixg_alert_div += "<br /><center>[<a href='javascript:submit_div(" + goods_id + "," + parent + ")' class='f6' >购买</a>]&nbsp;&nbsp;[<a href='javascript:$.fancybox.close()' class='f6' >关闭</a>]</center>";
    ixg_alert_div += '<div class="wrap_btn" style="margin-top:10px;text-align:center;"><a class="btn_strong" href="javascript:IXG.common.submit_div(' + goods_id + ',' + parent + ')">确定</a> <a class="btn_common" href="#" onclick="return false">取消</a></div>';
    ixg_alert_div+='</div>';
    _alertPopup=IXG.ui.popup.create({
        title:"请选择商品属性",
        width:300,
        height:400,
        fullscreen:1
    })

    _alertPopup.paint(function(e){
        $(e.content).empty().html(ixg_alert_div);
        $(".btn_common").click(function(){
            _alertPopup.hide()
        })
    })

}

//获取选择属性后，再次提交到购物车
IXG.common.submit_div=function (goods_id, parentId)
{
    var goods        = new Object();
    var spec_arr     = new Array();
    var goods_products_arr     = new Array();
    var fittings_arr = new Array();
    var number       = 1;
    var input_arr      = document.getElementsByTagName('input');
    var quick		   = 1;

    var j = 0;

    for (i = 0; i < input_arr.length; i ++ )
    {
        var prefix = input_arr[i].name.substr(0, 5);

        if (prefix == 'spec_' && (
            ((input_arr[i].type == 'radio' || input_arr[i].type == 'checkbox') && input_arr[i].checked)))
            {
            spec_arr[j] = input_arr[i].value;
            goods_products_arr[j] = $(input_arr[i]).attr('gpid');
            j++ ;
        }
    }
    goods.quick    = quick;
    goods.spec     = spec_arr;
    goods.goods_id = goods_id;
    goods.number   = number;
    goods.parent   = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);

    $.ajax({
        url: '/flow/add_to_cart',
        type:"post",
        data:({
            'goods':$.toJSON(goods)
        }),
        dataType:"json",
        success: function(data){
            IXG.common.addToCartResponse(data ,goods_id , goods_products_arr);
        }
    });
    //    document.body.removeChild(docEle('speDiv'));
    //    document.body.removeChild(docEle('mask'));

    var i = 0;
    var sel_obj = document.getElementsByTagName('select');
    while (sel_obj[i])
    {
        sel_obj[i].style.visibility = "";
        i++;
    }

}

/* *
 * 添加商品到收藏夹
 */
IXG.common.collect=function (goodsId)
{
    $.ajax({
        url: '/user/collect',
        type:"post",
        data:({
            'id':goodsId
        }),
        dataType:"json",
        success: function(data){
            IXG.common.collectResponse(data);
        }
    });
}

/* *
 * 处理收藏商品的反馈信息
 */
IXG.common.collectResponse=function (result)
{
    if(result.error==0){
        var errno_type=3;
    }else if(result.error==1){
        var errno_type=1;
    }
    IXG.ui.popup.showMsg(result.message,errno_type)
}

//批量添加商品到购物车IXG.common.addSelectedToCart
IXG.common.addSelectedToCart=function ( goods )
{
    var goods_obj=new Object();
    //拆分商品
    var goods_arr=goods.split(',');
    goods_obj.goods=goods_arr;

    $.ajax({
        url: '/ajax/addSelectedToCartForAjax',
        type:"post",
        data:({
            'goods_obj':$.toJSON(goods_obj)
        }),
        dataType:"json",
        success: function(data){
            if('0'==data.errno){
                location.href='/cart.html?ids='+goods;
            }
        }
    });

}

//动态添加赠品
IXG.common.addGoodsGift=function ( goods_id )
{
    $.ajax({
        url: '/ajax/addGoodsGiftToCartForAjax',
        type:"post",
        data:({
            'goods_id':goods_id
        })        
    });
}

