if (typeof(MsgDlgInfo) == 'undefined')document.write("<script type=\"text/javascript\"  src=\"http://js.itiexue.net/com/tiexue/TxBaseUtilities.js\"></script>");

var Config={
	TxRegPath:"http://reg.tiexue.net/js/loginbar.aspx",
	TxNotePath:"http://msg.tiexue.net/Out/ToolBar.aspx",
	TxGroupPath:"http://i.tiexue.net/js/InfoBar.aspx?FunName=GetMyGroup&num=10",
	TxFriendPath:"http://i.tiexue.net/js/InfoBar.aspx?FunName=GetMyFriend&num=10",

	ReadPagePath:"http://msg.tiexue.net/Out/ReadNote.aspx",	//短信读取网页路径
	EditInfo:"http://msg.tiexue.net/Out/EditNote.htm",
	GroupRootPath:"http://group.tiexue.net/",
	HelpPath:"http://help.tiexue.net/",
	TxComLoginPath:"http://reg.tiexue.com/CrossDomainLogin.aspx"
	//RefreshNoteTimeLength:1	//取新短信的时间间隔(分钟)
}

//子菜单内容初始化
var TxChildMenu = new Object();
TxChildMenu.navigation = new Array();
TxChildMenu.group = new Array();
TxChildMenu.friend = new Array();
TxChildMenu.finance = new Array();
TxChildMenu.setting = new Array();

//TxChildMenu.navigation[0]= "首页,http://www.tiexue.net,_self,images/toolbar/www.gif";
TxChildMenu.navigation[0]= "铁血军事,http://mil.tiexue.net/,_self,images/toolbar/mil.gif";
TxChildMenu.navigation[1]= "社区论坛,http://bbs.tiexue.net/,_self,images/toolbar/bbs.gif";
TxChildMenu.navigation[2]= "铁血读书,http://bbs.tiexue.net/,_self,images/toolbar/book.gif";
TxChildMenu.navigation[3]= "铁血图鉴,http://pic.tiexue.net/,_self,images/toolbar/pic.gif";
TxChildMenu.navigation[4]= "辩论平台,http://argue.tiexue.net/,_self,images/toolbar/argue.gif";
TxChildMenu.navigation[5]= "铁血公社,http://group.tiexue.net/,_self,images/toolbar/blog.gif";
TxChildMenu.navigation[6]= "短信中心,http://msg.tiexue.net/,_blank,images/toolbar/message.gif";
TxChildMenu.navigation[7]= "休闲小游戏,http://game.tiexue.net/,_blank,images/toolbar/game.gif";

TxChildMenu.finance[0]= "银行账户,http://i.tiexue.net/BankDefault.aspx,_self,images/toolbar/bank.gif";	//javaScript:void(null)
TxChildMenu.finance[1]= "购买金币,http://pay.tiexue.net,_blank,images/toolbar/gold.gif";
TxChildMenu.finance[2]= "劳动力市场,http://market.tiexue.net,_blank,images/toolbar/market.gif";

TxChildMenu.setting[0]= "个人信息,http://i.tiexue.net/BasicData.aspx,_self,images/toolbar/info.gif";
TxChildMenu.setting[1]= "修改头像,http://i.tiexue.net/UserAvatarNativeNew.aspx,_self,images/toolbar/face.gif";
TxChildMenu.setting[2]= "修改密码,http://i.tiexue.net/ModPassword.aspx,_self,images/toolbar/pwd.gif";
TxChildMenu.setting[3]= "修改信箱,http://i.tiexue.net/ModEmail.aspx,_self,images/toolbar/mail.gif";

//TxChildMenu.group[0]="申请加入,javaScript:void(null),_self";
//TxChildMenu.group[1]="-1,,";
//TxChildMenu.friend[0]="-1,,";

document.write("<script language=\"javascript\" id=\"TxMsgJs\"></script>");
document.write("<script language=\"javascript\" id=\"TxNoteJs\"></script>");
document.write("<script language=\"javascript\" id=\"TxGroupJs\"></script>");
document.write("<script language=\"javascript\" id=\"TxFriendJs\"></script>");

var Tx_GroupList,TxFriend;
var TxTB_UserID = 0;
var TxTB_UserName = "";
try{
TxTB_UserID = BaseCookie.TxBBS_CurrentUserID();
TxTB_UserName = BaseCookie.TxBBS_CurrentUserName();
}catch(e){}


//var m_backurl= document.URL;
var Tx_NewMsgCount=0,Tx_GroupCount=0,Tx_FriendCount=0;	//取信息计数

