

function getHttpRequest()
{
	try
	{
	req = new XMLHttpRequest();
	}

	catch(err1)
	{
  		try
		{
  			req = new ActiveXObject("Msxml2.XMLHTTP");
  	    }

	catch (err2)
	{
    	try
		{
    		req = new ActiveXObject("Microsoft.XMLHTTP");
    	}

	catch (err3)
	{
      req = false;
    }
  	}
	}
return req;
}

var getRequest=getHttpRequest();
function getHttpConnection()
{
	var user_name=document.frmSignUp.username.value;
	var myurl = "check_name_Availability.php?user_name="+escape(user_name);
  	getRequest.open("GET", myurl, true);
	getRequest.onreadystatechange = useHttpResponse;
  	getRequest.send(null);
}


function useHttpResponse()
{
   if (getRequest.readyState == 4)
   {
    	if(getRequest.status == 200)
		{
      		var mytext = getRequest.responseText;
			if(mytext!='')
			{
      			document.getElementById('check_username').innerHTML = "<font color='blue'><strong>"+mytext+"</font></strong>";
			}else
			{
				document.getElementById('check_username').innerHTML = "<font color='green'><strong>Success. Your User Name is Available</font></strong>";
			}
			document.frmSignUp.username.focus();
			return false;

		}

  }

  else
  {
  	document. getElementById('check_username').innerHTML = "<strong>Checking Availability...</strong>";
  }

}