//合并Cookie.js,TopPanel.js

//设置COOKIE
var BaseCookie = {
	//取基础域名
	GetRootDomain : function(domain)
	{
		var domainsplite = domain.split(".");
		if(domainsplite.length>2){
			return domainsplite[domainsplite.length-2]+"."+domainsplite[domainsplite.length-1];
		}else{
			return domain;
		}
	},
	//删除指定名称的cookie
	ClearCookie : function(name)
	{
		this.SetCookie(name," ",-3600);
	},
	SetCookie : function(name,value,expires){	//变量名，变量值，保持时间(秒)
		var expDate = new Date();
		expDate.setTime(expDate.getTime()+expires*1000);
		var domainString = this.GetRootDomain(document.domain);

		var expString = ";expires="+expDate.toGMTString();
		var pathString = ";path=/";
		var domainString = ";domain="+this.GetRootDomain(document.domain);
		document.cookie=name+"="+encodeURIComponent(value)+expString+pathString+domainString;	//escape
	},
	//获取指定名称的cookie值
	GetCookie : function(name)	//变量名
	{
		var result=null;
		var myCookie=document.cookie+";";

		var searchName=name+"=";
		var startOfCookie = myCookie.indexOf(searchName);
		var endOfCookie;
		if(startOfCookie != -1)
		{
			startOfCookie+=searchName.length;
			endOfCookie = myCookie.indexOf(";",startOfCookie);
			result = myCookie.substring(startOfCookie,endOfCookie);
			try{
				result = decodeURI(result);	//unescape
			}catch(e){
				result = unescape(result);
			}
		}
		return result;
	},
	//兼容以前版本的冗余方法
	TxBBS_GetDomain : function(domain){
		return this.GetRootDomain(domain);
	},
	TxBBS_SetCookie : function(name,value,expires,path,domain){
		var expString = ((expires==null)?(""):(";expires="+expires.toGMTString()));
		var pathString = ((path==null)?(""):(";path="+path));
		var domainString = ((domain==null)?(""):(";domain="+domain));
		document.cookie=name+"="+escape(value)+expString+pathString+domainString;
	},
	TxBBS_GetCookie : function(name){
		return this.GetCookie(name);
	},
	TxBBS_GetParm : function(name,str){	//分析字符串获得参数
		var result=null;
		var myStr = str+"&";
		var searchName=name+"=";
		var startOfStr = myStr.indexOf(searchName);
		var endOfStr;
		if(startOfStr != -1)
		{
			startOfStr+=searchName.length;
			endOfStr = myStr.indexOf("&",startOfStr);
			result = myStr.substring(startOfStr,endOfStr);
		}
		return result;
	},
	TxBBS_SetParm : function(val,name,str){	//将参数插入字符串,返回新字符串
		var result="";
		var myStr = str+"&";
		var searchName=name+"=";
		var startOfStr = myStr.indexOf(searchName);
		var endOfStr;
		if(startOfStr != -1)
		{
			startOfStr+=searchName.length;
			endOfStr = myStr.indexOf("&",startOfStr);
			var perstr = myStr.substring(0,startOfStr);
			var nextstr = myStr.substring(endOfStr,myStr.length-1);
			result = perstr + val + nextstr;
		}
		else//如果字符串不存在
		{
			if(str == "")
			{
				result = str + name + "=" + val;
			}
			else
			{
				result = str + "&" + name + "=" + val;
			}
		}
		return result;
	},
	TxBBS_ConfigCookieName : "Permission",
	TxBBS_CurrentUserName : function(){//当前登录用户名
		var str = this.TxBBS_GetCookie(this.TxBBS_ConfigCookieName);
		if(str != null)
		{
			var username = decodeURI(this.TxBBS_GetParm("UserName",str));
			if(username != null)
			{
				return username;
			}
			else
			{
				return "未登录";
			}
		}
		else
		{
			return "未登录";
		}
	},
	TxBBS_LoadConfig : function(){
		var indivstr = this.TxBBS_GetCookie(this.TxBBS_ConfigCookieName);

		if(indivstr!=null)
		{
			nowPageStyle = this.TxBBS_GetParm("PageStyle",indivstr);
			nowOpenType = this.TxBBS_GetParm("OpenType",indivstr);
			nowPostStyle = this.TxBBS_GetParm("PostStyle",indivstr);
		}
	},	//从 Cookie里面读取设置
	TxBBS_SaveConfig : function(pageStyle,openType,postStyle){
		var indivstr = this.TxBBS_GetCookie(this.TxBBS_ConfigCookieName);//先读出，然后在这上面修改
		if(indivstr==null)
		{
			indivstr = "";
		}
		indivstr = this.TxBBS_SetParm(pageStyle,"PageStyle",indivstr);
		indivstr = this.TxBBS_SetParm(openType,"OpenType",indivstr);
		indivstr = this.TxBBS_SetParm(postStyle,"PostStyle",indivstr);
		//alert(indivstr);
		//indivstr="PageStyle="+pageStyle+"&OpenType="+openType+"&PostStyle="+postStyle;
		//document.write(indivstr);
		var expDate = new Date();
		expDate.setTime(expDate.getTime()+3600*24*365*1000);

		this.TxBBS_SetCookie(this.TxBBS_ConfigCookieName,indivstr,expDate,"/",this.TxBBS_GetDomain(document.domain));
	},	//将设置保存到Cookie
	TxBBS_CurrentUserID : function(){
		var str = this.TxBBS_GetCookie(this.TxBBS_ConfigCookieName);
		if(str != null)
		{
			var userid = this.TxBBS_GetParm("UserID",str);
			if(userid != null)
			{
				return userid;
			}
			else
			{
				return 0;
			}
		}
		else
		{
			return 0;
		}
	},	//当前登录用户ID
	TxBBS_IsHeader : function(){	//是否是管理员
		var str = this.TxBBS_GetCookie(this.TxBBS_ConfigCookieName);
		if(str != null)
		{
			if(this.TxBBS_GetParm("IsHeader",str) == "True")
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	},
	checkvote : function(){
		var arr = document.getElementsByName('voteResult');
		var re = false;
		for (var i=0;i < arr.length;i++)
		{
			if (arr[i].checked == true)
			{
				re =true;
			}
		}
		if (re == false)
		{
			alert('在投票之前请选中投票选项！');
			return false;
		}
	}
}

//基础对话框类
document.write("<div id='TxTopDiv' style='z-Index:1000;position:absolute;top:expression(document.body.clientHeight/2 - TxTopDiv.offsetHeight/2);left:expression(document.body.clientWidth/2 - TxTopDiv.offsetWidth/2);display:none;' class='dd-demo'></div>");
document.write("<div id='__$mask$container' style='z-index:999;background:#cccccc;filter:Alpha(opacity=50);position:absolute;width:100%;height:100%;left:0;top:0;display:none;'></div>");

var xmlns1999 = false;
try{xmlns1999 = (document.getElementsByTagName("html")[0].xmlns.toLowerCase()=='http://www.w3.org/1999/xhtml')?true:false;}catch(e){}
function getScroll() {
	var t, l, dde=document.documentElement, db=document.body;
	if (dde && (dde.scrollTop || dde.scrollLeft)) {
		t = dde.scrollTop;
		l = dde.scrollLeft;
	} else if (db) {
		t = db.scrollTop;
		l = db.scrollLeft;
	} else {}
	return { top: t, left: l };
}
TxOverlay = function(){	//覆盖层
	this.DomObj = null;
}
TxOverlay.prototype = {
	Show:function(){
		this.DomObj = document.getElementById("__$mask$container");
		if (this.DomObj == null) return;
		this.DomObj.style.display = "";
		this.DomObj.style.height = document.body.scrollHeight + "px";
	},

	Hide:function(){
		this.DomObj = document.getElementById("__$mask$container");
		if (this.DomObj == null)return;
		this.DomObj.style.display = 'none';
	},

	Close:function(){
		this.DomObj = document.getElementById("__$mask$container");
		if (this.DomObj == null)return;
		this.DomObj.style.display = 'none';
		CollectGarbage();
	}
}

TopPanel = function(){
	this.onOk = null;
	this.onCancel = null;
	this.onClose = null;
	this.Obj = document.getElementById("TxTopDiv");
}
TopPanel.prototype = {
	IsNumber:function(value){	//数字判断
		if (value==null || value=="") return false;
		return !isNaN(value);
	},
    CallBack:function(BackInfo){
		switch(BackInfo){
		case 1:	//确定
			if (this.onOk != null && typeof(this.onOk)=='function') 
			{
			    this.Close();this.onOk();
			}
			else
			{
			    this.Close();
			}
			break;
		case 2:	//取消
			if (typeof(this.onCancel)=='function') {this.Close();this.onCancel();}
			break;
		default:this.Close();
		}
		
    },
    //等待信息
    Process:function(Title){
		this.Obj = document.getElementById("TxTopDiv");
		this.Obj.style.zIndex = 1000;
		this.Obj.innerHTML = "<div><center>";
		if (typeof(Title)=="string") this.Obj.innerHTML+= Title + "<br>";
		this.Obj.innerHTML+= "<img src='http://js.itiexue.net/com/tiexue/images/loading.gif' />";
		this.Obj.innerHTML+= "</center></div>";

		this.Obj.style.display = "";
		this.FixCenter();
    },

	//提示对话框
    Alert:function(Title,Content,DlgWidth,fCallBack){
		this.onClose = this.onCancel = this.onOk = null;
		if (typeof(fCallBack)=='function') this.onClose = fCallBack;
		if (typeof(DlgWidth)=='undefined') DlgWidth =300;
		this.Obj = document.getElementById("TxTopDiv");
		this.Obj.style.zIndex = 1000;
		this.Obj.innerHTML = this.GetDlgInfo(false,Title,Content);

		this.Obj.style.display = "";
		this.Obj.style.width = DlgWidth + "px";
		drag("TxTopDiv","DropEventObj",true);
		this.FixCenter();
    },
	//确认对话框
    Confirm:function(Title,Content,DlgWidth,fOkBack,fCancelBack){
		this.onOk = this.onCancel = this.onClose = null;
		if (typeof(fOkBack)=='function') this.onOk=fOkBack;
		if (typeof(fCancelBack)=='function') this.onClose = this.onCancel=fCancelBack;
		if (typeof(DlgWidth)=='undefined') DlgWidth =300;

		this.Obj = document.getElementById("TxTopDiv");
		this.Obj.style.zIndex = 1000;
		this.Obj.innerHTML = this.GetDlgInfo(true,Title,Content);
		
		this.Obj.style.display = "";
		this.Obj.style.width = DlgWidth + "px";
		drag("TxTopDiv","DropEventObj",true);
		this.FixCenter();
		//this.Obj.style.left = "20px";this.Obj.style.top = "20px";
    },
    //自定义对话框
    CustomDlg:function(html,IsFixCenter,DragObjID,Left,Top,Width,Height){
		this.Obj = document.getElementById("TxTopDiv");
		with(this.Obj){
			innerHTML = html;
			style.zIndex = 1000;
			style.display = "";
			if (this.IsNumber(Left)) style.left = Left + "px";
			if (this.IsNumber(Top)) style.top = Top + "px";

			if (this.IsNumber(Width)) style.width = Width + "px";
			if (this.IsNumber(Height)) style.height = Height + "px";
		}
		if (IsFixCenter) this.FixCenter();
		if (typeof(DragObjID)=='string') this.initDrag(DragObjID);
    },

    Close:function(){
		this.Obj = document.getElementById("TxTopDiv");
		if (this.Obj==null)return;
		if (this.Obj.innerHTML=="")return;

		if (this.orig_scroll!=null){
			window.onscroll = this.orig_scroll;
		}

		this.Obj.innerHTML = "";
		this.Obj.style.display = "none";
		if (typeof(this.onClose)=='function') this.onClose();
    },

    FixCenter:function(DragID){
		if (typeof DragID == 'undefined') DragID = "TxTopDiv"
		this.Obj = document.getElementById(DragID);
		if (this.Obj==null)return;
		var viewpos = getScroll();
		if (xmlns1999){
			this.Obj.style.left = viewpos.left + (document.documentElement.clientWidth  - this.Obj.offsetWidth)/2 + "px";
			this.Obj.style.top = viewpos.top + (document.documentElement.clientHeight - this.Obj.offsetHeight)/2 + "px";
		}else{
			this.Obj.style.left = viewpos.left + (document.body.clientWidth  - this.Obj.offsetWidth)/2 + "px";
			this.Obj.style.top = viewpos.top + (document.body.clientHeight - this.Obj.offsetHeight)/2 + "px";
		}
    },
    ResetPanelObj:function(){
        if (this.Obj== null){this.Obj = document.getElementById("TxTopDiv");}
        if (this.Obj.children.length > 0)
        {
            var firstChild = this.Obj.children[0];
            if (firstChild.getAttribute("id") == "TxTablePanel")
            {
                var parentObj1 = document.getElementById("TxTablePanelParent");
                parentObj1.innerHTML = "";
                parentObj1.appendChild(firstChild);
            }
            else if(firstChild.getAttribute("id") == "processAlert")
            {
                var parentObj1 = document.getElementById("processAlertParent");
                parentObj1.innerHTML = "";
                parentObj1.appendChild(firstChild);
            }
        }
    },
    GetDlgInfo:function(OkCancelInfo,Title,Content){
 		var temp = "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>";
		temp+= "<tr>";
		temp+= "    <td width='14' height='27'> <img src='http://js.itiexue.net/com/tiexue/images/080325_1.gif' width='14' height='27'/></td>";
		temp+= "    <td id='DropEventObj' height='27' background='http://js.itiexue.net/com/tiexue/images/080325_2.gif' style='font-size: 12px;color: #3A0000;line-height:18px;' style='cursor:move'>" + Title + "</td>";	// onmousedown='MoveStart(\"TxTopDiv\")'
		temp+= "    <td width='29' height='24' background='http://js.itiexue.net/com/tiexue/images/080325_3.gif' style='padding-top:3px;'><img src='http://js.itiexue.net/com/tiexue/images/close.gif' width='14' height='14' onclick='TxTopPanel.CallBack(0)' style='cursor:hand'/></td>";
		temp+= "</tr>";
		temp+= "<tr>";
		temp+= "    <td width='14' background='http://js.itiexue.net/com/tiexue/images/080325_4.gif'>&nbsp; </td>";
		temp+= "    <td align='center' background='http://js.itiexue.net/com/tiexue/images/080325_5.gif' style='font-size: 12px;color: #3A0000;line-height:18px;'>";
		temp+= "		<table width='100' border='0' cellspacing='0' cellpadding='0'><tr><td height='10'></td></tr></table>";

		temp+= this.GetDlgData(OkCancelInfo,Content);

		temp+= "	</td>";
		temp+= "	<td width='29' background='http://js.itiexue.net/com/tiexue/images/080325_6.gif'>&nbsp; </td>";
		temp+= "</tr>";
		temp+= "<tr>";
		temp+= "	<td width='14' height='17' valign='top'><img src='http://js.itiexue.net/com/tiexue/images/080325_7.gif' width='14' height='17'/></td>";
		temp+= "	<td background='http://js.itiexue.net/com/tiexue/images/080325_8.gif'>&nbsp; </td>";
		temp+= "	<td width='29' height='17' valign='top'><img src='http://js.itiexue.net/com/tiexue/images/080325_9.gif' width='29' height='17'/></td>";
		temp+= "</tr>";
		temp+= "</table>";
		return temp;
	},

	GetDlgData:function(OkCancelInfo,msgInfo){
		var temp = null;
		temp = "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
		temp+= "<tr>";
		temp+= "	<td align='center' style='font-size:12px;color: #3A0000;line-height:18px;vertical-align:top;'>" + msgInfo + "</td>";
		temp+= "</tr>";
		temp+= "</table>";
		temp+= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
		temp+= "<tr>";
		temp+= "	<td height='30' align='center' style='vertical-align:bottom;'>";
		temp+= "		<img src='http://js.itiexue.net/com/tiexue/images/OkBt.gif' width='41' height='22' onclick='TxTopPanel.CallBack(1)' style='cursor:hand'/>";
		if (OkCancelInfo){	//确定取消
			temp+= "		<img src='http://js.itiexue.net/com/tiexue/images/CancelBt.gif' width='41' height='22' onclick='TxTopPanel.CallBack(2)' style='cursor:hand'/>";
		}//else{	//提示信息
		//	temp = msgInfo;
		//}
		temp+= "	</td>";
		temp+= "</tr>";
		temp+= "</table>";
		return temp;
	}
}
function drag(DragObj,EventObj,fixedcenter)	//被拖动的对象,事件对象,修复中心位置
{
	if (typeof DragObj == "string") DragObj = document.getElementById(DragObj);
	if (typeof EventObj == "string") EventObj = document.getElementById(EventObj);
 
	EventObj.onmousedown = function(a)
	{
		if(!a)a=window.event;

		var d=document;
		var x = a.clientX-DragObj.offsetLeft;
		var y = a.clientY-DragObj.offsetTop;

		if(DragObj.setCapture)
			DragObj.setCapture();
		else if(window.captureEvents)
			window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
		d.onmousemove = function(a)
		{
			if(!a)a=window.event;
			var viewpos = getScroll();
			var left =0;
			if (!document.all && document.getElementById){
				left = a.clientX+document.body.scrollLeft-x;
				if (left>viewpos.left+10){
					if (left < document.documentElement.clientWidth  - DragObj.offsetWidth + viewpos.left - 10){
						DragObj.style.left = left;

						DragObj.orig_x = parseInt(DragObj.style.left) - document.body.scrollLeft;
					}
				}
			}else{
				if (xmlns1999){
					if (a.clientX - x <= document.documentElement.scrollLeft + 10)
						left = document.documentElement.scrollLeft + 10; 
					else if (a.clientX - x >= document.documentElement.clientWidth - DragObj.offsetWidth + document.documentElement.scrollLeft - 10) 
						left = (document.documentElement.clientWidth - DragObj.offsetWidth + document.documentElement.scrollLeft - 10); 
					else 
						left = a.clientX - x;
				}else{
					if (a.clientX - x <= document.body.scrollLeft + 10)
						left = document.body.scrollLeft + 10; 
					else if (a.clientX - x >= document.body.clientWidth - DragObj.offsetWidth + document.body.scrollLeft - 10) 
						left = (document.body.clientWidth - DragObj.offsetWidth + document.body.scrollLeft - 10); 
					else 
						left = a.clientX - x;
				}

				DragObj.style.left = left + "px";
			}

			var top = a.clientY-y;
			if (top>viewpos.top+10){
				if (xmlns1999){
					if (top < document.documentElement.clientHeight - DragObj.offsetHeight + viewpos.top-10) DragObj.style.top = top + "px";
				}else{
					if (top < document.body.clientHeight - DragObj.offsetHeight + viewpos.top-10) DragObj.style.top = top + "px";
				}
			}
		}
		d.onmouseup = function()
		{
			if(DragObj.releaseCapture)
				DragObj.releaseCapture();
			else if(window.captureEvents)
				window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
			d.onmousemove = null;
			d.onmouseup = null;
		 }
	 }
	 if (fixedcenter)
	 {
		var orig_scroll = null;
		if (window.onscroll) orig_scroll = window.onscroll;
		window.onscroll = function ()
		{
			if (orig_scroll!=null) orig_scroll();

			var viewpos = getScroll();
			if (xmlns1999){
				DragObj.style.left = viewpos.left + (document.documentElement.clientWidth  - DragObj.offsetWidth)/2 + "px";
				DragObj.style.top = viewpos.top + (document.documentElement.clientHeight - DragObj.offsetHeight)/2 + "px";
			}else{
				DragObj.style.left = viewpos.left + (document.body.clientWidth  - DragObj.offsetWidth)/2 + "px";
				DragObj.style.top = viewpos.top + (document.body.clientHeight - DragObj.offsetHeight)/2 + "px";
			}
		}
	}
}

var TxTopPanel = new TopPanel();

var layObj = null;	//覆盖层

function TxAlert(Msg,width,islay){
    if (typeof(width) == 'undifined' || width == null)
    {
        width = 225;
    }
	if (layObj == null) layObj = new TxOverlay();
	if (islay == true)
	{
	    layObj.Show();
	}
	TxTopPanel.Alert('提示',Msg,225,function(){layObj.Close();});
}

//confirm
function TxConfirm(Msg,callBack,callBackCance,width,islay){  //msg-提示信息 callback-点击“确定”的回调函数 callbackcance-点击“取消“的回调函数 width-提示框宽度 islay-是否显示底层覆盖
    if (typeof(width) == 'undifined' || width == null)
    {
        width = 225;
    }
	if (layObj == null) layObj = new TxOverlay();
	if (islay == true)
	{
	    layObj.Show();
	}
	TxTopPanel.Confirm('提示确认',Msg,225,function(){
		layObj.Close();
		if (typeof(callBack)=='function')callBack();
	},function(){layObj.Close();if (typeof(callBackCance)=='function')callBackCance();});
}

//进度条显示
function TxProcessShow(Title,islay){  //title-显示信息 islay-覆盖层是否显示
	if (layObj == null) layObj = new TxOverlay();
	if (islay == true)
	{
	    layObj.Show();
	}
	TxTopPanel.Process(Title);
}
//进度条隐藏
function TxProcessHide(){
	//if (layObj == null) return;
	TxTopPanel.Close();
	if (layObj != null)
	{
	    layObj.Close();
	}
}

//对话框图片预加载
function PreLoadImageFunc()
{
	var Imgsrc = new Array(
		"http://js.itiexue.net/com/tiexue/images/080325_1.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_2.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_3.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_4.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_5.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_6.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_7.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_8.gif",
		"http://js.itiexue.net/com/tiexue/images/080325_9.gif",
		"http://js.itiexue.net/com/tiexue/images/close.gif",
		"http://js.itiexue.net/com/tiexue/images/OkBt.gif",
		"http://js.itiexue.net/com/tiexue/images/CancelBt.gif"
	);
	for (var i=0;i<Imgsrc.length;i++)
	{
		var ImgList = new Image();
		ImgList.src=Imgsrc[i];
	}
}
//PreLoadImageFunc();

//自定义对话框
function CustomDlg(CustomDivID){
	this.DragObjID = 'DragObjID';	//拖动对象
	this.CustomObj = null;
	this.CustomDivID = CustomDivID;
	if (typeof CustomDivID == 'string'){
		this.CustomObj = document.getElementById(CustomDivID);
	}else{
		this.CustomObj = CustomDivID
		this.CustomDivID = this.CustomObj.getAttribute("id");
	}
	this.moveObj = null;
	this.orig_scroll = null;
	this.DraggableFlag = true;
	var arr = navigator.appVersion.split("MSIE");
	if (arr.length==2){
		var version = parseFloat(arr[1]);
		if (version<7){
			this.DraggableFlag= false;
		}
	}
}
CustomDlg.prototype = {
	Show : function(html,IsFixCenter){
		with(this.CustomObj){
			innerHTML = html;
			style.display = "";
			if (IsFixCenter) TxTopPanel.FixCenter(this.CustomDivID);
			if (this.DraggableFlag) drag(this.CustomDivID,this.DragObjID,true);
		}
	},
	Close:function(){
		if (this.CustomObj.innerHTML=="")return;

		if (this.orig_scroll!=null){
			window.onscroll = this.orig_scroll;
		}

		this.CustomObj.innerHTML = "";
		this.CustomObj.style.display = "none";
		
		this.moveObj = null;
		CollectGarbage();
	},
	YUIShow:function(Subject,Content,Width){
		if (typeof(Width)=='undefined') Width='430px';
		var temp = "<div style='visibility:visible;'>";	//z-index:2;top:3px;bottom:-3px;right:-3px;left:3px;background-color:#000;opacity:.12;filter:alpha(opacity=12);

		temp += "<div class='yui-module yui-overlay yui-panel' style='visibility:inherit;width:" + Width + ";height:100%;'>";
		temp += "<div id='" + this.DragObjID + "' class='hd'";
		if (this.DraggableFlag) temp += " style='cursor: move'";
		temp += ">";
		temp += "		<div class='tl'></div>";
		temp += "		<div style='text-align: left'>";
		temp += "			<font size='2'>" + Subject + "</font>";
		temp += "		</div>";
		temp += "		<div class='tr'></div>";
		temp += "	</div>";
		temp += "	<div class='bd'>";
		temp += Content;
		temp += "	</div>";
		temp += "	<div class='container-close' id='YUICloseBt'>&nbsp;</div>";
		temp += "</div>";

		temp += "<div class='underlay'></div></div>";
		this.Show(temp,true);
		temp=null;
		var o=this;
		document.getElementById("YUICloseBt").onclick = function(){o.Close();}
	}
}
function $(ItemId){return document.getElementById(ItemId);}

function AddOnLoad(CallFun)
{
    var oldOnLoad=window.onload;
    if(typeof window.onload != 'function')
    {
        window.onload=CallFun;
    }
    else
    {
        window.onload=function()
        { 
           oldOnLoad();
           CallFun();
        }
    }
}


//记录来源URL
//function TxReferer(){
//	var reurl = document.referrer;
//    if(reurl=="")
//    {
//        reurl="null";
//    }
//    document.write("<iframe name=\"blankForm\" src=\"about:blank\" width=\"0\" height=\"0\"></iframe>");
//    document.write("<form name=\"RefererForm\" action=\"http://www.junph.com/script/setRefererCookie.aspx\" method=\"post\" target=\"blankForm\">");
//    document.write("<input type=\"hidden\" name=\"url\" value=\""+escape(reurl)+"\"/>");
//    document.write("</form>");
//	document.RefererForm.submit();
//}
//TxReferer();

//记录来源URL
document.write("<script language=\"javascript\" id=\"TxJunpinReferer\"></script>");
function TxReferer(){
    var Junph = BaseCookie.GetCookie("IsJunpinReferer");
    if(Junph=="1")
    {
        return;
    }
	var reurl = document.referrer;
    if(reurl=="")
    {
        reurl="null";
    }
    

   $("TxJunpinReferer").src="http://www.junph.com/script/setRefererCookie.aspx?url="+escape(reurl);
}

AddOnLoad(TxReferer);

function RefererSuccess()
{
    BaseCookie.SetCookie("IsJunpinReferer", "1", 2592000);
}