// JScript File

var objecEmpCode;
function ValidEmpCode(EmpCode,AutoID)
{
	
	try
	{
		objecEmpCode = new XmlHttpRequest();
	}
	catch(e)
	{
		try
		{
			objecEmpCode = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			objecEmpCode = new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	
	if(objecEmpCode != null)
	{
		
		if(EmpCode != "")
		{
		    if(AutoID=='XYZ')
		    {
		        objecEmpCode.onreadystatechange = ProcessTheResponseEmpCodeValid;		
		        objecEmpCode.open("GET","AjaxEmpCodeValid.aspx?EmpCode=" + EmpCode ,true)
		        objecEmpCode.send(null);
    		}
    		else
    		{
    		    objecEmpCode.onreadystatechange = ProcessTheResponseEmpCodeValid;		
		        objecEmpCode.open("POST","AjaxEmpCodeValid.aspx?EmpCode=" + EmpCode +"&AutoID="+AutoID+"" ,true);
		        objecEmpCode.send(null);
    		
    		}    
		} 
	}
	return false;
}
function ProcessTheResponseEmpCodeValid()
{ 
	if (objecEmpCode.readyState == 4)
	{
		if(objecEmpCode.status == 200)
		{
            var response=objecEmpCode.responseText;
            //alert(response);          
         
         if (response=="Success")
             {
             
             }
         if (response=="Fail")
             {
                alert("Employee ID Already Exists !");
                document.getElementById('ctl00_BodyContentPH_txt_EmpID').focus();
                
             }
         }
          
	
	}
}