function $(ItemId){return document.getElementById(ItemId);}
function TxTB_ReadNoteInfo(){
	if (Tx_NewMsgCount < 1) return;

	if (DlgInfo==null) onTxToolbarLoad();
	DlgInfo.ReadNewMsg();
}

//撰写新短信
function TxTB_EditNewNote(UserName)
{
	if (DlgInfo==null) onTxToolbarLoad();
	DlgInfo.CreateInfo(UserName);
}

function TxTB_getRandom(){
	return "&dom=" + Math.random();
}

function DateToStr(CurTime){
	return CurTime.getFullYear() + '-' + (CurTime.getMonth()+1) + '-' + CurTime.getDate() + ' ' + CurTime.getHours() + ':' + CurTime.getMinutes() + ':' + CurTime.getSeconds();
}
function StrToDate(CompareTime){
	var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; 
	var r = CompareTime.match(reg); 
	if(r==null)
		return new Date('1980','0','1','0','0','0');
	else
		return new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]);
}

function TxTB_UserLogin(){
	if (_UserName.value.length<1) 
	{
		alert("用户ID不能为空");
		_UserName.focus();return;
	}else if (_Password.value.length<1) 
	{
		alert("密码不能为空");
		_Password.focus();return;
	}
	var temp="FunName=Login&LoginName="+ escape(_UserName.value) +"&Password="+_Password.value+"&ExpDT="+ExpDT.value;
	var comLoginUrl = Config.TxComLoginPath + "?" + temp + TxTB_getRandom();
	temp = Config.TxRegPath + "?" + temp + TxTB_getRandom();
	TxMsgJs.src = temp;
	TxNoteJs.src = comLoginUrl;
}

function Tx_LoginFun(value){
	if (value!=""){
		var arr = value.split("|");
		if (arr.length==2){
			if(arr[0]=="true"){
				TxTB_UserID = BaseCookie.TxBBS_CurrentUserID();
				TxTB_UserName = BaseCookie.TxBBS_CurrentUserName();
				
				Tx_sAlertKill();
				BaseCookie.ClearCookie("TxGroups");
				BaseCookie.ClearCookie("TxFriends");
				
				ResetUserLoginStatus();
				TxTB_RefreshMenu();
				document.getElementById("TxNoteJs").src= Config.TxNotePath + "?" + TxTB_getRandom();//FunName=GetMyNewNote
			}else
				alert(arr[1]);
		}else
			alert("响应格式错");
	}
	TxMsgJs.src="";
}

function TxTB_UserLogout(){
	TxMsgJs.src = Config.TxRegPath + "?FunName=Logout" + TxTB_getRandom();
	TxNoteJs.src = Config.TxComLoginPath + "?FunName=Logout" + TxTB_getRandom();
	//Tx_sound.src="";
}
function Tx_LogoutFinish(value){
	TxTB_UserID = 0;
	ResetUserLoginStatus();

	TxTB_RefreshMenu();

	TxMsgJs.src="";
	
	BaseCookie.ClearCookie("TxGroups");
	BaseCookie.ClearCookie("TxFriends");

	Tx_sAlertKill();
}

function ResetUserLoginStatus(){
	if (TxTB_UserID == 0){
		TxLogin.style.display="";
		TxUserInfo.style.display="none";
		//_UserName.value = _Password.value = "";

		document.getElementById("UserCenterBt").style.display = 'none';
	}else{
		TxLogin.style.display="none";
		TxUserInfo.style.display="";
		document.getElementById("UserCenterBt").style.display = '';
		UserNameInfo.innerHTML = TxTB_UserName;

		Tx_GetMyNoteCount();
	}
}

function TxTB_RefreshMenu(){
	if (TxTB_UserID==0){
		MyBlogTD.style.display="none";

		TxChildMenu.group = new Array();
		TxChildMenu.group[0]="登录后使用,,_self,images/toolbar/group.gif";
		TxChildMenu.group[1]="匿名浏览," + Config.GroupRootPath + ",_self,images/toolbar/group.gif";

		TxChildMenu.friend = new Array();
		TxChildMenu.friend[0] = "请登录后使用,,_self,images/toolbar/user.gif";
		fnStopInterval();
		Tx_sAlertKill();
	}else{
		TxChildMenu.group = new Array();
		TxChildMenu.friend = new Array();

		myFriendTD.style.display="";
		TxChildMenu.friend[0] = "好友管理,http://" + TxTB_UserID + ".i.tiexue.net/friends_1.html,_blank,images/toolbar/user.gif";
		TxChildMenu.friend[1] = "-1,,,";

//		myGroupTD.style.display="";
//		myFriendTD.style.display="";
		MyBlogTD.style.display="";

		fnStartInterval();
		Tx_LoadCache();
	}
}

