// JScript File
/// Count Number Remaining Leave Days
function NumberOfdays
(
Selectvalidfromsessionandtosession,
Halfdayisnotallowed,
Selectvalidyear,
LeaveFromDateshouldnotbegreaterthanLeaveToDate,
Leaveshouldnotbeappliedbeforedateofjoining,
NoLeavePolicyexistsforthisLeaveFromDateorToDate,
Leaveshouldbeappliedapplicableafterdays,
YouareselectingHoliday,
YouareselectingWeeklyOffinFromdate,
YouareselectingWeeklyOffinTodate,
YouareselectingWeeklyOff,
LeaveApplicationcannotberaisedduringWeeklyOffGlobalHoliday,
SelectLeaveandLeaveTypeId,
Shiftnotallocated,
SelectValidFromDateandToDate,
YouhavechoosedafterweeklyOffOneDayAdded,
YouhavechoosedBeforeweeklyOffOneDayAdded,
YouhaveselectedInterveningweeklyOffGlobalHoliday,
DayDeducted,
Dayincluded,
InvalidApplicationDate,
ExceedSuccessiveDays
) {
    if (window.ActiveXObject) {
        try {
            obj = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                obj = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                obj = null;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            obj = new XMLHttpRequest("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                obj = new XMLHttpRequest("Microsoft.XMLHTTP");
            }
            catch (e1) {
                obj = null;
            }
        }
    }
    if (obj != null) {
        debugger;
        if (document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display == "block") {
            return;
        }
        var EmployeeId;
        EmployeeId = document.getElementById('ctl00_BodyContentPH_hdnEmployeeId').value;
        if (EmployeeId == "-Select-" || EmployeeId == "") {
            document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
            document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return;
        }
        if (EmployeeId == "" && document.getElementById('ctl00_BodyContentPH_ddl_Type').value != "-Select-") {
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return;
        }
        if (document.getElementById('ctl00_BodyContentPH_ddl_Type').value == "-Select-") {
            document.getElementById('ctl00_BodyContentPH_ddl_Type').selectedIndex = 0;
            document.getElementById('ctl00_BodyContentPH_ddl_Type').focus();
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return;
        }
        if (document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').value == "-Select-") {
            document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').selectedIndex = 0;
            document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').focus();
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return;
        }
        debugger;
        var FromDate = document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value;
        if (FromDate == "") {
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return false;
        }
        var ToDate = document.aspnetForm.ctl00_BodyContentPH_txtToDate.value;
        if (ToDate == "") {
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return false;
        }
        debugger;
        if (window.ActiveXObject) {
            obj = new ActiveXObject("Microsoft.XMLHTTP");
        } else if (window.XMLHttpRequest) {
            obj = new XMLHttpRequest();
        }
        debugger;
        if (obj) {
            var url = "EmployeeName.aspx?EmployeeIdLeaveforCompanssionate=" + encodeURIComponent(EmployeeId);

            obj.onreadystatechange = function () {
                if (obj.readyState === 4 && obj.status === 200) {
                    var response = obj.responseText;
                    debugger;
                    // Handle response
                    if (response === "false") {
                        document.getElementById('ctl00_BodyContentPH_HdnEmployeeLeaveCompans').value = response;
                        alert("Already spent the maximum available yearly limit of 2 times");
                        return false;
                    }
                }
            };

            obj.open("GET", url, true);
            obj.send(null);
        }



        var TosessionIndex = document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex;
        var Tosession = document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.options[TosessionIndex].value;
        var FromsessionIndex = document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.selectedIndex;
        var Fromsession = document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.options[FromsessionIndex].value;
        if (FromsessionIndex == 0 && TosessionIndex == 0) {
            document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
            document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return false;
        }
        else if (FromsessionIndex == 0) {
            document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
            document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return false;
        }
        else if (TosessionIndex == 0) {
            document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
            document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            return false;
        }
        if (FromsessionIndex == 2 && TosessionIndex == 1) {
            if (FromDate == ToDate) {
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
                alert(Selectvalidfromsessionandtosession);
                return;
            }
        }
        document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "block";
        var ApplicationYearsetting = document.getElementById('ctl00_BodyContentPH_hdnFinalValue').value;
        if (document.getElementById('ctl00_BodyContentPH_rbtnCurrentYear').checked == true) {
            ApplicationYearsetting = document.getElementById('ctl00_BodyContentPH_hdnApplicationYear').value;
        }
        else if (document.getElementById('ctl00_BodyContentPH_rbtnSuccessiveYear').checked == true) {
            ApplicationYearsetting = document.getElementById('ctl00_BodyContentPH_hdnSuccessiveYear').value;
        }
        var leavetypename = document.getElementById('ctl00_BodyContentPH_ddl_Type').value;
        var hdnLeaveTypeId = document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').value;

        var e = document.getElementById("ctl00_BodyContentPH_ddl_LeaveType");
        var value = e.options[e.selectedIndex].value;// get selected option value.
        var selectedleavetypetext = e.options[e.selectedIndex].text;


        var k = Math.floor(Math.random() * 111);
        var link = "NumberofDaysCount.aspx?";
        link = link + "&" + "FromDate=" + FromDate;
        link = link + "&" + "ToDate=" + ToDate;
        link = link + "&" + "Fromsession=" + Fromsession;
        link = link + "&" + "Tosession=" + Tosession;
        link = link + "&" + "LeaveTypeId=" + hdnLeaveTypeId;
        link = link + "&" + "EmployeeId=" + EmployeeId;
        link = link + "&" + "leavetypename=" + leavetypename;
        link = link + "&" + "ApplicationYear=" + ApplicationYearsetting;
        link = link + "&" + "selLeaveType=" + selectedleavetypetext;
        link = link + "&" + "k=" + k;
        debugger;
        if (window.ActiveXObject) {
            obj.onreadystatechange = ProcessResponseNumberOfDays;
            obj.open("POST", link, true);
            obj.send(null);
        }
        else if (window.XMLHttpRequest) {
            obj.open("POST", link, false);
            obj.send(null);
            obj.onreadystatechange = ProcessResponseNumberOfDays();
        }
    }
}
function ProcessResponseNumberOfDays() {
    debugger;
    if (obj.readyState == 4) {
        if (obj.status == 200) {
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            var responseDays = obj.responseText;
            if (responseDays == "HalfDayIsDisabled") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(Halfdayisnotallowed);
                return;
            }
            if (responseDays == "InvalidApplicationDate") {
                alert(InvalidApplicationDate);
                return;
            }
            if (responseDays == "ExceedSuccessiveDays") {
                alert(ExceedSuccessiveDays);
                return;
            }
            if (responseDays == "InvalidYear") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(Selectvalidyear);
                return;
            }
            if (responseDays == "InvalidDate") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert("Select Valid Date");
                return;
            }
            if (responseDays == "FromToDates") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(LeaveFromDateshouldnotbegreaterthanLeaveToDate);
                return;
            }
            if (responseDays == "DateOfJoining") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(Leaveshouldnotbeappliedbeforedateofjoining);
                return;
            }
            if (responseDays == "NoLeavePolicyDates") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(NoLeavePolicyexistsforthisLeaveFromDateorToDate);
                return;
            }
            if (responseDays == "ApplicableAfterDays") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(Leaveshouldbeappliedapplicableafterdays);
                return;
            }
            if (responseDays == "Holiday") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(YouareselectingHoliday);
                return;
            }
            if (responseDays == "WeeklyOffFromDate") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(YouareselectingWeeklyOffinFromdate);
                return;
            }
            if (responseDays == "WeeklyOffToDate") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(YouareselectingWeeklyOffinTodate);
                return;
            }
            if (responseDays == "WeeklyOff") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(YouareselectingWeeklyOff);
                return;
            }
            if (responseDays == "HolidayWeeklyOff") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(LeaveApplicationcannotberaisedduringWeeklyOffGlobalHoliday);
                return;
            }
            if (responseDays == "NoLeaveTypeId") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(SelectLeaveandLeaveTypeId);
                return;
            }
            if (responseDays == "ShiftNotAllocated") {
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                alert(Shiftnotallocated);
                return;
            }
            var NumberOfDays = responseDays.split(",");
            if (NumberOfDays[0] < 0) {
                alert(SelectValidFromDateandToDate);
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
                return;
            }
            else if (NumberOfDays[1] == 0) {
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == 1) {
                //Added By Manikandan.R on 11-06-2015 03.53 pm
                document.getElementById('ctl00_BodyContentPH_Intervening').value = "A";
                alert(YouhavechoosedafterweeklyOffOneDayAdded);
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == 2) {
                alert(YouhavechoosedBeforeweeklyOffOneDayAdded);
                //Added By Manikandan.R on 11-06-2015 03.53 pm
                document.getElementById('ctl00_BodyContentPH_Intervening').value = "B";
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == 3) {
                alert(YouhaveselectedInterveningweeklyOffGlobalHoliday + NumberOfDays[2] + DayDeducted);
                //Added By Manikandan.R on 11-06-2015 03.53 pm
                document.getElementById('ctl00_BodyContentPH_Intervening').value = "N";
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == 4) {
                alert(YouhaveselectedInterveningweeklyOffGlobalHoliday + NumberOfDays[2] + Dayincluded);
                document.getElementById('ctl00_BodyContentPH_Intervening').value = "I";
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == 5) {
                alert("You have choosed After Weeklyoff\\Holiday,One Day Added");
                //Added By Manikandan.R on 11-06-2015 03.53 pm
                document.getElementById('ctl00_BodyContentPH_Intervening').value = "A";
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == 6) {
                alert("You have choosed Before Weeklyoff\\Holiday,One Day Added");
                //Added By Manikandan.R on 11-06-2015 03.53 pm
                document.getElementById('ctl00_BodyContentPH_Intervening').value = "B";
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
            else if (NumberOfDays[1] == -1) {
                document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = NumberOfDays[0];
                document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = NumberOfDays[0];
                return;
            }
        }
    }
}
//old code
//function NumberOfdays()
//{
//	try
//	{
//		obj = new XmlHttpRequest();
//	}
//	catch(e)
//	{
//		try
//		{
//			obj = new ActiveXObject("Microsoft.XMLHTTP");
//		}
//		catch(e1)
//		{
//			obj = new ActiveXObject("Msxml2.XMLHTTP");
//		}
//	}
//	
//	if(obj != null)
//	{
//	
//	if(document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display=="block")
//	{
//	    return;	
//	}
//	
//	var EmployeeId;
//    EmployeeId=document.getElementById('ctl00_BodyContentPH_hdnEmployeeId').value;
//    
//    if(EmployeeId=="-Select-")
//    {
//        alert("Select an Employee");
//        return;
//    }
//    if(EmployeeId=="" && document.getElementById('ctl00_BodyContentPH_ddl_Type').value!="-Select-")
//    {
//    //alert("Select an Employee");
//    document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//    return;
//    }
//    //alert(document.getElementById('ctl00_BodyContentPH_ddl_Type').selectedIndex);
//    if(document.getElementById('ctl00_BodyContentPH_ddl_Type').value=="-Select-")
//    {
//    document.getElementById('ctl00_BodyContentPH_ddl_Type').selectedIndex=0;
//    document.getElementById('ctl00_BodyContentPH_ddl_Type').focus();
//    //alert('Select Leave Type');
//    document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//    return;
//    }
//    if(document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').value=="-Select-")
//    {
//    document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').selectedIndex=0;
//    document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').focus();
//    //alert('Select Leave Type');
//    document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//    return;
//    }
//	
//	var FromDate=document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value;
//	if(FromDate=="")
//	{
//	    document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//	    return false;
//	}
//	  
//	var ToDate=document.aspnetForm.ctl00_BodyContentPH_txtToDate.value;
//	if(ToDate=="")
//	{
//	    document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//	    return false;
//	   
//	}
//	  var TosessionIndex=document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex;
//	  var Tosession=document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.options[TosessionIndex].value;   
//	  var FromsessionIndex=document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.selectedIndex;
//	  var Fromsession=document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.options[FromsessionIndex].value;   
//	    
//	    
//	    if(FromsessionIndex==0 && TosessionIndex==0)
//	    {
//	    	document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value="";
//	        document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	        document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//	        return false;
//	    }
//		else if(FromsessionIndex==0)
//	    {
//	        //alert("Select From Session");
//	        document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value="";
//	        document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	        document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//	        return false;
//	    }
//	    else if(TosessionIndex==0)
//	    {
//	        //alert("Select To Session");
//	        document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value="";
//	        document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//            return false;
//	    }
//	 
//	 if(FromsessionIndex==2 && TosessionIndex==1)
//	 {
//	 if(FromDate==ToDate)
//	 {
//	 document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value="";
//	 document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	 document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//	 alert("Select valid from session and to session");
//	 return;
//	 }
//	 }
//	  
//	  document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="block";
//	  
//	  var leavetypename=document.getElementById('ctl00_BodyContentPH_ddl_Type').value;
//	  var hdnLeaveTypeId=document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').value;
//	  var k=Math.floor(Math.random()*111);
//		    var link = "NumberofDaysCount.aspx?";
//		    link = link + "&" + "FromDate=" + FromDate;
//		    link = link + "&" + "ToDate=" + ToDate;
//		    link = link + "&" + "Fromsession=" + Fromsession;
//		    link = link + "&" + "Tosession=" + Tosession;
//		    link=link + "&" + "LeaveTypeId=" + hdnLeaveTypeId;
//		    link=link + "&" + "EmployeeId=" + EmployeeId;
//		    link=link + "&" + "leavetypename=" + leavetypename;
//		    link=link + "&" + "k=" + k;
//		    obj.onreadystatechange = ProcessResponseNumberOfDays;		
//		    obj.open("POST", link, true);
//		    obj.send(null);
//		
//	}
//	
//}
//function ProcessResponseNumberOfDays()
//{
//	if (obj.readyState == 4)
//	{
//		if(obj.status == 200)
//		{
//		  document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display="none";
//		
//	      var responseDays=obj.responseText;
//	      
//	       if(responseDays=="FromToDates")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("Leave From Date should not be greater than Leave To Date");
//	      return;
//	      }
//	      
//	      if(responseDays=="DateOfJoining")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("Leave should not be applied before date of joining");
//	      return;
//	      }
//	      if(responseDays=="NoLeavePolicyDates")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("No Leave Policy exists for this Leave From Date or To Date");
//	      return;
//	      }
//	      if(responseDays=="ApplicableAfterDays")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("Leave should be applied, applicable after days");
//	      return;
//	      }
//	      if(responseDays=="Holiday")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("You are selecting Holiday");
//	      return;
//	      } 
//	      if(responseDays=="WeeklyOffFromDate")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("You are selecting Weekly Off in From date");
//	      return;
//	      } 
//	      if(responseDays=="WeeklyOffToDate")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("You are selecting Weekly Off in To date");
//	      return;
//	      } 
//	      if(responseDays=="WeeklyOff")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("You are selecting Weekly Off");
//	      return;
//	      } 
//	      if(responseDays=="HolidayWeeklyOff")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("Leave Application cannot be raised during Weekly Off / Global Holiday");
//	      return;
//	      } 
//	      if(responseDays=="NoLeaveTypeId")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("Select Leave and LeaveTypeId");
//	      return;
//	      }
//	      if(responseDays=="ShiftNotAllocated")
//	      {
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      alert("Shift not allocated");
//	      return;
//	      }
//	      var NumberOfDays=responseDays.split(",");
//	      
//	      if(NumberOfDays[0]<0)
//	      {
//	      alert("Select Valid From Date and To Date");
//	      document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value="";
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value="";
//	      return;
//	      }
//	      else if(NumberOfDays[1]==0)
//	      {
//          document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value=NumberOfDays[0];
//          document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value=NumberOfDays[0];
//          return;
//	      }
//	      else if(NumberOfDays[1]==1)
//	      {
//	      alert("You have choosed after weekly Off, One Day Added");
//	      document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value=NumberOfDays[0];
//	      
//          document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value=NumberOfDays[0];
//          return;
//	      }
//	      else if(NumberOfDays[1]==2)
//	      {
//	      alert("You have choosed Before weekly Off, One Day Added");
//	      document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value=NumberOfDays[0];
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value=NumberOfDays[0];
//          return;
//	      }
//	      else if(NumberOfDays[1]==3)
//	      {
//	      alert("You have selected Intervening weekly Off / Global Holiday " + NumberOfDays[2] +" Day(s) Deducted");
//	      document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value=NumberOfDays[0];
//	      document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value=NumberOfDays[0];
//          return;
//	      }
//	      else if(NumberOfDays[1]==4)
//	      {
//	      alert("You have selected Intervening weekly Off / Global Holiday " + NumberOfDays[2] +" Day(s) included ");
//   	      document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value=NumberOfDays[0];
//          document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value=NumberOfDays[0];
//          return;
//	      }
//	      else if(NumberOfDays[1]==-1)
//	      {
//	      document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value=NumberOfDays[0];
//          document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value=NumberOfDays[0];
//          return;
//	      }
//	      }
//	}
//}