﻿function createXmlHttp()
		{
			this.xmlHttp=this.getXmlHttp();
		}
		createXmlHttp.prototype.getXmlHttp =function()
		{
			var xmlHttp;
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				
			}catch(e)
			{
				alert(e.name+e.message);
			}
			return xmlHttp;
		}
		createXmlHttp.prototype.change =function()
		{
			if(this.xmlHttp.readyState==1)
			{
				//alert("1");
			}
			if(this.xmlHttp.readyState==2)
			{
				//alert("2");
			}
			if(this.xmlHttp.readyState==3)
			{
				//alert("3");
			}
			if(this.xmlHttp.readyState==4)
			{			
				if(this.xmlHttp.status==0)
				{
					alert("0");	
				}
				else if(this.xmlHttp.status==200 && this.xmlHttp.statusText=="OK")
				{
				
					this.OnComplete(this.xmlHttp.responseText);
				}
				else
					alert("xmlHttp.status error!!!");
			}

		}
		createXmlHttp.prototype.OnComplete =function(responseText)
		{
		}
		createXmlHttp.prototype.sendRequest=function(url)
		{
			if(this.xmlHttp)
			{
						
				if(this.xmlHttp.readyState==4 || this.xmlHttp.readyState==0)
				{
					var oThis=this;
					this.xmlHttp.open('POST',url);
					this.xmlHttp.onreadystatechange=function()
					{
						oThis.change();
					};
					this.xmlHttp.send(null);
				}
				else
				alert("Error!!");
			}
			else
				alert("xmlHttp==false");
		}
		function getData(responseText)
		{
		    document.getElementById("showCheckMessage").innerHTML=responseText;
		}
		function isCheck(str)
		{
		    if(str==""||str.length<4||str.length>16||str.replace(/\w/g,   "").length!=0)
		    {
		        document.getElementById("showCheckMessage").innerHTML="用户名只能是4-16个英文字母或数字";
		    }
		    else
		    {
			    var cbo=new createXmlHttp();
			    cbo.OnComplete=getData;
			    cbo.sendRequest("Next.aspx?userName="+str);
			}
		}