function TxTB_MenuItemLoad(funName){
	Tx_ClearMenuItem();

	var arr=null;
	switch (funName){
	case "navigation":
		arr=TxChildMenu.navigation;
		break;
	case "group":
		arr=TxChildMenu.group;
		break;
	case "friend":
		arr=TxChildMenu.friend;
		break;
	case "finance":
		arr=TxChildMenu.finance;
		break;
	case "setting":
		arr=TxChildMenu.setting;
		break;
	default:
	}
	var tempArr;
	if (arr!=null){
		if (arr.length==0) return false;

		for (var i=0;i<arr.length;i++){
			tempArr=arr[i].split(",");
			if (tempArr[0]=="-1")
				AddmenuItemSplitLine()
			else{
				if (funName=="friend"){
					if (i>1)
						Tx_AddMenuItem(funName,tempArr[3],tempArr[0],tempArr[1],tempArr[2],new Function("TxTB_EditNewNote(\"" + tempArr[0] + "\")"));
					else
						Tx_AddMenuItem(funName,tempArr[3],tempArr[0],tempArr[1],tempArr[2]);
				}else
					Tx_AddMenuItem(funName,tempArr[3],tempArr[0],tempArr[1],tempArr[2]);//Tx_AddMenuItem('images/toolbar/code.gif','help','http://test.tiexue.net/msg','_blank');
			}
		}
	}else
		return false;

	return true;
}

function Tx_GetMyGroupFun(value){
	var GroupID,GroupName,DomainName;
	if (value!="" && value!=null){
		Tx_GroupList = value;
		BaseCookie.SetCookie("TxGroups",escape(value),3600*12);
		var tempArr;

		TxChildMenu.group = new Array();
		var arr=value.split(";");
		for (var i=0;i<arr.length;i++){
			tempArr=arr[i].split(",");
			GroupID=tempArr[0];
			GroupName=tempArr[1];
			DomainName=tempArr[2];

			TxChildMenu.group[TxChildMenu.group.length]=GroupName + "," + Config.GroupRootPath + DomainName + "/,_self,images/toolbar/group.gif";
		}
	}else{	//还未加入任何公社
		TxChildMenu.group[0]="没有加入公社,,_self,images/toolbar/group.gif";
		TxChildMenu.group[1] = "-1,,,";
		TxChildMenu.group[2]="匿名浏览," + Config.GroupRootPath + ",_self,images/toolbar/group.gif";
	}
	//Tx_saveMenu();
	TxGroupJs.src="";
}

function Tx_GetMyFriendFun(value){
	if (value!="" && value!=null){
		BaseCookie.SetCookie("TxFriends",escape(value),3600*24);
		TxChildMenu.friend = new Array();
		TxChildMenu.friend[0] = "好友管理,http://" + TxTB_UserID + ".i.tiexue.net/friends_1.html,_blank,images/toolbar/user.gif";
		TxChildMenu.friend[1] = "-1,,,";
		var tempArr;

		var arr=value.split(";");
		for (var i=0;i<arr.length;i++){
			tempArr=arr[i].split(",");
			FriendID=tempArr[0];
			Friend=tempArr[1];
			Domain=tempArr[2];
			if (Domain!="")
				TxChildMenu.friend[TxChildMenu.friend.length] = Friend + ",http://" + Domain + ".i.tiexue.net/blog/,_blank,http://www.itiexue.net/images/toolbar/note.gif," + Friend;
			else
				TxChildMenu.friend[TxChildMenu.friend.length] = Friend + ",,_self,http://www.itiexue.net/images/toolbar/note.gif," + Friend;
		}
	}
	//Tx_saveMenu();
	TxFriendJs.src="";
}

function Tx_ToMyBlog(){
	if (TxTB_UserID==0) return;
	location = "http://" + TxTB_UserID + ".i.tiexue.net/blog/";
}

function Tx_ToMyCenter(){
	if (TxTB_UserID!=0) window.open("http://" + TxTB_UserID + ".i.tiexue.net");
}

function Tx_ToHelp(){
	location = Config.HelpPath;
}
function onTxToolbarLoad(){
	if (TxTB_UserID==0){
		TxTB_UserID = BaseCookie.TxBBS_CurrentUserID();
		TxTB_UserName = BaseCookie.TxBBS_CurrentUserName();
		if (TxTB_UserID!=0){
			ResetUserLoginStatus();
			TxTB_RefreshMenu();
		}
	}

	FriendInfo=new GoodFriend();
	DlgInfo = new MsgDlgInfo(false);
	DlgInfo.InitPanel();
	
	//ResetUserLoginStatus();
}
window.attachEvent('onload',onTxToolbarLoad);

