﻿function getCookie(name,t){
	var errtxt=""; 
	var err; 
	try 
	{ 
		var strCookie=document.cookie;
		var arrCookie=strCookie.split(name);
		if(arrCookie.length>=2){
			var arrValue=arrCookie[1].split(t+"=");
			if(arrValue.length>=2)
			{
				var value = arrValue[1];
				if(value!="") 
				{
					var temp=value.split("&");
					return temp[0];
				}
				else
				{
					return "";
				}
			}
			else
			{
				return "";
			}
		}
		return "";
	} 
	catch(err) 
	{ 
		errtxt=err.message; 
		alert(errtxt);
		var errtxt=""; 
		return "";
	}
}

function display(t)
{
	var  a=getCookie("sale_namespace",t);
	return a;
}

function getDateMsg()
{
	var Digital=new Date();
	var hours=Digital.getHours();
	var dn="上午";
	if(hours>=23)
	{
		dn = "深夜";
	}
	else if(hours>=18)
	{
		dn = "晚上";
	}
	else if(hours>=13)
	{
		dn = "下午";
	}
	else if(hours>=11)
	{
		dn = "中午";
	}
	else if(hours>=6)
	{
		dn = "上午";
	}
	else if(hours>=0)
	{
		dn = "凌晨";
	}
	return dn;
}

if(display("username")!="")
{
	var dn = getDateMsg();
	document.write(dn+'好，'+decodeURI(display("username"))+'，欢迎来到携购网  <a href=http://www.xiegoo.com/saleadmin/ class=linkBlue>[ 用户中心 ]</a> <a  href=# onclick="javascript:if(log_out()){window.location=\'http://www.xiegoo.com/saleadmin/logout.aspx\';}"} class=linkBlue>[ 退出登陆 ]</a>');
}
else
{
	document.write('您好，欢迎来到携购网 <a href=http://www.xiegoo.com/xg_sale_reg.htm class=linkBlue>[ 免费注册 ]</a> <a href=http://www.xiegoo.com/saleadmin/login.htm class=linkBlue>[ 登陆 ]</a>');
}
	
