//Start To check UserName
var xmlHttp;
var last = '0';
function checkCap(enteredcap)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
//Take Requested User Name
reqUsername = enteredcap;
//alert(reqUsername);
var url="check_capch.php?c="+enteredcap;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
	

 	capValid = xmlHttp.responseText;

	/* username_status this variable value Storing it in hidden field becuase when we submit the form just check the User Name staus whether it's availble or not*/
	//alert(username_status);
	//alert("Output text"+username_status);
	
	
	if(capValid == "")
	{
		capValid = "0";
	}
	
	if(capValid == "0")
	{
		document.getElementById('divUserNameStatus').innerHTML = "<font style='color:red; font-size:10pt'>Incorrect Security code,Please retype.</font>";
		document.getElementById('divUserNameStatusValue').innerHTML = "0";
		//document.frmsignup.hidCheckUserName.value = "0";
	}
	else
	{
		document.getElementById('divUserNameStatus').innerHTML = "<font style='color:green; font-size:10pt'>Correct Security code.</font>";
		//document.getElementById('hidCheckUserName').value = "1"; 
		document.getElementById('divUserNameStatusValue').innerHTML = "1";
	}
	

	document.getElementById('hidcapst').value = capValid;
	   
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}