//document.oncontextmenu=new Function("return false");
//window.document.attachEvent("onload",onTxToolbarLoad);//function(){alert('onload');DlgInfo = new MsgDlgInfo(false,RefreshLoginInfo);});

//window.onerror = function(){return true;};
function Tx_LoadCache(){
	TxGroup = BaseCookie.GetCookie("TxGroups");
	TxFriend = BaseCookie.GetCookie("TxFriends");

	if (TxGroup==null){
		TxGroupJs.src=Config.TxGroupPath + "?FunName=GetMyGroup" + TxTB_getRandom();
	}else{
		TxGroup = unescape(TxGroup);
		Tx_GetMyGroupFun(TxGroup);
	}
	if (TxFriend==null){
		TxFriendJs.src=Config.TxFriendPath + "?FunName=GetMyFriend" + TxTB_getRandom();
	}else{
		TxFriend = unescape(TxFriend);
		Tx_GetMyFriendFun(TxFriend);
	}
}

var oInterval=null;
function fnStartInterval(){
	if(oInterval==null){
		oInterval=window.setInterval("Tx_GetMyNoteCount()",20000);
	}
}
function fnStopInterval(){
	if(oInterval!=null){
		window.clearInterval(oInterval);
		oInterval=oInterval1=null;
	}
}

function Tx_GetMyNoteCount(){
	if (DlgInfo==null) onTxToolbarLoad();
	TxTB_UserID = BaseCookie.TxBBS_CurrentUserID();
	TxTB_UserName = BaseCookie.TxBBS_CurrentUserName();
	
	if (TxTB_UserID!=0){
		DlgInfo.Tx_GetMsgCount_Cache();
		Tx_NewMsgFeedback_1(DlgInfo.NewInfoCount);
	}
}

//最新短信
function Tx_NewMsgFeedback_1(value){	//更新缓冲区数据（当前时间、新短信信息）
	Tx_NewMsgCount = value;
	//BaseCookie.SetCookie("TxMsgNew",value,60*Config.RefreshNoteTimeLength);
	Tx_NodeDataFill(value);

	var obj=document.getElementById("msgDiv");
	if (obj!=null)
	{
		obj.parentNode.removeChild(obj);
	}
	if (value!="")
	{
		Tx_sAlert("<FONT COLOR=red><span onclick='TxTB_ReadNoteInfo()' style='cursor:hand'>" + value + "条新消息</span></FONT>");
	}
}

function Tx_DelReadedMsg(MsgID){
	var temp = Message.NewMsg;
	if (temp==""){
		return;
	}
	temp+=",";
	temp = temp.replace(MsgID + ",","");
	if (temp!=""){
		temp=temp.substr(0,temp.length-1);
	}
	Tx_GetMyNewNoteFun(temp);
}

function Tx_NodeDataFill(value)
{
	if (value==0) value="";
	if (value!=""){
		Message.innerHTML = "<FONT COLOR=red><span onclick='TxTB_ReadNoteInfo()' style='cursor:hand'>" + value + "条新消息</span></FONT>&nbsp;";
		Message.NewMsg = value;
	}else{
		Message.innerHTML = "<span style=\"cursor:hand\" onclick=\"TxTB_EditNewNote('')\"><FONT COLOR=blue>新短信</FONT></span>";
	}
}

//用于模仿Office XP的风格
function Tx_MouseOver(src,BackColor) 
{
	if (!src.contains(event.fromElement)) 
	{
		src.bgColor = BackColor;
		src.style.bordercolor = "#000000";
	}
}
function Tx_MouseOut(src, BackColor)
{
	if (!src.contains(event.toElement))
	{
		src.bgColor = BackColor; 
		src.style.bordercolor = "#000000";
	}
}

function getReal(el) {
	temp = el;
	while ((temp != null) && (temp.tagName != "BODY")) {
		if (temp.tagName == "TD")
			return temp;
		temp = temp.parentElement;
	}
	return el;
}

var cswmTI="";

function Tx_ClearStatus(){
	ClearToolbarStatus(menutable);
	ie5menu.style.visibility="hidden";
}
function Tx_HideMenu(){
	cswmTI=setTimeout("Tx_ClearStatus();",250);
}
function Tx_StopHideMenu(){
	clearTimeout(cswmTI);
}

function Tx_GetTableItem(obj){
	var obj1=obj;
	while(obj1.tagName!="TABLE" && obj1.tagName!="BODY")
		obj1 = obj1.parentElement;
	if (obj1.tagName != "TABLE") return null;
	return obj1;
}

