 var customerid =0;
document.write("<link href=\"http://image.yesky.com/TLimages/chinabyte/includes/cbtop_zhuanti_090805.css\" type=\"text/css\" rel=\"stylesheet\" media=\"all\" />");
document.write("<div id=\"__cb_top\"><div id=\"CB_t\"><div class=\"login_sites\" id=\"login_bar\"><div class=\"denglu\"><span class=\"mg_2 index_link\"><a href=\"http://www.chinabyte.com/\">比特首页</a> | </span>");
/*document.write("<script type=\"text/javascript\" src=\"http://passport.chinabyte.com/cas/bar/bar20.jsp\"></script>");*/


					function $(id){return document.getElementById(id)}	
					var url = document.location.href;
					var t_loginHTML = "";
					if(pinCookie()!=null)
				   {
					 if(url.indexOf("ticket") > -1) url= url.substring(0,url.indexOf("ticket"));
					 if(url.indexOf("?")==url.length-1) url= url.substring(0,url.indexOf("?"));
					 document.writeln(" <div id=\"t_login_arrow\"><\/div><div class=\"t_logined\">欢迎<a href=\"http://passport.chinabyte.com/jsp/newcb/cbsys_pass.jsp\"><b><font color=\"#005a98\">"+getCookie(findNickCookie)+"<\/font><\/b><\/a> (<a href=\"javascript:void(0)\" id=\"t_open_link\" class=\"t_mycb_close\" onclick=\"t_hideMyCB()\" target=\"_self\">收起<\/a>) 登录！　<a href=\"http://passport.chinabyte.com/cas/logout?service="+url+"\" target=\"_self\">退出登录<\/a><\/div>");
				   }else{
					t_loginHTML += "<form action=\"http:\/\/passport.chinabyte.com\/cas\/login?service=http:\/\/passport.chinabyte.com\/jsp\/newcb\/cbsys_index.jsp\" name=\"cb_top_login\" method=\"post\" id=\"login_form\" target=\"_blank\" onsubmit=\"window.location.reload();return true;\">";
t_loginHTML += "                    <span class=\"mg_2\">用户名<\/span><input type=\"text\" name=\"username\" class=\"cb_top_input mg_1\"\/>";
t_loginHTML += "                    <span class=\"mg_2\">　密码<\/span><input type=\"password\" name=\"password\" class=\"cb_top_input mg_1\"\/>";
t_loginHTML += "                    <div class=\"selectLoginSite\"style=\"line-height:15px\">";
t_loginHTML += "                    	<div class=\"loginSiteName\" id=\"loginSiteName\">通行证<\/div>";
t_loginHTML += "                        <div class=\"selectLoginSiteBtn\" onclick=\"showlayer(\'loginSiteNameList\')\" id=\"selectLoginSiteBtn\" ><\/div>";
t_loginHTML += "                        <ul class=\"loginSiteNameList\" id=\"loginSiteNameList\">";
t_loginHTML += "                        	<li><span rel=\"http:\/\/blog.chinabyte.com\/\" name=\"博客\"><a href=\"javascript:void(0)\" target=\"_self\">博客<\/a><\/span><\/li>";
t_loginHTML += "                            <li><span rel=\"http:\/\/bbs.chinabyte.com\/\" name=\"论坛\"><a href=\"javascript:void(0)\" target=\"_self\" >论坛<\/a><\/span><\/li>";
t_loginHTML += "                            <li><span rel=\"http:\/\/eblog.chinabyte.com\/\" name=\"企业博客\"><a href=\"javascript:void(0)\" target=\"_self\">企业博客<\/a><\/span><\/li>";
t_loginHTML += "                            <li><span rel=\"http:\/\/my.chinabyte.com\/\" name=\"比特邦\"><a href=\"javascript:void(0)\" target=\"_self\">比特邦<\/a><\/span><\/li>";
t_loginHTML += "                            <li><span rel=\"http:\/\/passport.chinabyte.com\/jsp\/newcb\/cbsys_index.jsp\" name=\"通行证\"><a href=\"javascript:void(0)\" target=\"_self\">通行证<\/a><\/span><\/li>";
t_loginHTML += "                        <\/ul>";
t_loginHTML += "                    <\/div>";
t_loginHTML += "                    <input type=\"submit\" class=\"cb_top_submit mg_1\" value=\"登录\"\/>";
t_loginHTML += "                    <input name=\"type\" type=\"hidden\" value=\"1\">";
t_loginHTML += "                    <span class=\"mg_2\">&nbsp;<a href=\"http:\/\/passport.chinabyte.com\/jsp\/newcb\/cbsys_login_i.jsp\">新用户注册<\/a><\/span>";
t_loginHTML += "                <\/form>";
					document.write(t_loginHTML);
					var login_form = $("login_form");
					var t_sel_loginSie_spans = $("loginSiteNameList").getElementsByTagName("span");
					var t_sel_loginSie_spans_length = t_sel_loginSie_spans.length;
					for(var i = 0;i<t_sel_loginSie_spans_length;i++){
						t_sel_loginSie_spans[i].onmousedown = function(){$("loginSiteName").innerHTML = this.getAttribute("name");
																		relValue = this.getAttribute("rel");
																		login_form.setAttribute("action","http://passport.chinabyte.com\/cas\/login?service=" + relValue);
																		hidelayer('loginSiteNameList');
																		};
									}
					}

            document.write("</div><div class=\"t_article_search\"><form name=\"search\"  action=\"http://search.chinabyte.com/search.do\" target=\"_blank\"  id=\"top_search\"><input type=\"text\" name=\"wd\" class=\"cb_top_aritcleSearch_input mg_1\" /><input type=\"submit\" class=\"cb_top_aritcleSearch_submit mg_1\" value=\"比特搜索\" /></form></div></div>");
        
        document.write("<div class=\"t_menu_wrapper\"><div class=\"zt_top_logo\"><a href=\"http://www.chinabyte.com/\"><img src=\"http://image.yesky.com/TLimages/chinabyte/images/top_zt.gif\" alt=\"比特首页\"/></a></div><div class=\"zt_menu_r\"><a href=\"http://www.chinabyte.com/\" target=\"_blank\">首页</a>|<a href=\"http://news.chinabyte.com/\" target=\"_blank\">新闻中心</a>|<a href=\"http://e.chinabyte.com/\" target=\"_blank\">企业采购</a>|<a href=\"http://info.chinabyte.com/\" target=\"_blank\">信息化</a>|<a href=\"http://www.chinabyte.com/video/\" target=\"_blank\">视频访谈</a>|<a href=\"http://www.chinabyte.com/ztzh/\" target=\"_blank\">专题汇总</a>|<a href=\"http://www.chinabyte.com/wendao/\" target=\"_blank\">比特问道</a>|<a href=\"http://cio.chinabyte.com/forum/\" target=\"_blank\">百家讲坛</a>|<a href=\"http://do.chinabyte.com/\" target=\"_blank\">行业</a>&nbsp;&nbsp;</div>");
 		document.write("</div></div></div>");            

		var myCbWrapper = $("myCbWrapper");
		var t_open_link = $("t_open_link");
		var t_login_arrow = $("t_login_arrow");
		if(customerid!=0){
			myCbWrapper.style.height = "50px";
			$("t_mychinabyte").style.display = "block"
		}
		var t_MyCBInterval = null;
		function t_showMyCB(){
			clearInterval(t_MyCBInterval);
			if(parseInt(myCbWrapper.style.height) <= 0) myCbWrapper.style.height = "0px";
			if(parseInt(myCbWrapper.style.height) < 50) t_MyCBInterval = setInterval("t_heightAdd()",5);
			t_open_link.className = "t_mycb_close";
			t_open_link.onclick = t_hideMyCB;
			t_open_link.innerHTML = "收起";
		}
		function t_hideMyCB(){
			clearInterval(t_MyCBInterval);
			if(parseInt(myCbWrapper.style.height) > 0) t_MyCBInterval = setInterval("t_heightLess()",5);
			t_open_link.className = "t_mycb_open";
			t_open_link.onclick = t_showMyCB;
			t_open_link.innerHTML = "展开";
		}
		function t_heightAdd(){
			myCbWrapper.style.height = parseInt(myCbWrapper.style.height) + 5 +"px";
			if(parseInt(myCbWrapper.style.height) >= 50) { clearInterval(t_MyCBInterval); t_login_arrow.style.backgroundPosition = "-168px -27px"; }
		}
		function t_heightLess(){
			myCbWrapper.style.height = parseInt(myCbWrapper.style.height) - 5 +"px";
			if(parseInt(myCbWrapper.style.height) <= 0) {clearInterval(t_MyCBInterval); t_login_arrow.style.backgroundPosition = "-166px -48px"; }
		}

