var Xmlhttp;
//判断用户名是否被占用
function changefun_user(type,URL)
{
		var s1_value=document.getElementById("username").value;
		if(s1_value!="")
		{
			var data='username=' + s1_value;
			Xmlhttp=createXmlhttp();
			Xmlhttp.open("POST",URL,true);
	        	Xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	        	Xmlhttp.send(data);
	        	Xmlhttp.onreadystatechange=resultStr2;
	        }
	        else
	        {
	        	var s1_value=document.getElementById("usercheck_str");	
	        	s1_value.innerHTML="<font color='#ff0000'>*用户名不能为空</font>";
	        }
}
function createXmlhttp()
{
	var objhttp=null;
	try 
	{
		objhttp=new ActiveXObject('Microsoft.XMLHTTP') ;
	} 
	catch(oc)
	{ 
		objhttp=null ;
	}
	if ( !objhttp && typeof XMLHttpRequest != 'undefined' ) { 
		objhttp=new XMLHttpRequest();
	}
	return objhttp;
}
function resultStr2()
{
    if(Xmlhttp.readyState==4)
	{
		if(Xmlhttp.status==200)
		{
			var result;
			result=Xmlhttp.responseText;
			var s1_value=document.getElementById("usercheck_str");
			if(result==1)
			{
				s1_value.innerHTML="<font color='#ff0000'>*该用户名可用</font>";
			}
			else
			{
				s1_value.innerHTML="<font color='#ff0000'>*该用户名已被占用</font>";	
			}
		}
	}
}