//清空菜单内容
function Tx_ClearMenuItem(){
	while (MenuItem.rows.length!=0)
		MenuItem.deleteRow(0);
}

//向菜单中添加内容
function Tx_AddMenuItem(funName,ImgSrc,DispInfo,Href,Target,OnItemClick){
	var obj=MenuItem;
	var oTR = obj.insertRow();
	oTR.borderColor = "#f1f1f1";
	var oTD = oTR.insertCell(0);
 
	var tableobj = document.createElement("table");
	tableobj.height = "22px";

	tableobj.cellSpacing=0;
	tableobj.cellPadding=0;

/*	tableobj.borderColorLight="#000000";
	tableobj.border=0;
	tableobj.bgColor="#f1f1f1";
	tableobj.width="100%";
	tableobj.align="center";
	tableobj.borderColor="#000000";
	tableobj.borderColorDark="#000000";*/

	tableobj.className = "TxMainMenu";

	if (Href!=""){
		tableobj.onmouseout = new Function("this.className = 'TxMainMenu'");
		tableobj.onmouseover = new Function("this.className = 'TxMainMenu1'");
	}
	oTD.appendChild(tableobj);

	oTR=tableobj.insertRow();
	oTR.bgColor="#f1f1f1";
	oTR.borderColor="#b6bdd2";
	
	if (Href!=""){
		oTR.onmouseout=new Function("Tx_MouseOut(this,'#f1f1f1')");
		oTR.onmouseover=new Function("Tx_MouseOver(this,'#B6BDD2')");
	}

	if (typeof(OnItemClick)!='undefined'){
		oTD=oTR.insertCell(0);	//oTD.bgColor = "#dbd8d1";
		oTD.width="20px";
		oTD.align="center";
		oTD.innerHTML = "<img border='0' src='" + ImgSrc + "' title='发送短信' style='cursor:hand'>";
			oTD.onclick=OnItemClick;

		oTD=oTR.insertCell(1);	//oTD.className = "flyoutLink";
		oTD.nowrap="";
		if (Href!=""){
			oTD.style.cursor="hand";
			oTD.title = '访问Blog';
			oTD.onclick = function(){
							if (Target=="_self")
								location.href = Href;
							else
								window.open(Href);
						}
		}
		oTD.innerHTML = "<nobr>&nbsp;"+ DispInfo + "&nbsp;</nobr>";
	}else{
		oTD=oTR.insertCell(0);
		oTD.nowrap="";
		if (Href!="")
			temp="<a class='mainbar' href=\"" + Href + "\" target=\"" + Target + "\" class='a_link'>" + DispInfo + "</a>";
		else
			temp=DispInfo;
		oTD.innerHTML = "<nobr>&nbsp;" + temp + "&nbsp;</nobr>";
	}
}

function AddmenuItemSplitLine(){
	var obj=MenuItem;
	var oTR = obj.insertRow();
	var oTD = oTR.insertCell(0);
 
	oTD.height = "3";
	oTD.className = "TDSplit";
	oTD.innerHTML = "<table height=1 border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table>";
}

function ClearToolbarStatus(obj){
	if (obj.rows.length<1) return;
	row=obj.rows[0];
	for (i=0;i<row.cells.length;i++){
		row.cells[i].className = "toolbar";
	}
}

// 得到IE中各元素真正的位移量，即使这个元素在一个表格中
function getIEPosX(elt) { return getIEPos(elt,"Left"); }
function getIEPosY(elt) { return getIEPos(elt,"Top"); }
function getIEPos(elt,which) {
	iPos = 0;
	while (elt!=null) {
		iPos += elt["offset" + which];
		elt = elt.offsetParent;
	}
	return iPos;
}

function Tx_menu_down(obj){
	var obj1=Tx_GetTableItem(obj);
	if (obj1 == null) return;

	ClearToolbarStatus(obj1);
	obj.className = "toolbar1";

	if (!TxTB_MenuItemLoad(obj.funName)){
		ie5menu.style.visibility="hidden";
		return;
	}
	ie5menu.style.left = parseInt(obj.offsetLeft) + parseInt(obj1.offsetLeft);	//document.body.scrollLeft + 
	ie5menu.style.top = getIEPosY(obj1) + parseInt(obj1.offsetTop) + parseInt(obj1.offsetHeight);//document.body.scrollTop +  + 1

	obj1 = obj1.parentElement;
	while (obj1.tagName!="BODY"){
		ie5menu.style.left = parseInt(ie5menu.style.left) + parseInt(obj1.offsetLeft);
//		ie5menu.style.top = parseInt(ie5menu.style.top) + parseInt(obj1.offsetHeight);
		obj1 = obj1.parentElement;	
	}
//	ie5menu.style.top = parseInt(ie5menu.style.top);	// - 9

	ie5menu.style.visibility="visible";
}