/* 浮动层显示及隐藏 */
var index = new Object();
index.openlayer = null;//记录页面内已显示层的id
document.onmousedown = function(){
	if (index.openlayer != null) $(index.openlayer).style.display = "none";
	index.openlayer = null;
}

function showSub(id){
	$(id).style.display = "block";
}
function hideSub(id){
	$(id).style.display = "none";
}
function stopBubble(e){
	if(e && e.stopPropagation){
		e.stopPropagation();
	}else{
		window.event.cancelBubble = true;
	}
}
/* 显示层并向全局注册 */
function showlayer(id){
	showSub(id);
	if(index.openlayer != null && index.openlayer != id) hidelayer(index.openlayer);
	index.openlayer = id;
	$(id).onmousedown = function(e){
		stopBubble(e);
	}
}
function hidelayer(id){
	hideSub(id);
	index.openlayer = null;
	$(id).onmousedown = null;
}

        
   var Base64 = function() {
}
Base64.encodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
Base64.decodeChars = new Array(- 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 62, - 1, - 1, - 1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 1, - 1, - 1, - 1, - 1, - 1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 1, - 1, - 1, - 1, - 1);
Base64.encode = function(str)
{
    var out, i, len;
    var c1, c2, c3;

    len = str.length;
    i = 0;
    out = "";
    while (i < len)
    {
        c1 = str.charCodeAt(i++) & 0xff;
        if (i == len)
        {
            out += Base64.encodeChars.charAt(c1 >> 2);
            out += Base64.encodeChars.charAt((c1 & 0x3) << 4);
            out += "==";
            break;
        }
        c2 = str.charCodeAt(i++);
        if (i == len)
        {
            out += Base64.encodeChars.charAt(c1 >> 2);
            out += Base64.encodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0)
                    >> 4));
            out += Base64.encodeChars.charAt((c2 & 0xF) << 2);
            out += "=";
            break;
        }
        c3 = str.charCodeAt(i++);
        out += Base64.encodeChars.charAt(c1 >> 2);
        out += Base64.encodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4))
                ;
        out += Base64.encodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6))
                ;
        out += Base64.encodeChars.charAt(c3 & 0x3F);
    }
    return out;
}

