// JScript File
var objDisc;
function CheckDiscrepanceTime(inDate, inTime, outDate, outTime)
{
       if(window.ActiveXObject)
        {    
	        try
	        {
		        objDisc = new ActiveXObject("Msxml2.XMLHTTP");
	        }
	        catch(e)
	        {
		        try
		        {
			        objDisc = new ActiveXObject("Microsoft.XMLHTTP");
		        }
		        catch(e1)
		        {
			        objDisc = null;
		        }
	        }
        }  
         else if(window.XMLHttpRequest)
         {
	        try
	        {
		        objDisc = new XMLHttpRequest("Msxml2.XMLHTTP");
	        }
	        catch(e)
	        {
		        try
		        {
			        objDisc = new XMLHttpRequest("Microsoft.XMLHTTP");
		        }
		        catch(e1)
		        {
			        objDisc = null;
		        }
	        }
        }  
//    try
//	{
//		objDisc = new XmlHttpRequest();
//	}
//	catch(e)
//	{
//		try
//		{
//			objDisc = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(e1)
//		{
//			objDisc = new ActiveXObject("Msxml2.XMLHTTP");
//		}
//	}
    if(objDisc!=null)
	{
        var rndValue=Math.floor(Math.random()*111);
        if(window.ActiveXObject)
        {
            objDisc.onreadystatechange = ResponseCheck;
            objDisc.open("POST", "../Transactions/DiscrepancyRemote.aspx?inDate=" +inDate + "&inTime=" + inTime + "&outDate=" + outDate + "&outTime="+ outTime +"&rndValue="+rndValue,  false);
	        objDisc.send(null);
	    }
	    else if(window.XMLHttpRequest)
        {
             objDisc.open("POST", "../Transactions/DiscrepancyRemote.aspx?inDate=" +inDate + "&inTime=" + inTime + "&outDate=" + outDate + "&outTime="+ outTime +"&rndValue="+rndValue,  false);
	         objDisc.send(null);
	         objDisc.onreadystatechange = ResponseCheck();
        }
	}
}
function ResponseCheck()
{
    if (objDisc.readyState == 4)
	{	           	
		if(objDisc.status == 200)
		{    
		 var response=objDisc.responseText;                        
            if (response=="Success")
             {
                    // no overlapping of shift time   
                    document.getElementById("hidFlag").value=0;
                    return 1;
             }
           else
           {
              // over laps of the shift time
               document.getElementById("hidFlag").value=response;
               //alert(response);
               return 0;
           }          
		}
	}
}