function Tx_menu_out(obj){
	if (ie5menu.style.visibility=="hidden")
		obj.className = "toolbar";
	else
		Tx_HideMenu();
}

function Tx_menu_over(obj){
	Tx_StopHideMenu();
	toEl = getReal(window.event.toElement);
	fromEl = getReal(window.event.fromElement);
	if (toEl == fromEl) return;

	if (ie5menu.style.visibility=="hidden"){
		obj.className = "toolbar0";
		return;
	}
	
	Tx_menu_down(obj);
}

var firstLoad=true;
function Tx_HideGame(){
	cswmTI=setTimeout("Tx_ClearGame();",250);
}
function Tx_ClearGame(){
	var obj = $("TxTopDiv")
	obj.innerHTML='';
	obj.style.display='none';
	obj.onmouseover = onmouseout = "";
	firstLoad=true;
}
function Tx_gameClick(obj){
	var o = $("TxTopDiv");
	if (o==null)return;
	if (o.style.display=='')return;

	if (firstLoad){
		o.onmouseover = function(){
			window.clearInterval(cswmTI);
		}
		o.onmouseout= Tx_HideGame;
	}

	o.style.zIndex = 1000;
	var temp = '<div style="BACKGROUND-COLOR: #f1f1f1;BORDER: #999999 1px solid;padding:5px">';
	temp+= '<a href="http://ads.tiexue.net/Monitor/Monitor.aspx?PlaceID=73"><font color="blue">2服 笑看风云</font></a>　';
	temp+= '<a href="http://srv1.wm.tiexue.com/"><font color="blue">1服 指点江山</font></a><br>';
	temp+= '<a href="http://wm.tiexue.com">[游戏官网]</a> <a href="http://wm.tiexue.com/bbs">[玩家论坛]</a><br>';
	temp+= '<a href="http://wm.tiexue.com/xkfy"><font color="red">2服笑看风云8月18日14时开启</font></a>';
	temp+= '</div>';
	o.innerHTML = temp;

	firstLoad=false;
	
	o.style.display = '';
	o.style.top = getIEPosY(obj)+20;
	o.style.left = getIEPosX(obj)-5;
}

function getIEVersonNumber(){
	var ua = navigator.userAgent;
	var msieOffset = ua.indexOf("MSIE ");
	if(msieOffset < 0)
		return 0;
	return parseFloat(ua.substring(msieOffset + 5, ua.indexOf(";", msieOffset)));
}