Base64.decode = function(str)
{
    var c1, c2, c3, c4;
    var i, len, out;

    len = str.length;
    i = 0;
    out = "";
    while (i < len)
    {
        /* c1 */
        do
        {
            c1 = Base64.decodeChars[str.charCodeAt(i++) & 0xff];
        }
        while (i < len && c1 == - 1);
        if (c1 == - 1)
            break;

        /* c2 */
        do
        {
            c2 = Base64.decodeChars[str.charCodeAt(i++) & 0xff];
        }
        while (i < len && c2 == - 1);
        if (c2 == - 1)
            break;

        out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));

        /* c3 */
        do
        {
            c3 = str.charCodeAt(i++) & 0xff;
            if (c3 == 61)
                return out;
            c3 = Base64.decodeChars[c3];
        }
        while (i < len && c3 == - 1);
        if (c3 == - 1)
            break;

        out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));

        /* c4 */
        do
        {
            c4 = str.charCodeAt(i++) & 0xff;
            if (c4 == 61)
                return out;
            c4 = Base64.decodeChars[c4];
        }
        while (i < len && c4 == - 1);
        if (c4 == - 1)
            break;
        out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
    }
    return out;
}

Base64.utf16to8 = function(str)
{
    var out, i, len, c;

    out = "";
    len = str.length;
    for (i = 0; i < len; i++)
    {
        c = str.charCodeAt(i);
        if ((c >= 0x0001) && (c <= 0x007F))
        {
            out += str.charAt(i);
        }
        else if (c > 0x07FF)
        {
            out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
            out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
            out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
        }
        else
        {
            out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
            out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
        }
    }
    return out;
}

Base64.utf8to16 = function(str)
{
    var out, i, len, c;
    var char2, char3;

    out = "";
    len = str.length;
    i = 0;
    while (i < len)
    {
        c = str.charCodeAt(i++);
        switch (c >> 4)
                {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            // 0xxxxxxx
                out += str.charAt(i - 1);
                break;
            case 12:
            case 13:
            // 110x xxxx   10xx xxxx
                char2 = str.charCodeAt(i++);
                out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
                break;
            case 14:
            // 1110 xxxx  10xx xxxx  10xx xxxx
                char2 = str.charCodeAt(i++);
                char3 = str.charCodeAt(i++);
                out += String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F)
                        << 6) | ((char3 & 0x3F) << 0));
                break;
        }
    }

    return out;
}


function getCookie(name) //取cookies函数
{
    var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
    if (arr != null) return unescape(Base64.decode(arr[2].toString()));
    //if(arr != null) return Base64.decode(unescape(arr[2]));
    return null;
}

var findInfoCookie = "my_tmggroup_info_ck";
//pin&sex
var findNickCookie = "my_tmggroup_nick_ck";
//nickname

function pinCookie() {
    var pin = null;
    var start = "up=";
    var info = getCookie(findInfoCookie);
    if (info != null) {
        if (info.indexOf("&") != -1) {
            pin = info.substring(start.length, info.indexOf("&"));
        }
    }
    return pin;
}
function uidCookie() {
    var uid = null;
    var start = "uid=";
    var info = getCookie(findInfoCookie);
    //alert(info);
    if (info != null) {
        if (info.indexOf(start) != -1) {
            uid = info.substring(info.indexOf(start)+start.length, info.length);
        }
    }
    return uid;
}

/**
 sex 对应值
 0未知
 1保密
 2男
 3女
 */
function sexCookie() {
    var sex = null;
    var start = "sex=";
    var info = getCookie(findInfoCookie);
    if (info != null) {
        if (info.indexOf(start) != -1) {
            sex = info.substring(info.indexOf(start) + start.length, info.length);
            if (sex == "0") sex = "未知";
            if (sex == "1") sex = "保密";
            if (sex == "2") sex = "男";
            if (sex == "3") sex = "女";
        }
    }
    document.getElementById("sex").innerHTML = sex;
    //return sex;
}
function nickCookie() {
    document.getElementById("nick").innerHTML = getCookie(findNickCookie);

}

function nickCookieValue() {
    document.getElementById("nick").value = getCookie(findNickCookie);

}



	
      	
