// JScript File
var objPatternName;
function ValidShiftPatternName(patternName,AutoID)
{
	try
	{
		objPatternName = new XmlHttpRequest();
	}
	catch(e)
	{
		try
		{
			objPatternName = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e1)
		{
			objPatternName = new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	
	if(objPatternName != null)
	{
		
		if(patternName != "")
		{
		    if(AutoID=='XYZ')
		    {
		        objPatternName.onreadystatechange = ProcessTheResponsePatternNameValid;		
		        objPatternName.open("GET","AjaxPatternNameValid.aspx?PatternName=" + patternName ,true)
		        objPatternName.send(null);
    		}
    		else
    		{    		    
    		    
    		    objPatternName.onreadystatechange = ProcessTheResponsePatternNameValid;		
		        objPatternName.open("POST","AjaxPatternNameValid.aspx?PatternName=" + patternName +"&AutoID="+AutoID+"" ,true);
		        objPatternName.send(null);
    		
    		}    
		} 
	}
	return false;
}
function ProcessTheResponsePatternNameValid()
{ 
	
        	    
	if (objPatternName.readyState == 4)
	{	           
		if(objPatternName.status == 200)
		{            
            var response=objPatternName.responseText;            
         
            if (response=="Success")
             {
               
             }
            if (response=="Fail")
             {              
    	            
                alert("Pattern Name Already Exists !");
                document.getElementById('ctl00_BodyContentPH_lblPattern_Name').focus();
                
             }
         }
          
	
	}
}


