﻿function addloadevent(thefunc){
var oldfunc=window.onload;
if (typeof oldfunc!='function'){
window.onload=thefunc;
}
else{
window.onload=function(){
	oldfunc();
	thefunc();
}
}
}
function createxmlhttp()
{
xmlhttpobj = false;
try{
xmlhttpobj = new XMLHttpRequest;
}catch(e){
try{
xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
}catch(e2){
try{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e3){
xmlhttpobj = false;
}
}
}
return xmlhttpobj;
} 

function getlogin(){
var xmlhttpobj=createxmlhttp();
var myurl="http://www.365ebuy.com/365include/user/getmailnum1.asp?time="+new Date().getTime()
xmlhttpobj.onreadystatechange=getloginstatus;
xmlhttpobj.open("get",myurl,"true");
xmlhttpobj.send(null);
}
function getloginstatus(){
if(xmlhttpobj.readyState==4){
	if(xmlhttpobj.status==200){
		var getlogindiv=document.getElementById("getlogin");
		var myobj=xmlhttpobj.responseXML.documentElement;
		listuser=myobj.getElementsByTagName("username")[0].firstChild.nodeValue;
		mailnum=myobj.getElementsByTagName("mailnum")[0].firstChild.nodeValue;
		if(listuser=='need log'){
			backhtml="<div class=unlog style='float:left'><span><a target=_self href='http://www.365ebuy.com/reg.asp?from=top'>会员注册</a>&nbsp;</span><span><a target=_self href='http://www.365ebuy.com/login.asp'>会员登陆</a></span>"
		}else{
			backhtml="<div class=logged style='float:left'><span style='width:100px'>您好,"+listuser+"|</span><span><a style='width:50px' target=_self href=http://www.365ebuy.com/user/myorder.asp>会员中心</a>|</span><span style='width:65px;padding-left:18px;' id='mailalert'><a target=_self href=http://www.365ebuy.com/user/sitemail.asp>新邮件("+mailnum+")</a>|</span><span style='width:35px'><a target=_self href=http://www.365ebuy.com/logout.asp>退出</a></span>"
		}
		backhtml=backhtml+"</div><div style='float:right;margin-left:5px'><a href='http://www.365ebuy.com/help/fanliswf.asp' target=_self><img src='../images/xssl.gif'></a></div>"
		getlogindiv.innerHTML=backhtml;
		}
	}
}