function Tx_MainBarInit(BarWidth){
	var InternetExplorer= navigator.appName.indexOf("Microsoft") != -1;
	if (!InternetExplorer){
		//alert('非IE浏览器，工具条不能初始化！');
		return;
	}
	var isIE5Min = (getIEVersonNumber() >= 5);
	if (!isIE5Min){
		//alert('请使用5.0以上版本浏览器！');
		return;
	}

	if (BarWidth==0) BarWidth=720
	document.write("<span class=\"DSMenuBox\" onMouseOut=\"Tx_HideMenu();\">");
	document.write("<DIV id=\"ie5menu\" onMouseOver=\"Tx_StopHideMenu();\">");
	document.write("<table id=\"MenuItem\" border=\"0\" bgcolor=\"#f9f8f7\" bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\"></table>");
	document.write("</DIV>");
	document.write("</span>");
	document.write("<table cellSpacing=\"0\" cellPadding=\"0\" align=\"center\" background=\"http://www.itiexue.net/Images/V1/index09_1.gif\" id=\"TxTB_MainTable\" width=\"" + BarWidth + "\">");
	document.write("<tr>");
	document.write("	<td style=\"padding-left:4px;\">");
	document.write("		<div id=\"TxLogin\">");
	document.write("			<div class=\"TxTB_LoginInput\">");
	document.write("				用户名：<input id=\"_UserName\" type=\"text\" class='inp' style='WIDTH:60px' NAME=\"_UserName\"");
	document.write("					onMouseOver=\"this.style.borderColor='#ff0000'\" onMouseOut=\"this.style.borderColor='#DBDBDB'\">");
	document.write("				密码：<input id='_Password' type='password' class='inp' style='WIDTH:60px' onKeyDown='if(window.event.keyCode==13) TxTB_UserLogin()'");
	document.write("					NAME='_Password' onMouseOver=\"this.style.borderColor='#ff0000'\" onMouseOut=\"this.style.borderColor='#DBDBDB'\">");
	document.write("			</div>");
	document.write("			<div style='height:22px;padding-top:2px;display:inline;'><select name='ExpDT' id='ExpDT' style='height:19px;'>");
	document.write("					<option value='1'>1天</option>");
	document.write("					<option value='7'>1周</option>");
	document.write("					<option value='30'>1月</option>");
	document.write("					<option value='365' selected>1年</option>");
	document.write("				</select></div>");
	document.write("			<div style='height:22px;padding-top:1px;display:inline;padding-left:4px;'>");
	document.write("				<input type='image' src='http://www.itiexue.net/images/V1/index09_2.gif' align='absmiddle' name='Submit' value='登录' onClick='TxTB_UserLogin()'>");
	document.write("				<input type='image' src='http://www.itiexue.net/images/V1/index09_3.gif' align='absmiddle' name='Submit' value='游客' onClick=\"top.location.href='http://bbs.tiexue.net/'\">");
	document.write("				<input type='image' src='http://www.itiexue.net/images/V1/index09_4.gif' align='absmiddle' name='Submit' value='注册' onClick=\"top.location.href='http://reg.tiexue.net/register.aspx'\">");
	document.write('　　<a href="http://ads.tiexue.net/Monitor/Monitor.aspx?PlaceID=74" style="color:blue;">铁血战争游戏，边玩边赚工分</a>');
	document.write("			</div>");
	document.write("		</div>");
	document.write("		<div id='TxUserInfo'>");
	document.write("			欢迎您：<font style='COLOR:#ff0000'><span id='UserNameInfo'></span></font>");
	document.write("			<span id='Message'></span>&nbsp; <input type='image' src='http://www.itiexue.net/images/V1/index09_31.gif' align='absmiddle' value='进入社区' onClick=\"top.location.href='http://bbs.tiexue.net/'\"> ");
	document.write("			<input type='image' src='http://www.itiexue.net/images/V1/index090708.gif' align='absmiddle' value='进入游戏' onclick='Tx_gameClick(this)' onmouseover='Tx_gameClick(this)' onmouseout='Tx_HideGame()'> ");
	document.write("			<input id='UserCenterBt' type='image' src='http://www.itiexue.net/images/V1/index09_32.gif' align='absmiddle' value='个人中心' onclick='Tx_ToMyCenter()'> ");
	document.write("			<input type='image' src='http://www.itiexue.net/images/V1/index09_33.gif'' align='absmiddle' value='退出' onclick='TxTB_UserLogout()'>");
	document.write('　　<a href="http://ads.tiexue.net/Monitor/Monitor.aspx?PlaceID=74" style="color:blue;">铁血战争游戏，边玩边赚工分</a>');
	document.write("		</div>");
	document.write("	</td>");
	document.write('	<td align="right"><img src="http://www.itiexue.net/images/V1/index09_19.gif" width=19 height=16 align="absmiddle" /></td>');
	document.write("	<td width='260px;'>");
	document.write("		<div style='height:22px;padding-top:2px;padding-left:12px;'>");
	document.write("			<table id='menutable' align='center' height='18' cellSpacing='0' cellPadding='0' width='100%' border='0'>");
	document.write("			<tr>");
	document.write("				<td width='40' id='MyBlogTD' align='center' class='toolbar' onmouseover=\"this.className = 'toolbar0'\" ");
	document.write("					onmouseout=\"this.className = 'toolbar'\" onmousedown=\"this.className = 'toolbar1'\"");
	document.write("					onmouseup=\"this.className = 'toolbar0';Tx_ToMyBlog();\" nowrap>博客</td>");
	document.write("				<td width='40' id='myGroupTD' align='center' funName='group' class='toolbar' onmouseover='Tx_menu_over(this)' ");
	document.write("					onmouseout='Tx_menu_out(this)' onmousedown='Tx_menu_down(this)' nowrap>公社</td>");
	document.write("				<td width='40' id='myFriendTD' align='center' funName='friend' class='toolbar' onmouseover='Tx_menu_over(this)' ");
	document.write("					onmouseout='Tx_menu_out(this)' onmousedown='Tx_menu_down(this)' nowrap>好友</td>");
	document.write("				<td width='40' align='center' funName='finance' class='toolbar' onmouseover='Tx_menu_over(this)' ");
	document.write("					onmouseout='Tx_menu_out(this)' onmousedown='Tx_menu_down(this)' nowrap>经济</td>");
	document.write("				<td width='40' align='center' funName='setting' class='toolbar' onmouseover='Tx_menu_over(this)' ");
	document.write("					onmouseout='Tx_menu_out(this)' onmousedown='Tx_menu_down(this)' nowrap>设置</td>");
	document.write("				<td width='40' align='center' class='toolbar' onmouseover=\"this.className = 'toolbar0'\" ");
	document.write("					onmouseout=\"this.className = 'toolbar'\" onmousedown=\"this.className = 'toolbar1'\" ");
	document.write("					onmouseup=\"this.className = 'toolbar0';Tx_ToHelp();\" nowrap>帮助</td>");
	document.write("				<td width='30' class='toolbar'>&nbsp;</td>");
	document.write("			</tr>");
	document.write("			</table>");
	document.write("		</div>");
	document.write("	</td>");
	document.write("</tr>");
	document.write("</table>");
	ResetUserLoginStatus();
	TxTB_RefreshMenu();
	document.body.className = "yui-skin-sam";
}

