function DecodeCookie(str){
		var strArr;
		var strRtn="";
		strArr=str.split("O");
		for (var i=strArr.length-1;i>=0;i--) 
		strRtn+=String.fromCharCode(eval(strArr[i]));
	return strRtn;
}

function getMopidFromCookie() {
	var id = 0;
	var allcookie = document.cookie.split('; ');
	for(var i=0;i<allcookie.length;i++){
		var cookiename = allcookie[i].split('=')[0];
		if(cookiename=='mop_logon'){
			var value = unescape(allcookie[i].split('=')[1]);
			var tmp = value.split("|");
			id = parseInt(tmp[0]);
		}
	}
	return id;
}


var nickname = "";
var loginTimes = '';
var mp = '';
var mm = '';
var status = '';
var allcookie = document.cookie.split('; ');

for(var i=0;i<allcookie.length;i++){
		var cookiename = allcookie[i].split('=')[0];
		if(cookiename == 'mop_status'){
			var tmpString = unescape(allcookie[i].split('=')[1]);
			status = DecodeCookie(tmpString);
			status = status.replace('?','O').replace('?','O').replace('?','O');
			try
			{
				var stat = status.split("|");
				nickname = stat[0];
				loginTimes = stat[7];
				mp = stat[2];
				mm = stat[3];
			}
			catch (e) {
			}
		}
	}

//document.writeln("<script type=\"text\/javascript\" src=\"http:\/\/share.hi.mop.com\/app\/hiuserinfo.jsp\"><\/script>");
document.writeln("<style>");
document.writeln("<!--");
document.writeln("");
document.writeln("\/*top*\/");
document.writeln("");
document.writeln("#banner_wai{width:835px;top:0;left:0;height:26px;background:#f1f1f3;border-bottom:1px solid #727272;border-top:1px solid #fff;font-family: \"Tahoma\", \"宋体\";}");
document.writeln("#banner{width:820px;margin:0 auto;padding-top:2px;text-align:left;font-family: \"Tahoma\", \"宋体\";}");
//document.writeln("#banner .vmiddle{vertical-align:middle;}");
document.writeln("#banner .vmiddle{vertical-align:middle;font-size:12px;}");
document.writeln("#banner a {color:#3566a9; text-decoration:none;}");
document.writeln("#banner .inputk{width:100px;border:1px solid #ccc;font-size:12px;}");
document.writeln("");
document.writeln("#banner .loged{width:115px;position:relative;padding:0 5px;}");
document.writeln("#banner .loged h3{padding-left:5px;margin:0;font-size:12px;font-weight:normal;font-family: \"Tahoma\", \"宋体\";}");
document.writeln("#banner .loged img{padding-left:5px; vertical-align:middle;padding-top:3px; cursor:pointer;}");
document.writeln("#banner .loged_open{width:113px;padding:5px;position:absolute;border:solid #d1d1d1;border-width:0 1px 1px;background:#fff;top:-6px;left:0;}");
document.writeln("#banner .loged_open h4{margin:0;padding-left:5px;font-size:12px;font-weight:normal;border-bottom:1px solid #d9d9d9;padding-bottom:7px;}");
document.writeln("#banner .loged_open img{padding-left:5px; vertical-align:middle;padding-top:3px; cursor:pointer;}");
document.writeln("#banner .loged_open .mess{line-height:23px;color:#3566ab;padding:4px;}");
document.writeln("#banner .tslink a{ background:url(http:\/\/image2.mop.com\/mop\/index2009\/images\/c.gif) no-repeat 0 5px;padding:0 12px 0 7px;}");
document.writeln("*+html #banner .tslink a{ background:url(http:\/\/image2.mop.com\/mop\/index2009\/images\/c.gif) no-repeat 0 4px;}")
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("-->");
document.writeln("<\/style>")



var iOk = false;
if(typeof(Hi_USER) != 'undefined') {
	iOk = true;
}	

function subStr(str,length){
	var a=str.match(/[^\x00-\xff]|\w{1,2}/g);
	return a.length<length?str:a.slice(0,length).join("")+"..";
}

