function GetObj(objName){if(document.getElementById){return eval('document.getElementById("' + objName + '")');}else if(document.layers){return eval("document.layers['" + objName +"']");}else{return eval('document.all.' + objName);}}
/*  AJAX 系列 */
var xmlHttp;
function createXMLHttpRequest()
{
	if(window.ActiveXObject)
	{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
	xmlHttp = new XMLHttpRequest();
	}
}

function validate(obj,url,x){
	createXMLHttpRequest();
	if(xmlHttp)
	{
		url=url+'&username='+obj.value;
		xmlHttp.open('GET',url,true);
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(null);

		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				if(xmlHttp.status==200)
				{	
				
				var str=0;
				str=xmlHttp.responseText;
				
				if(obj.value==''){
					GetObj(x).innerHTML='× Please fill in the name！';
				}else if(str=='1'){
					GetObj(x).innerHTML='√ Can register!';
				}else{
					GetObj(x).innerHTML='× Has been registered！';
				}

				}
				
			}
			
		}
	}


}
//验证密码
function validatePW(obj,id,id2){
	if(GetObj('password').value==''){
		GetObj(id).innerHTML='× Please fill in the Password !';
	}
	
	if(GetObj('password').value!=obj.value){
		GetObj(id2).innerHTML='× Enter two different passwords !';
	}
}
function addMSN(address) {
		var MsgrUIA=GetObj('MsgrUIA');
		try{

		if (MsgrUIA.MyStatus == 1)
		{
			alert('您的MSN没有登陆，请先登陆');
		}
		else if(MsgrUIA.MyStatus == 2 || MsgrUIA.MyStatus == 10 || MsgrUIA.MyStatus == 14 || MsgrUIA.MyStatus == 34 || MsgrUIA.MyStatus == 50 || MsgrUIA.MyStatus == 66 || MsgrUIA.MyStatus == 6) {   //2,10, 14, 34, 50,66,6
			MsgrUIA.InstantMessage(address);
		}
		else if (MsgrUIA.MyStatus == 512 || MsgrUIA.MyStatus == 768)
		{
			alert('您的MSN正在登陆，请稍等');
		}
		else {
			alert('错误代码：'+  MsgrUIA.MyStatus  + '。您没有安装MSN或使用的不是IE浏览器，请安装MSN并手动添加' + address );
		}
		}catch(e){
		alert(e.description);
		}
}


