//check if username exist using ajax
function checkUserAvailability(user,result_div)
{
 if(user=="") 
 {
	 return;
 }
 //show the waiting icon
  result_div.innerHTML="<img src=\"./images/ajaxwait.gif\" /> ";
  var _value=user;
  var xmlHttp;
  try
  {
    /* Firefox, Opera 8.0+, Safari */
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    /* newer IE */
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      /* older IE */
      try
      {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e)
      {
        alert("Your browser is old and does not have AJAX support!");
        return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
  {
    if(xmlHttp.readyState==4)
    {
	  result_div.innerHTML="";
      result_div.innerHTML  +=xmlHttp.responseText;
    }
  }
  xmlHttp.open("GET","checkusername.php?value="+_value,true);
  xmlHttp.send(null);
}