//document.writeln("<form name=login onSubmit=\"document.charset=\'gb2312\'; return CheckForm();\" accept-charset=\"gb2312\" action=\"http:\/\/passport.mop.com\/Login?url="+document.location.href+"\" method=\"post\">");
document.writeln("<form name=login onSubmit=\"document.charset=\'gb2312\'; return CheckForm();\" accept-charset=\"gb2312\" action=\"http:\/\/passport.mop.com\/Login?url=http://tt.mop.com\" target='_top' method=\"post\">");
if(nickname != "") {

	//处理一下用户名，如果超长，就截掉
	var name_display = subStr(nickname, 6);
	
	var mopid = getMopidFromCookie();
	document.writeln("<div id=\"banner_wai\" style=\"display:block;z-index:99999999;\">");
	document.writeln("	<div id=\"banner\" style=\"padding-top:1px;z-index:99999999;\">");
	document.writeln("   	  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
	document.writeln("      	<tr>");
	//document.writeln("        	<td width=\"72\"><img src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/logo2.jpg\"  \/><\/td>");
	if(iOk) {
		document.writeln("        	<td width=\"26\"><a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://hi.mop.com/\"><img height='22' width='22' border='0' src=\""+Hi_USER.headUrl+"\" \/></a><\/td>");
	}
	document.writeln("          	<td width=\"135\">");

	var jscode = "";
	if(iOk) {
		jscode = "onmouseover=\"document.getElementById('mess_id').style.display='block'; \" onmouseout=\"document.getElementById('mess_id').style.display='none';\"";
	}

	document.writeln("           		<div class=\"loged\" "+jscode+"><h3><a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://hi.mop.com/\" target='_blank'>"+ name_display +"<\/a><img  border='0' src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/open.gif\" \/><\/h3>");
	document.writeln("                		<div class=\"loged_open\" id=\"mess_id\" style=\"display:none;z-index:99999999;\">");
	document.writeln("                    	<h4><a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://hi.mop.com/\"  target='_blank'>"+ name_display +"<\/a><img border='0' src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/close.gif\" \/><\/h4>");
	document.writeln("                        <div class=\"mess\">");
	if(iOk) {
		document.writeln("                        <a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://hi.mop.com/myreplylist.do\" target='_blank'><b>"+ Hi_USER.replyCount +"<\/b> 条未读留言<\/a><br \/>");
		document.writeln("                        <a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://friend.hi.mop.com/GetGuestRequest.do\" target='_blank'><b>"+ Hi_USER.friendCount +"<\/b> 好友申请<\/a><br \/>");
		document.writeln("              <a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://msg.hi.mop.com/notify/notifications.do\" target='_blank'><b>"+ Hi_USER.notify +"<\/b> 个通知<\/a><br \/>");
		document.writeln("              <a href=\"http://login.hi.mop.com/Login.do?ss=mophome_top&origURL=http://msg.hi.mop.com/\" target='_blank'><b>"+ Hi_USER.newMessageCount +"<\/b> 个消息<\/a>");
		
	}
	document.writeln("						<\/div>");
	document.writeln("                    <\/div>");
	document.writeln("                <\/div> ");
	document.writeln("            <\/td>");
	document.writeln("            <td width=\"270\">登录：" + loginTimes + "　MP：" + mp + " <a href=\"http://passport.mop.com/Logout?backUrl="+document.location.href+"\"><img src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/icon_18.gif\" border=\"0\" style=\"vertical-align:middle;\"\/></a><\/td>");
	//document.writeln("            <td><\/td>");
	document.writeln("  	    	<td>&nbsp;<\/td>");
	document.writeln("            <td width=\"235\" class=\"tslink\"><a href=\"http:\/\/www.mop.com\" target='_blank'>首页<\/a><a href=\"http:\/\/dzh.mop.com\/\" target='_blank'>大杂烩<\/a><a href=\"http:\/\/hi.mop.com\/\" target='_blank'>MOP HI<\/a><a href=\"http:\/\/tt.mop.com\/\" target='_blank'>贴贴<\/a><a href=\"http:\/\/m.mop.com\/\" style=\"padding-right:0px;\" target='_blank'>爱听<\/a><\/td>");
	document.writeln("      <\/tr>");
	document.writeln("    <\/table>");
	document.writeln("	<\/div>");
	document.writeln("<\/div>");
} else {
	document.writeln("<div id=\"banner_wai\" style=\"display:block;\">");
	document.writeln("	<div id=\"banner\">");
	document.writeln("   	  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
	document.writeln("      	<tr>");
//	document.writeln("        	<td width=\"72\"><img src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/logo2.jpg\"  \/><\/td>");
	document.writeln("       	  	<td width=\"72\" style=\"*+ padding-top:2px;\">猫扑通行证：<\/td>");
	document.writeln("       	  <td width=\"70\"><select name=\"select\" id=\"select\" class=\"vmiddle\"><option>昵称<\/option><option>用户名<\/option><\/select><\/td>");
	document.writeln("          <td width=\"110\"><input type=\"text\" name=\"user_name\" id=\"textfield\" class=\"inputk\" \/><\/td>");
	document.writeln("            <td width=\"40\">密码：<\/td>");
	document.writeln("          <td width=\"110\"><input type=\"password\" name=\"password\" id=\"textfield2\" class=\"inputk\" \/><\/td>");
	document.writeln("          <td width=\"20\"><input type=\"checkbox\" name=\"auto_login\" value=\"1\" id=\"checkbox\"  class=\"vmiddle\"\/><\/td>");
	document.writeln("            <td width=\"55\"><div style=\"padding-top:2px;\">自动登录<\/div><\/td>");
	document.writeln("          	<td><input type=\"image\" src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/icon_00.gif\" class=\"vmiddle\"\/> <a href='http://passport.mop.com/sign/login_1.jsp?from=http://tt.mop.com' target='_blank'><img src=\"http:\/\/image2.mop.com\/mop\/index2009\/images\/icon_01.gif\" style=\"border:none;\"  class=\"vmiddle\" \/></a><\/td>");
	document.writeln("            <td><\/td>");
	document.writeln("            <td width=\"235\" class=\"tslink\"><a href=\"http:\/\/www.mop.com\" target='_blank'>首页<\/a><a href=\"http:\/\/dzh.mop.com\/\" target='_blank'>大杂烩<\/a><a href=\"http:\/\/hi.mop.com\/\" target='_blank'>MOP HI<\/a><a href=\"http:\/\/tt.mop.com\/\" target='_blank'>贴贴<\/a><a href=\"http:\/\/m.mop.com\/\" target='_blank' style=\"padding-right:0px;\">爱听<\/a><\/td>");
	document.writeln("      <\/tr>");
	document.writeln("    <\/table>");
	document.writeln("	<\/div>");
	document.writeln("<\/div>");
}
//document.writeln("<div class=\"clearit\" style=\"height:8px;\"></div>");
document.writeln("<\/form>");
