var xmlHttp

function check()
{  
document.getElementById("txtHint").innerHTML="<button  onclick='vali()'>check</button>";
}



function vali()
{ 
xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  var name=document.frm.user_type.value ;
  document.getElementById("txtHint").innerHTML="<b>Checking please wait.....</b><img src=images/loading.gif >";
  
var url="namevalidate/ajaxvalidate_signup.php";
par="q="+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);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp3=null;

 try
  {
  // Firefox, Opera 8.0+, Safari
 // document.write(1);
   xmlHttp3=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
     // document.write(2);
    xmlHttp3=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
      //document.write(3);
    xmlHttp3=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp3;
}
