var xmlHttp

function GetXmlHttpObject()
{
var xmlHttp2=null;

 try
  {
  // Firefox, Opera 8.0+, Safari
 // document.write(1);
   xmlHttp2=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
     // document.write(2);
    xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
      //document.write(3);
    xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp2;
}


function validate_username()
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	  
	var name=document.frm.username.value;
	
	if(name!=null && name!="")
	{
	
	document.getElementById("txtHint").innerHTML="<font color='green'>Checking username </font><img src='../../main/themes/images/icons/loading.gif' >";
	
	var url="ajaxvalidate_signup.php";
	var par="username="+name;
	
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", par.length);
	xmlHttp.setRequestHeader("Connection", "close");
	
	xmlHttp.send(par);
	
	}
	else
	{
		document.getElementById("txtHint").innerHTML="<font color='red'><img src='../../main/themes/images/icons/exclamatn.gif' /> Please enter username</font>";
	}
}


function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}
}