
(function() {
    var b = "http://www.51ezt.com",
    a = "http://www.51ezt.com";
	
    var c = {
        PREUIURL: b,
        PREMY: a,
        description: "我的E站通全局公用变量，包括天涯下导航相关配置信息",
        useridInPage: null,
        mytitle: "我的E站通",
        blankHtml: a + "/js/_blank.html",
        bottomnav: {
            description: "下导航信息",
            mtyapp: null,
            defaultbarstatus: "on",
            url: {
                cnbo: a + "/#cnbo",
                homepage: a + "/home/space.php",
                csslink: b + "/css/mty_bottomnav.css",
                hp: a + "/home/space.php?do=home",
                myty: a,
                addApp: a + "/#app=set_app",
                addBlock: "/home/cp.php?ac=task",
                friend: a + "/home/space.php?do=friend",
                msg: a +"/home/space.php?do=pm",
                set: a + "/home/cp.php",                
                chat: "javascript:void(0)",
                getMsg: "http://global.51ezt.com/global/services/nav"
            },
            hint: {
                newblock: "常去版块有变动",
                newapp: "常去应用有变动",
                changeUser: "您已掉线，请重新登录！"
            },
            msgTime: 1000 * 60 * 3,
            shanshuoTime: 400,
            intervalID: null,
            statusTime: 1000,
            maxAppNum: 8,
            maxblockNum: 8,
            defaultmyapp: [[2, 3, 6], []],
            defaultmyblock: [],
            cookieapp: ""
        },			
        menulist: [[1, "talk", "快语"],[2, "talk1", "快语语快语快语快语快语"],[3, "talk1", "快语1快语快语快语快语"],[6, "talk1", "快语1快语快语快语快语"]],

        ob: {}
    };
    window.__g = window.__g || {};
    for (var d in c) {		
        window.__g[d] = c[d]
    }
})(); (function() {
    var ts = [];
    ts.push('<div id="bottom_nav" class="myty_comm" style="display:none">');
    ts.push('   <div class="wrap">');
    ts.push('       <div class="container" id="bottom_nav_container">');
    ts.push('   <iframe id="bottom_hackiframe" src="' + __g.blankHtml + '" frameborder="0" tabindex="-1"></iframe>');
    ts.push('           <div class="nav">');
    ts.push('               <ul class="cf bgmy">');
    ts.push('                   <li><a href="' + __g.bottomnav.url.hp + '" class="myicon">我的E站通</a></li>');
    ts.push('                   <li class="blankline"></li>');
    ts.push('                   <li id="bottomnav_tools" class="tools" style="display:none">');
    ts.push('                       <a href="' + __g.bottomnav.url.hp + '"  class="shortcut">首页</a>');
    ts.push('                       <a href="' + __g.bottomnav.url.homepage + '" class="shortcut" id="myhomepage">个人主页</a>');
    ts.push('                       <a href="' + __g.bottomnav.url.friend + '"  class="shortcut">好友</a>');
    ts.push('                       <a href="' + __g.bottomnav.url.msg + '"  target="_blank" class="nomsg" id="msgMenuItem1">消息</a>');
    ts.push('                       <a href="' + __g.bottomnav.url.set + '"  class="shortcut">设置</a>');
    ts.push('                   <span class="blankline fleft" id="bottomnav_line_1"></span>');
    ts.push("                   </li>");
    ts.push('                   <li id="bottomNavWrapper" style="display:"><a href="http://www.51ezt.com/bbs/viewthread.php?tid=1029"><img style="border:0px;margin-top:3px;margin-left:10px;" src="http://www.51ezt.com/Utility/nav/images/1.jpg" title="下载企发助手"></a></li>');
    ts.push('                   <li id="nav_close" ></li>');
    ts.push('                   <li class="myblock" id="bottomnav_myblockli" >');
    ts.push('                       <div class="popo cf" id="bottomnav_popomyblock"><div class="left1">' + __g.bottomnav.hint.newblock + '</div><div class="right1"></div></div>');
    ts.push('                       <ul class="myblockbox" id="bottomnav_myblockbox"></ul>');
    ts.push('                       <a href="' + __g.bottomnav.url.addBlock + '" id="bottomnav_myblock">版块收藏</a>');
    ts.push("                   </li>");
    ts.push('                   <li class="myapp" id="bottomnav_myappli" >');
    ts.push('                       <div class="popo cf" id="bottomnav_popomyapp"><div class="left1">' + __g.bottomnav.hint.newapp + '</div><div class="right1"></div></div>');
    ts.push('                       <ul class="myappbox" id="bottomnav_myappbox"></ul>');
    ts.push('                       <span id="bottomnav_myapp" style="color:#fff;cursor: hand;">每日任务 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;点击查看</span>');
    ts.push("                   sdsd</li>");
    ts.push('                   <li id="bottomnav_mycity" class="fright"></li>');
    ts.push('                   <li class="blankline fright" id="bottomnav_line_2"></li>');
    ts.push('                   <li id="bottomnav_myzongzi" class="fright" style="display:none"><div id="bottomnav_myzongzibox"></div></li>');
    ts.push("               </ul>");
    ts.push("           </div>");
    ts.push("       </div>");
    ts.push("   </div>");
    ts.push("</div>");
	
    var str = [];
    str.push('<div id="bottom_logo" class="myty_comm" style="display:none">');
    str.push('  <div class="wrap">');
    str.push('      <div class="container" id="bottom_logo_container">');
    str.push('          <div class="pos">');
    str.push('                   <div class="popo cf" id="bottomnav_popo"><div class="left1" id="bottomnav_popo_hint"></div><div class="right1"></div></div>');
    str.push('                  <iframe src="' + __g.blankHtml + '" frameborder="0" tabindex="-1" style="display:block;width:100%;position:absolute;z-index:-1;border:0;height:31px;top:-30px"></iframe>');
    str.push('                  <div id="nav_open" class="bar" >我的E站通</div>');
    str.push("          </div>");
    str.push("      </div>");
    str.push("  </div>");
    str.push("</div>");
    str.push('<div id="ty_addblock_window" style="display:none"><div>你收藏了该模块！</div></div>');
    var bottomnav_divstr = ts.join("") + str.join("");
    document.write(bottomnav_divstr); (function() {
       
		var comm = {
            navstatus: null,
            productPage: null,
            barwidth: 94,
            pagewidth: 950,
            shanshuoID: 0,
            popoID: 0,
            navbox: null,
            duanwusongli: false,
            duanwurq: false,
			_taskarr:null,
            $: function(str) {
                return document.getElementById(str)
            },
            isIE6: /MSIE 6.0/ig.test(navigator.appVersion),
            getStrLen: function(s) {
                var len = 0;
                for (var i = 0; i < s.length; i++) {
                    len += s.charCodeAt(i) > 128 ? 2 : 1
                }
                return len
            },
            getStrInLen: function(s, n) {
                var len = 0,
                dex = 0;
                for (var i = 0; i < s.length; i++) {
                    dex = i;
                    len += s.charCodeAt(i) > 128 ? 2 : 1;
                    if (len > n) {
                        break
                    }
                }
                return s.slice(0, dex)
            },
            isOnline: function() {
                //return __global.isOnline();
				if (comm.getCookie("username")!="")
				{
					return true;
				}else
					{
					return false;
				}
					

            },
            serialize2Str: function(ob) {
                return Object.serialize2Str(ob)
            },
            stopBubble: function(e) {
                if (e && e.stopPropagation && e.preventDefault) {
                    e.stopPropagation();
                    e.preventDefault()
                } else {
                    window.event.cancelBubble = true;
                    window.event.returnValue = false
                }
            },
            getCookie: function(name) {                
				var cookieValue = null;
				if (document.cookie && document.cookie != '') {
					var cookies = document.cookie.split(';');
					for (var i = 0; i < cookies.length; i++) {
						var cookie = cookies[i].replace(/(^\s*)|(\s*$)/g, "");
						if (cookie.substring(0, name.length + 1) == (name + '=')) {
							cookieValue = unescape(cookie.substring(name.length + 1));
							break;
						}
					}
				}
				return cookieValue;
            },
            setCookie: function(name, value, i) {
                this._setCookie(name, value, i, "/", ".51ezt.com", false);				

            },
			_setCookie: function(name, value, days, path, domain, secure) {
				var expires = -1;
				if (value == null) {
					var d = new Date();
					d.setTime(d.getTime() - (24 * 60 * 60 * 1000));
					expires = d.toGMTString();
				} else if ((typeof days == "number") && (days >= 0)) {
					var d = new Date();
					d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
					expires = d.toGMTString();
				}
				document.cookie = name + "=" + escape(value) + ";" + (expires != -1 ? " expires=" + expires + ";": "") + (path ? "path=" + path: "") + (domain ? "; domain=" + domain: "") + (secure ? "; secure": "");
			},
            setApptoCookie: function() {
				json_myallapp={"result":"1","error":"","data":{"app":"2,3,6;"}};
                var rs = window.json_myallapp || {};
                var am = [],
                sapp = "";
				
                if (rs.result && rs.data) {
                    sapp = rs.data.app
                }
				
                am[0] = comm.getUserId();
                if (sapp.indexOf(";") == -1) {
                    am[1] = __g.bottomnav.defaultmyapp[0].join(",");
                    am[2] = __g.bottomnav.defaultmyapp[1].join(",")
                } else {
                    am[1] = sapp.split(";")[0];
                    am[2] = sapp.split(";")[1]
                }
                am[3] = comm.$("bottom_nav").style.display != "none" ? "on": "off";
                comm.setCookie("mtyapp", am.join(";"), 1)
            },
            setBlocktoCookie: function() {
                var rs = window.json_block || {};
                var am = [],
                sblock = "";
                if (rs.result && rs.data) {
                    sblock = rs.data.item;
                    sblock = sblock.split(",").slice(0, __g.bottomnav.maxblockNum).join(",")
                }
                am[0] = comm.getUserId();
                if (!sblock) {
                    am[1] = __g.bottomnav.defaultmyblock
                } else {
                    am[1] = sblock
                }
                comm.setCookie("mtyblock", am.join(";"), 1)
            },
            getParam: function(s, m) {
                var os = (s || "").split("&");
                for (var i = 0; i < os.length; i++) {
                    var om = os[i].split("=");
                    if (om[0] == m) {
                        return om[1]
                    }
                }
                return ""
            },
            getUserId: function() {
                return this.getParam(this.getCookie("user"), "id")
            },
            getUserName: function() {
                return this.getParam(this.getCookie("user"), "w")
            },
            addNavcss: function() {
                if (__g.bottomnav.url.csslink) {
                    var csslink = document.createElement("link");
                    csslink.rel = "stylesheet";
                    csslink.type = "text/css";
                    csslink.charset = "utf-8";
                    csslink.href = __g.bottomnav.url.csslink;
                    document.getElementsByTagName("head")[0].appendChild(csslink)
                }
            },
            addHack4ie6: function() {               
				if (this.isIE6) {
                    //document.body.style.backgroundImage = "url(http://global.tianyaui.com/global/gnav/css/nothing.txt)";
                    document.body.style.backgroundAttachment = "fixed"
                }
            },
            getPageWidth: function() {
                var links = document.getElementsByTagName("link");
                
				for (var i = 0,
                end = links.length; i < end; i++) {
                    var href = links[i].href;
                    if (href.indexOf("nav.css") != -1) {
                        break
                    }
                    if (href.indexOf("nav_bbs.css") != -1) {
                        comm.pagewidth = 960;
                        comm.productPage = "bbs";
                        break
                    }
                }				
            },
            setPos: function() {
                var logocontainer = this.$("bottom_logo_container"),
                navcontainer = this.$("bottom_nav_container"),
                hackiframe = this.$("bottom_hackiframe"),
                cw = document.documentElement.clientWidth,
                nb = comm.barwidth,
                np = comm.pagewidth;
                if (!this.isIE6) {
                    if (cw > (np + nb * 2)) {
                        logocontainer.style.width = (np + nb * 2) + "px";
                        navcontainer.style.width = (np + nb * 2) + "px"
                    } else {
                        logocontainer.style.width = "100%";
                        navcontainer.style.width = "100%"
                    }
                    if (hackiframe) {
                        hackiframe.style.width = navcontainer.offsetWidth + "px"
                    }
                    return
                }
                if (cw > (np + nb * 2)) {
                    logocontainer.style.width = (np + nb * 2) + "px";
                    navcontainer.style.width = (np + nb * 2) + "px"
                } else {
                    if (cw < np) {
                        logocontainer.style.width = cw + "px";
                        navcontainer.style.width = cw + "px"
                    } else {
                        logocontainer.style.width = cw + "px";
                        navcontainer.style.width = cw + "px"
                    }
                }
                if (hackiframe) {
                    hackiframe.style.width = navcontainer.offsetWidth + "px"
                }
            },
            offLineHint: function() {
                window.clearInterval(__g.bottomnav.intervalID);
                window.location.reload()
            },
            setNavstatus: function(status) {
                var am = [],
                mtyapp = comm.getCookie("mtyapp");
                if (mtyapp) {
                    am = mtyapp.split(";")
                }
                am[3] = status;
                comm.setCookie("mtyapp", am.join(";"), 1)
            },
            openBar: function() {
                comm.$("bottom_nav").style.display = "block";
                comm.$("bottom_logo").style.display = "none";
                if (comm.productPage === "bbs" && comm.$("leftNav")) {
                    comm.$("leftNav").style.bottom = "31px"
                }
            },
            closeBar: function() {
                comm.$("bottom_nav").style.display = "none";
                comm.$("bottom_logo").style.display = "block";
                if (comm.productPage === "bbs" && comm.$("leftNav")) {
                    comm.$("leftNav").style.bottom = "0px"
                }
            },
            checkopen: function() {
                var am = [],
                mtyapp = comm.getCookie("mtyapp");
				
                if (mtyapp) {
                    am = mtyapp.split(";")
                }
                var s = am[3] || __g.bottomnav.defaultbarstatus;
               
				if (s == "on") {
                    this.openBar()
                } else {
                    this.closeBar()
                }				

            },
            checkStatus: function() {
                comm.checkopen();
                if (!comm.isOnline()) {
                    if (comm.navstatus !== "off") {
                        comm.$("bottomnav_tools").style.display = "none";
                        comm.$("bottomnav_line_1").style.display = "none";
                        comm.navstatus = "off";
                        if (location.href.indexOf("51ezt.com") != -1 && window.TUI) {
                            clearInterval(intervalStatusId);
                            TUI.hintOffline()
                        }
                    }
                    return
                }
                //comm.checkMsg();
                if (comm.navstatus !== "on") {
                    comm.$("bottomnav_myblockli").style.display = "block";
                    comm.$("bottomnav_tools").style.display = "block";
                    comm.$("bottomnav_myappli").style.display = "block";
                    comm.$("bottomnav_line_1").style.display = "block";
                    comm.navstatus = "on"
                }
				//隐藏“我的收藏”
				comm.$("bottomnav_myblockli").style.display = "none";
				comm.$("bottomnav_mycity").style.display = "none";
				//
                __g.useridInPage = comm.getUserId()
            },
            ioGet: function(url, data, fn) {
                if (!window.jQuery) {
                    return
                }
                jQuery.get(url, data,
                function(data) {
                    fn(data)
                })
            },
            ioJson: function(url, callback) {
                jQuery.ajax({
                    type: "GET",
                    url: url,
                    dataType: "script",
                    scriptCharset: "utf-8",
                    success: callback
                })
            },
            showMsgData: function() {
                var temp = null,
                nmsg = 0;
                try {
                    eval("temp=" + comm.getCookie("__msgvalue"))
                } catch(err) {}
                if (temp && temp.data && temp.data.message && temp.data.oi && temp.data.oi == comm.getUserId()) {
                    nmsg = +temp.data.message.mn
                }
                comm.setTitle(nmsg);
                if (nmsg == comm.__nmsg) {
                    return
                }
                if (isNaN(nmsg) || nmsg < 0) {
                    nmsg = 0
                }
                comm.__nmsg = nmsg;
                if (nmsg == 0) {
                    comm.$("msgMenuItem1").className = "nomsg";
                    if (comm.$("msgMenuItem1").innerHTML != "消息") {
                        comm.$("msgMenuItem1").innerHTML = "消息"
                    }
                    window.clearInterval(comm.shanshuoID);
                    if (comm.$("__newmsgdiv")) {
                        comm.$("__newmsgdiv").style.display = "none"
                    }
                } else {
                    if (comm.$("__newmsgdiv")) {
                        comm.$("__newmsgdiv").style.display = "block";
                        if (comm.$("__newmsg")) {
                            comm.$("__newmsg").innerHTML = nmsg + "条"
                        }
                    }
                    comm.$("msgMenuItem1").innerHTML = "消息<span>(" + nmsg + ")</span>";
                    if (comm.$("msgMenuItem1").className.indexOf("shanshuo") == -1) {
                        comm.shanshuoID = window.setInterval(function() {
                            if (comm.$("msgMenuItem1").className.indexOf("noshanshuo") == -1) {
                                comm.$("msgMenuItem1").className = "noshanshuo"
                            } else {
                                comm.$("msgMenuItem1").className = "shanshuo"
                            }
                        },
                        __g.bottomnav.shanshuoTime)
                    }
                }
            },
            setTitle: function(n) {
                if (window.__UIMYVERSION) {
                    var pre = n ? ("(" + n + "条新消息)") : "",
                    newtitle = pre + __g.mytitle;
                    if (document.title !== newtitle) {
                        document.title = newtitle
                    }
                }
            },
            clearMsgData: function() {               
				comm.setCookie("__msgvalue", null, -1);
                comm.showMsgData();
                comm.setTitle();
                window.clearInterval(comm.shanshuoID)
            },
            msgTimeout: function() {
                var __msgtime = comm.getCookie("__msgtime");
                if (!__msgtime || new Date() - new Date(__msgtime) > __g.bottomnav.msgTime) {
                    return true
                } else {
                    return false
                }
            },
            checkMsg: function() {
                if (comm.msgTimeout()) {
                    comm.setCookie("__msgtime", new Date(), -1);
                    var url = __g.bottomnav.url.getMsg + "?t=message&ui=" + comm.getUserId() + "&un=" + encodeURIComponent(comm.getUserName());
                    jQuery.ajax({
                        type: "GET",
                        url: url,
                        dataType: "script",
                        scriptCharset: "utf-8",
                        success: function() {
                            comm.setCookie("__msgvalue", comm.serialize2Str(MenuUtil.msgRequestData), -1);
                            comm.showMsgData()
                        }
                    })
                } else {
                    comm.showMsgData()
                }
            },
            setTools: function() {},
            setOpacity: function(obj, opacity) {
                if (navigator.userAgent.indexOf("MSIE") != -1) {
                    obj.style.filter = "alpha(opacity=" + opacity + ")"
                } else {
                    obj.style.opacity = opacity / 100
                }
            },
            getOpacity: function(obj) {
                if (navigator.userAgent.indexOf("MSIE") != -1) {
                    return parseInt(obj.filters.alpha.opacity)
                } else {
                    return 100 * parseFloat(obj.style.opacity)
                }
            },
            hintMyapp: function(show) {
                var dom;
                if (comm.$("bottom_nav").style.display != "none") {
                    dom = comm.$("bottomnav_popomyapp")
                } else {
                    dom = comm.$("bottomnav_popo");
                    comm.$("bottomnav_popo_hint").innerHTML = __g.bottomnav.hint.newapp
                }
                dom.style.display = "block";
                comm.setOpacity(dom, 100);
                setTimeout(function() {
                    window.clearInterval(comm.popoID);
                    comm.popoID = window.setInterval(function() {
                        var opacity = comm.getOpacity(dom);
                        if (opacity < 0) {
                            window.clearInterval(comm.popoID);
                            dom.style.display = "none"
                        } else {
                            comm.setOpacity(dom, opacity - 10)
                        }
                    },
                    100)
                },
                3000)
            },
            hintMyblock: function(show) {
                var dom;
                if (comm.$("bottom_nav").style.display != "none") {
                    dom = comm.$("bottomnav_popomyblock")
                } else {
                    dom = comm.$("bottomnav_popo");
                    comm.$("bottomnav_popo_hint").innerHTML = __g.bottomnav.hint.newblock
                }
                dom.style.display = "block";
                comm.setOpacity(dom, 100);
                setTimeout(function() {
                    window.clearInterval(comm.popoID);
                    comm.popoID = window.setInterval(function() {
                        var opacity = comm.getOpacity(dom);
                        if (opacity < 0) {
                            window.clearInterval(comm.popoID);
                            dom.style.display = "none"
                        } else {
                            comm.setOpacity(dom, opacity - 10)
                        }
                    },
                    100)
                },
                3000)
            },
            showAddblockbutton: function() {
                var odiv = comm.$("my_add2myblock");
                if (!odiv) {
                    return
                }
                var blockid = odiv.getAttribute("blockid");
                var aBlocks = __g.aBlocks;
                if (blockid) {
                    for (var i = 0,
                    end = aBlocks.length; i < end; i++) {
                        var fat = aBlocks[i];
                        if (fat[2] == blockid) {
                            comm.setAddblockbutton(blockid);
                            break
                        }
                    }
                }
            },
            setAddblockbutton: function(blockid) {
				//取消“收藏功能”
				return;
                var e = "#TB_inline?height=125&width=250&inlineId=ty_addblock_window";
                var showhint = function() {
                    var mtyblock = comm.getCookie("mtyblock");
                    var hint = '<div class="my-block-add"></div>';
                    if (mtyblock && mtyblock.indexOf(";") != -1) {
                        for (var i = 0,
                        blocks = mtyblock.split(";")[1].split(","); i < blocks.length; i++) {
                            if (blocks[i] == blockid && comm.isOnline()) {
                                hint = '<div class="my-block-done"></div>';
                                comm.$("my_add2myblock").setAttribute("sadd", "add");
                                break
                            }
                        }
                    } else {
                        return
                    }
					
                    comm.$("my_add2myblock").style.display = "block";
                    comm.$("my_add2myblock").innerHTML = hint;
                    comm.$("my_add2myblock").onclick = function() {
                        if (!comm.isOnline()) {
                            MenuUtil.login("该功能需要登录后才能使用", window.location.href, window.location.href);
                            return
                        }
                        var mtyblock = comm.getCookie("mtyblock");
                        var myblocks = mtyblock.split(";")[1].split(",");
                        if (this.getAttribute("sadd") == "add") {
                            if (comm.$("TB_window") && comm.$("TB_window").style.display == "block") {
                                return
                            }
                            return
                        }
                        if (myblocks.length >= __g.bottomnav.maxblockNum) {
                            if (comm.$("TB_window") && comm.$("TB_window").style.display == "block") {
                                return
                            }
                            comm.$("ty_addblock_window").innerHTML = '<div id="ty_addblock_body"><p class="c1">对不起，您最多只能收藏8个版块哦~ :)</p><p class="c2">您可以去<a href="http://my.51ezt.com/#app=myblock">版块收藏</a>删除不需要的版块。</p><div class="c3" onclick="tb_remove()">确定</div></div>';
                            tb_show("提示", e);
                            return
                        }
                        if (comm.$("TB_window") && comm.$("TB_window").style.display == "block") {
                            return
                        }
                        myblocks.push(blockid);
                        var sk = myblocks.join(",");
                        comm.ioJson(__g.PREMY + "/interface/user/collectBlock.jsp?act=setblockbyjson&varname=__rssetblock&blockid=" + sk + "&random=" + Math.random(),
                        function() {
                            if (window.__rssetblock) {
                                window.json_block = __rssetblock;
                                comm.$("my_add2myblock").innerHTML = '<div class="my-block-done"></div>';
                                comm.$("my_add2myblock").setAttribute("sadd", "add");
                                comm.setBlocktoCookie();
                                comm.hintMyblock()
                            }
                        })
                    }
                };
                var mtyblock = comm.getCookie("mtyblock");
                if (!mtyblock || mtyblock.indexOf(";") == -1 || mtyblock.split(";")[0] != comm.getUserId()) {
                    comm.ioJson(__g.PREMY + "/interface/user/collectBlock.jsp?act=getblockbyjson&random=" + Math.random(),
                    function() {
                        comm.setBlocktoCookie();
                        showhint(blockid)
                    })
                } else {
                    showhint(blockid)
                }
            },
			//点击显示
            listenMyapp: function() {
                comm.$("bottomnav_myapp").onclick = function(e) {
                   
					if (comm.isIE6) {
                        this.blur()
                    }
					
                    comm.stopBubble(e);
                    comm.setNavBox("myapp")
                };
                comm.$("bottomnav_myappbox").onclick = function(e) {
                  
					comm.setNavBox("myapp")
                }
            },
            listenBlock: function() {
                comm.$("bottomnav_myapp").onclick = function(e) {
                    if (comm.isIE6) {
                        this.blur()
                    }
                    comm.stopBubble(e);
                    comm.setNavBox("myapp")
                };
                comm.$("bottomnav_myblock").onclick = function(e) {
                    if (comm.isIE6) {
                        this.blur()
                    }
                    comm.stopBubble(e);
                    comm.setNavBox("myblock")
                }
            },
            setNavBox: function(nav) {
              
				if (comm.navbox == nav) {
                    comm.navbox = null;
                    comm.showNavBox(nav, false)
                } else {
					
                    comm.showNavBox(comm.navbox, false);
                    comm.navbox = nav;
                    comm.showNavBox(nav, true)
                }
            },
            showNavBox: function(nav, show) {
               
				if (show && !comm.isOnline()) {
                    //MenuUtil.login("该功能需要登录后才能使用", window.location.href, window.location.href);
                    //return
                }
				
                switch (nav) {
                case "myapp":
                    if (show) {
                        comm.$("bottomnav_myappli").className = "myapp_show";
                        comm.$("bottomnav_myappbox").innerHTML = "<li>正在读取数据...</li>";
						if (comm._taskarr==null)
						{
							
							
							comm.ioJson("http://www.51ezt.com/passport/utility/getusertask.asp?ur="+comm.getCookie("username"),
                            function() {                              
								comm.showTask(window.json_myallapp);
								
                                if (comm.$("bottomnav_myappbox").style.display != "none") {
                                    
									//comm.showNavBox("myapp", true)
                                }
                            })			

						}else{
						
							comm.showTask(comm._taskarr);
						
						}									
						
						return;
                        
                    } else {
                        comm.$("bottomnav_myappli").className = "myapp"
                    }
                    break;
                case "myblock":
                    if (show) {
                        comm.$("bottomnav_myblockli").className = "myblock_show";
                        comm.$("bottomnav_myblockbox").innerHTML = "<li>正在读取..</li>";
                        var mtyblock = comm.getCookie("mtyblock");
                        if (!mtyblock || mtyblock.indexOf(";") == -1 || mtyblock.split(";")[0] != comm.getUserId()) {
                            comm.ioJson(__g.PREMY + "/interface/user/collectBlock.jsp?act=getblockbyjson&random=" + Math.random(),
                            function() {
                                comm.setBlocktoCookie();
                                if (comm.$("bottomnav_myblockbox").style.display != "none") {
                                    comm.showNavBox("myblock", true)
                                }
                            })
                        } else {
                            __g.bottomnav.cookieblock = mtyblock;
                            var ah = [],
                            nblocks = 0,
                            nMAXBLOCKS = __g.bottomnav.maxblockNum,
                            gblock = mtyblock.split(";")[1].split(","),
                            nlen = gblock.length,
                            aBlocks = __g.aBlocks;
                            for (var i = 0; i < nlen; i++) {
                                var fat = gblock[i];
                                nblocks++;
                                if (nblocks > nMAXBLOCKS) {
                                    break
                                }
                                for (var j = 0,
                                nbend = aBlocks.length; j < nbend; j++) {
                                    var sb = aBlocks[j];
                                    if (sb[2] == fat) {
                                        ah.push('<li><a href="' + comm.getBlocklink(fat) + '" >' + sb[3] + "</a></li>");
                                        break
                                    }
                                }
                            }
                            var ahtml = ah.join("") + '<li class="add"><a href="' + __g.bottomnav.url.addBlock + '">' + (ah.length == 0 ? "添加": "管理") + "&#62;&#62;</a></li>";
                            comm.$("bottomnav_myblockbox").innerHTML = ahtml
                        }
                    } else {
                        comm.$("bottomnav_myblockli").className = "myblock"
                    }
                    break
                }
            },
			showTask:function(taskarr){
				comm._taskarr=taskarr;
				var ah = [];
				taskarr=taskarr.split(",");
				for (var i=0;i<taskarr.length;i++ )
				{
					if (taskarr[i].indexOf("|")>0)
					{
					
						taskItemArr=taskarr[i].split("|");					
						if (taskItemArr[2]==1)
						{
							if (taskItemArr[5]==1){
								alertWord="完成任务";
							}else 
								alertWord="<a href=http://www.51ezt.com/home/cp.php?ac=task&taskid="+taskItemArr[0]+" >领取奖励</a>";
						}else
							alertWord='<strong style=" color:red;">'+taskItemArr[3]+'</strong>/'+taskItemArr[4];

						ah.push('<li><a href="http://www.51ezt.com/home/cp.php?ac=task&taskid=' + taskItemArr[0] + '"  title="' + taskItemArr[1] + '"><strong style=font-size:14px>' + taskItemArr[1] + '</strong></a><br>奖励积分：'+taskItemArr[6]+' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>任务进度：</b>'+alertWord+'</li>');
					}

				}

				 var ahtml = ah.join("") + '<li class="add"><a href="' + __g.bottomnav.url.addBlock + '">' + (ah.length == 0 ? "更多任务": "更多任务") + "&#62;&#62;</a></li>";
				
                  comm.$("bottomnav_myappbox").innerHTML = ahtml;

			},
            ArrayIndexOf: function(array, el) {
                for (var i = 0,
                end = array.length; i < end; i++) {
                    if (array[i] == el) {
                        return true
                    }
                }
                return false
            },
            getBlocklink: function(id) {
                var sHttp = "",
                sTpStr = "",
                sLink = "?";
                for (var i = 0,
                end = __g.aBlocks.length; i < end; i++) {
                    var blk = __g.aBlocks[i];
                    if (blk[2] == id) {
                        sHttp = blk[1] == 2 ? "http://bbs.city.51ezt.com/": "http://www.51ezt.com/";
                        sTpStr = blk[1] == 0 ? "publicforum": (blk[1] == 1 ? "techforum": "tianyacity");
                        sLink = sHttp + sTpStr + "/articleslist/0/" + blk[2] + ".shtml";
                        break
                    }
                }
                return sLink
            },
            showmycity: function() {
				return;
                /*
				var cityName = __global.getUserCityName();
                if (cityName == null) {
                    cityName = "我的城市"
                }*/
                comm.$("bottomnav_mycity").innerHTML = '<a href="http://bulletin.51ezt.com/CheckUserIPCityURL_v2.asp"><img scr="images/1.jpg"></a>';
				
            },       
            
            init: function() {
				
				
                comm.getPageWidth();
                comm.addHack4ie6();
				//改变窗体大小 随变
                window.onresize = function() {
                    comm.setPos()
                };
                comm.$("nav_close").onclick = function() {
                    comm.closeBar();
                    comm.setNavstatus("off")
                };
                comm.$("nav_open").onclick = function() {
                    comm.openBar();
                    comm.setNavstatus("on")
                };
                comm.$("msgMenuItem1").onclick = function(e) {
                    if (comm.isIE6) {
                        this.blur()
                    }
                    //comm.clearMsgData()
                };
                comm.setTools();
                __g.useridInPage = comm.getUserId();
                comm.$("myhomepage").href = __g.bottomnav.url.homepage + comm.getUserId();
                comm.listenMyapp();				
                comm.listenBlock();
				//执行显示
                comm.checkStatus();
				
                comm.setPos();
                //comm.showmycity();
				
                jQuery(document).click(function() {
                    comm.setNavBox()
                });
                jQuery(document).ready(function() {
                    //comm.showAddblockbutton()
                });
                window.intervalStatusId = setInterval(function() {
                    comm.checkStatus()
                },
                __g.bottomnav.statusTime);
                window.flushbottomnav = comm.checkStatus;
                window.__hintMyapp = comm.hintMyapp;
                //window.__hintMyblock = comm.hintMyblock;
                window.__toolbar = comm;
				comm.setNavBox("myapp");
			
            }
        };
        comm.init()
    })();
    if (!window.jQuery) {
        return
    }
    jQuery(document).ready(function() {
        if (document.getElementById("leftNav") != null) {
            var ua = navigator.userAgent.toLowerCase();
            var ieVersion = ua.match(/msie ([\d.]+)/) ? ua.match(/msie ([\d.]+)/)[1] : 0;
            var isMaxthon = ua.indexOf("maxthon") >= 0;
            if (jQuery.browser.msie && ieVersion < 7 && isMaxthon && external.max_version.indexOf("1.6.") == 0) {
                jQuery("head:first").append('<link href="http://global.51ezt.com/global/gnav/css/global.css" rel="stylesheet" type="text/css" />');
                jQuery.ajax({
                    type: "GET",
                    url: "http://global.51ezt.com/global/gnav/js/jtip.js",
                    dataType: "script",
                    scriptCharset: "utf-8",
                    success: function() {
                        try {
                            jQuery("body:first").append('<div id="ty_left_tips" style="display:none;"><p>&nbsp;您使用的遨游浏览器版本较低，其“广告猎手”功能可能会将左导航误当成是广告而屏蔽，建议升级到<a href="http://www.maxthon.cn/download.htm" title="点击这里到傲游官方下载页" target="_blank"><font  class="red">遨游2.0</font></a>以上的版本，或者关闭广告猎手功能。</p></div>');
                            TY_showTips("ty_left_tips", "nav_forum_link", "maxthon_tips")
                        } catch(err) {}
                    }
                })
            }
        }
    })
})();