//短信提示对话框
var Tx_oKillTime="";
var Tx_oKillCount=0;
var	Tx_msgw=180;//提示窗口的宽度
var	Tx_msgh=120;//提示窗口的高度
function Tx_KillProcess(){
	Tx_oKillCount++;
	if (Math.round(Tx_oKillCount/10)<3) return;
	
	var obj=document.getElementById("msgDiv");
	obj.style.top=parseInt(obj.style.top) + 6;
	
	if (parseInt(obj.style.top) > document.body.clientHeight+document.body.scrollTop){
		obj.outerHTML='';
		if(Tx_oKillTime!=""){
			window.clearInterval(Tx_oKillTime);
			Tx_oKillTime="";
		}
	}
}
function Tx_StartHidden(){
	Tx_oKillCount=0;
	if(Tx_oKillTime==""){
		Tx_oKillTime=window.setInterval("Tx_KillProcess()",100);
	}
}
function Tx_StopHidden(){
	Tx_oKillCount=0;
	var obj=document.getElementById("msgDiv");
	obj.style.top= document.body.clientHeight+document.body.scrollTop-Tx_msgh;
	if(Tx_oKillTime!=""){
		window.clearInterval(Tx_oKillTime);
		Tx_oKillTime="";
	}
}
function Tx_sAlertKill(){
	var obj = document.getElementById("msgDiv");
	if (obj!=null){
		obj.outerHTML = "";
	}
}
function Tx_sAlert(str){
/*	var bordercolor;
	titleheight=20 //提示窗口标题高度
	bordercolor="#CC0000";//提示窗口的边框颜色
	titlecolor="#990000";//提示窗口的标题颜色

	var msgObj=document.createElement("div");
	msgObj.setAttribute("id","msgDiv");
	msgObj.setAttribute("align","center");
	msgObj.className = "MsgNoteDiv";

	var title=document.createElement("h4");
	title.setAttribute("id","msgTitle");
	title.setAttribute("align","right");
	title.style.margin="0";
	title.style.padding="0px";
	title.style.background=bordercolor;
	title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
	title.style.opacity="0.75";
	title.style.border="1px solid " + bordercolor;
	title.style.height="18px";
	title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
	title.style.color="white";
//	title.style.cursor="pointer";
	title.innerHTML="<img src='http://www.itiexue.net/images/toolbar/close.gif' style='cursor:hand' onclick='document.body.removeChild(document.getElementById(\"msgDiv\"))'>";

	document.body.appendChild(msgObj);
	document.getElementById("msgDiv").appendChild(title);
	var txt=document.createElement("p");
	txt.style.margin="1em 0"
	txt.setAttribute("id","msgTxt");
	txt.style.padding="20px 4px 4px 4px";
	txt.innerHTML=str;
	document.getElementById("msgDiv").appendChild(txt);
*/
	//msgObj.onmouseout= function(){Tx_StartHidden();}
	//msgObj.onmouseover=function(){Tx_StopHidden();}
	//Tx_StartHidden();
}

/*
var iTimeoutID=-1;
function Tx_RefreshBar(){
	if (iTimeoutID!=-1) return;
	iTimeoutID=window.setTimeout("Tx_RefreshBar1()",500);
}
function Tx_RefreshBar1(){
	window.clearTimeout(iTimeoutID);
	iTimeoutID=-1;

	TxTB_UserID = BaseCookie.TxBBS_CurrentUserID();
	TxTB_UserName = BaseCookie.TxBBS_CurrentUserName();
	ResetUserLoginStatus();
	TxTB_RefreshMenu();
	if (TxTB_UserID==0)
	{
		window.status="";
	}
}*/

