// JavaScript Document


function checkAvailability(strFieldName)
{
    var loginName=getRef(strFieldName).value;
	if(isWhitespace(loginName))
	{
		alert("Please Enter User Name");
		getRef(strFieldName).focus();
		return false;
	}
	
	//send to server
   // send request through ajax....
   createAjaxObj();
   xmlindicator=(arguments.length>0)? 1 : 0;
   var url = URL_ROOT + "ajaxServer/LoginNameAvailability.aspx?task=check&loginName=" + loginName ;
   xmlHttp.open("GET", url);
   getRef('DivAvailabilityResult').innerHTML ="Please Wait...";
   xmlHttp.onreadystatechange = callBackCheckAvailability;
   xmlHttp.send(null);

}

function callBackCheckAvailability()
{
	if(xmlHttp.readyState == 4) 
	{
		if(xmlHttp.status == 200) 
		{
			getRef('DivAvailabilityResult').innerHTML =xmlHttp.responseText;
		}
		else if(xmlHttp.status == 404) 
		{
			alert("Sorry, Resource Is Unavailable");
		}
		else 
		{
			alert("Sorry, Unexpected Response Status: " + xmlHttp.status);
		}

	}
}

