<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="TA_UI_Transactions_LeaveApplicationAdd.aspx.cs"
    Inherits="Transactions_TA_UI_Transactions_LeaveApplicationAdd" MasterPageFile="~/MasterFile/TimeCheck.master" %>

<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxe" %>
<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<%@ Register Src="~/UserControls/TA_uc_OrgLevelFilter_Updated.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="conLeaveApplicationAdd" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <!--[if gt IE 5.5]>
	<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />
	<link rel="stylesheet" type="text/css" href="../css/anytimeIE.css" />
<![endif]-->

    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>

    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>

    <script language="javascript" src="../js/DateTimeValidation.js" type="text/javascript"></script>

    <script language="javascript" src="../js/CountNodays.js" type="text/javascript"></script>

    <script language="javascript" src="../js/Emp_Leave.js" type="text/javascript"></script>

    <script language="javascript" src="../js/anytime.js" type="text/javascript"></script>

    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>

    <script>
        function WeekdayValidation() {
            var EmpId = document.getElementById('ctl00_BodyContentPH_txtEmployeeId');
            var EmpName = document.getElementById('ctl00_BodyContentPH_txt_EmpName');
            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtLeaveStartDate;
            var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txtLeaveEndDate;
            var swipCard = document.getElementById('ctl00_BodyContentPH_txtSwipeCard');
            if (EmpName == null && EmpId == null && weekDay.value == '' && weekDay2.value == '' && swipCard == null) {
                alert(EnterDetails);
                return false;
            }
            else if ((weekDay.value == '' && weekDay2.value != '') || (weekDay.value != '' && weekDay2.value == '')) {
                alert(FillFromandToDate);
                return false;
            }
            var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if (weekDay.value != '') {
                if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                    if (weekDay2.value != '') {
                        if (checkDate(weekDay2, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        document.getElementById('ctl00_BodyContentPH_txtLeaveEndDate').focus();
                        return false;
                    }
                }
                else {
                    return false;
                }
            }
        }
        $(function () {
            $('#ctl00_BodyContentPH_txtFromDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        function navi(loc) {
            document.getElementById('ctl00_BodyContentPH_iframePopup').src = loc;
            return false;
        }
        $(function () {
            $('#ctl00_BodyContentPH_txtLeaveStartDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtLeaveEndDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </script>

    <script language="javascript" src="../js/EmpLeaveApplication.js" type="text/javascript"></script>

    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>

    <script language="javascript" src="../js/fancydropdown.js" type="text/javascript"></script>

    <script language="javascript" src="../js/ShiftExchange.js" type="text/javascript"></script>

    <%--<script language="javascript" src="../js/ShiftExchange.js" type="text/javascript"></script>--%>

    <script language="javascript" src="../js/EmployeeNameAjax.js" type="text/javascript"></script>

    <script type="text/javascript">
        if (navigator.userAgent.toLowerCase().indexOf('chrome') != -1)
            document.write('<link href="../css/safari.css" rel="stylesheet" type="text/css" />');
    </script>

    <script type="text/javascript">
        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        //Adding this line var Datefourdigit='Please enter valid date with correct format dd/MM/yyyy'; as newly
        var Datefourdigit = 'Please enter valid date with correct format dd/MM/yyyy';
        var Invalidyearentry = 'Invalid year entry';
        var Invalidmonthentry = 'Invalid month entry';
        var Invaliddateentry = 'Invalid date entry';
        var DateformatDDMONYYYY = 'Incorrect date format. Enter as DD-MON-YYYY';
        var Entertime = 'Enter time';
        var Valueforhours = 'Invalid value for hours:';
        var Invalidvalueforminutes = 'Invalid value for minutes:';
        var Invalidtimeformat = 'Invalid time format:';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var ValiddatemonthMMDDYYHHMM = 'Please enter valid Date and Time MM/dd/yyyy HH:mm';
        var ValiddatemonthMMDDYYHHMMTT = 'Please enter valid Date and Time MM/dd/yyyy hh:mm tt';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var Invalidvalueforhours = 'Invalid value for hours:';
        var Invalidvalueforminites = 'Invalid value for minutes:';
        var NoRecords = "No Records";
        var ErrorinRetrive = "Error in retriving details";
        var Select = "-Select-";
        var MaxLength = "Maximum length is ";
        var Others = "Others";
        function Emp(noRecords, errorinRetrive, select, others) {
            NoRecords = noRecords;
            ErrorinRetrive = errorinRetrive;
            Select = select;
            Others = others;
        }
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertCheckDate(monthfourdigit, datefourdigit, invalidyearentry, invalidmonthentry, invaliddateentry, dateformatDDMONYYYY, entertime, valueforhours, invalidvalueforminutes, invalidtimeformat, entervalidDateandTime, validdatemonthMMDDYYHHMM, validdatemonthMMDDYYHHMMTT, entervalidDateandTime, invalidvalueforhours, invalidvalueforminites) {
            Monthfourdigit = monthfourdigit;
            Datefourdigit = datefourdigit;
            Invalidyearentry = invalidyearentry;
            Invalidmonthentry = invalidmonthentry;
            Invaliddateentry = invaliddateentry;
            DateformatDDMONYYYY = dateformatDDMONYYYY;
            Entertime = Entertime;
            Valueforhours = valueforhours;
            Invalidvalueforminutes = invalidvalueforminutes;
            Invalidtimeformat = invalidtimeformat;
            EntervalidDateandTime = entervalidDateandTime;
            ValiddatemonthMMDDYYHHMM = validdatemonthMMDDYYHHMM;
            ValiddatemonthMMDDYYHHMMTT = validdatemonthMMDDYYHHMMTT;
            EntervalidDateandTime = entervalidDateandTime;
            Invalidvalueforhours = invalidvalueforhours;
            Invalidvalueforminites = invalidvalueforminites;
        }
        var SelLeaveType = "Select Leave Type";
        var SelLeaveRestictHoliday = "Select Leave/Restricted Holiday";
        var FillFromDate = "Fill From Date";
        var FillToDate = "Fill To Date";
        var SelFromSession = "Select From Session";
        var SelToSession = "Select To Session";
        var FillReason = "Fill Reason";
        var AppliedDaysEmpty = "Number of Days Applied Should Not Be Empty";
        var AppliedDaysZero = "Number of Days Applied Should Not Be Zero";
        var RemainingDaysZero = "Remaining number of days should not be Zero";
        var AppliedShouldNotexceed = "Number of days applied should not exceed 365 days";
        var CompOffShouldNotexceed = "Available Leaves should not be less than the Number of Days Applied";
        var ConfirmSave = "Are you sure to, Save?";
        var Selectvalidfromsessionandtosession = "Select valid from session and to session";
        var Halfdayisnotallowed = "Half day is not allowed";
        var Selectvalidyear = "Select valid year";
        var LeaveFromDateshouldnotbegreaterthanLeaveToDate = "Leave From Date should not be greater than Leave To Date";
        var Leaveshouldnotbeappliedbeforedateofjoining = "Leave should not be applied before date of joining";
        var NoLeavePolicyexistsforthisLeaveFromDateorToDate = "No Leave Policy exists for this Leave From Date or To Date";
        var Leaveshouldbeappliedapplicableafterdays = "Leave should be applied, applicable after days";
        var YouareselectingHoliday = "You are selecting Holiday";
        var YouareselectingWeeklyOffinFromdate = "You are selecting Weekly Off in From date";
        var YouareselectingWeeklyOffinTodate = "You are selecting Weekly Off in To date";
        var YouareselectingWeeklyOff = "You are selecting Weekly Off";
        var LeaveApplicationcannotberaisedduringWeeklyOffGlobalHoliday = "Leave Application cannot be raised during Weekly Off / Global Holiday";
        var SelectLeaveandLeaveTypeId = "Select Leave and LeaveTypeId";
        var Shiftnotallocated = "Shift not allocated";
        var SelectValidFromDateandToDate = "Select Valid From Date and To Date";
        var YouhavechoosedafterweeklyOffOneDayAdded = "You have choosed after weekly Off, One Day Added";
        var YouhavechoosedBeforeweeklyOffOneDayAdded = "You have choosed Before weekly Off, One Day Added";
        var YouhaveselectedInterveningweeklyOffGlobalHoliday = "You have selected Intervening weekly Off / Global Holiday";
        var DayDeducted = "Day(s) Deducted";
        var Dayincluded = "Day(s) included";
        var SelectanEmployee = "Select an Employee";
        var LOPnotdefined = "LOP not defined";
        var RestrictedHoliday = "Restricted Holiday not defined";
        var LeavePolicy = "Leave Policy not defined";
        var InvalidApplicationDate = "Leave Date does not fall on the Selected year";
        var ExceedSuccessiveDays = "Given Application Date exceeds the Successive Days";
        var Selectleavefromandtodate = "Select leave from and to date";
        var Selectleavefromdate = "Select leave from date";
        var Selectleavetodate = "Select leave to date";
        var Theleavedurationcrossestheleavepolicy = "The leave duration crosses the leave policy";
        function SelectEmployee(selectemployee) {
            SelectanEmployee = selectemployee;
        }
        function SetAlertMessages(LeaveType, LeaveRestictHoliday, Fromdate, ToDate, FromSession, ToSession, FillReasons, DayEmpty, DaysZero, RemainingZero, DaysNotExceed, InvalidApplicationdate, ConfirmSavedeatils, ExceedSuccessiveDays, CompOffShouldNotexceed) {
            SelLeaveType = LeaveType;
            SelLeaveRestictHoliday = LeaveRestictHoliday;
            FillFromDate = Fromdate;
            FillToDate = ToDate;
            SelFromSession = FromSession;
            SelToSession = ToSession;
            FillReason = FillReasons;
            AppliedDaysEmpty = DayEmpty;
            AppliedDaysZero = DaysZero;
            RemainingDaysZero = RemainingZero;
            AppliedShouldNotexceed = DaysNotExceed;
            InvalidApplicationDate = InvalidApplicationdate;
            ConfirmSave = ConfirmSavedeatils;
            ExceedSuccessiveDays = ExceedSuccessiveDays;
            CompOffShouldNotexceed = CompOffShouldNotexceed;
        }
        function SetAlertMessagesAjax_Leave
        (
            selectvalidfromsessionandtosession,
            halfdayisnotallowed,
            selectvalidyear,
            leaveFromDateshouldnotbegreaterthanLeaveToDate,
            leaveshouldnotbeappliedbeforedateofjoining,
            noLeavePolicyexistsforthisLeaveFromDateorToDate,
            leaveshouldbeappliedapplicableafterdays,
            youareselectingHoliday,
            youareselectingWeeklyOffinFromdate,
            youareselectingWeeklyOffinTodate,
            youareselectingWeeklyOff,
            leaveApplicationcannotberaisedduringWeeklyOffGlobal,
            selectLeaveandLeaveTypeId,
            shiftnotallocated,
            selectValidFromDateandToDate,
            youhavechoosedafterweeklyOffOneDayAdded,
            youhavechoosedBeforeweeklyOffOneDayAdded,
            youhaveselectedInterveningweeklyOffGlobalHoliday,
            dayDeducted,
            dayincluded,
            selectanEmployee,
            lOPnotdefined,
            restrictedHoliday,
            leavePolicy,
            selectleavefromandtodate,
            selectleavefromdate,
            selectleavetodate,
            theleavedurationcrossestheleavepolicy
        ) {
            Selectvalidfromsessionandtosession = selectvalidfromsessionandtosession;
            Halfdayisnotallowed = halfdayisnotallowed;
            Selectvalidyear = selectvalidyear;
            LeaveFromDateshouldnotbegreaterthanLeaveToDate = leaveFromDateshouldnotbegreaterthanLeaveToDate;
            Leaveshouldnotbeappliedbeforedateofjoining = leaveshouldnotbeappliedbeforedateofjoining;
            NoLeavePolicyexistsforthisLeaveFromDateorToDate = noLeavePolicyexistsforthisLeaveFromDateorToDate;
            Leaveshouldbeappliedapplicableafterdays = leaveshouldbeappliedapplicableafterdays;
            YouareselectingHoliday = youareselectingHoliday;
            YouareselectingWeeklyOffinFromdate = youareselectingWeeklyOffinFromdate;
            YouareselectingWeeklyOffinTodate = youareselectingWeeklyOffinTodate;
            YouareselectingWeeklyOff = youareselectingWeeklyOff;
            LeaveApplicationcannotberaisedduringWeeklyOffGlobalHoliday = leaveApplicationcannotberaisedduringWeeklyOffGlobal;
            SelectLeaveandLeaveTypeId = selectLeaveandLeaveTypeId;
            Shiftnotallocated = shiftnotallocated;
            SelectValidFromDateandToDate = selectValidFromDateandToDate;
            YouhavechoosedafterweeklyOffOneDayAdded = youhavechoosedafterweeklyOffOneDayAdded;
            YouhavechoosedBeforeweeklyOffOneDayAdded = youhavechoosedBeforeweeklyOffOneDayAdded;
            YouhaveselectedInterveningweeklyOffGlobalHoliday = youhaveselectedInterveningweeklyOffGlobalHoliday;
            DayDeducted = dayDeducted;
            Dayincluded = dayincluded;
            SelectanEmployee = selectanEmployee;
            LOPnotdefined = lOPnotdefined;
            RestrictedHoliday = restrictedHoliday;
            LeavePolicy = leavePolicy;
            Selectleavefromandtodate = selectleavefromandtodate;
            Selectleavefromdate = selectleavefromdate;
            Selectleavetodate = selectleavetodate;
            Theleavedurationcrossestheleavepolicy = theleavedurationcrossestheleavepolicy;
        }
        function hidedivBorrow() {
            document.getElementById('ctl00_BodyContentPH_divBorrowLeave').style.display = "none";
        }
        function hidedivLeaveProcess() {
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
        }
        function CheckDatesAndNumberOfDays() {

            if (document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value != "") {
                var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtFromDate;
                var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
                if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                    if (document.aspnetForm.ctl00_BodyContentPH_txtToDate.value != "") {
                        var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtToDate;
                        var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
                        if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                            NumberOfdays
                            (
                                 Selectvalidfromsessionandtosession,
                                 Halfdayisnotallowed,
                                 Selectvalidyear,
                                 LeaveFromDateshouldnotbegreaterthanLeaveToDate,
                                 Leaveshouldnotbeappliedbeforedateofjoining,
                                 NoLeavePolicyexistsforthisLeaveFromDateorToDate,
                                 Leaveshouldbeappliedapplicableafterdays,
                                 YouareselectingHoliday,
                                 YouareselectingWeeklyOffinFromdate,
                                 YouareselectingWeeklyOffinTodate,
                                 YouareselectingWeeklyOff,
                                 LeaveApplicationcannotberaisedduringWeeklyOffGlobalHoliday,
                                 SelectLeaveandLeaveTypeId,
                                 Shiftnotallocated,
                                 SelectValidFromDateandToDate,
                                 YouhavechoosedafterweeklyOffOneDayAdded,
                                 YouhavechoosedBeforeweeklyOffOneDayAdded,
                                 YouhaveselectedInterveningweeklyOffGlobalHoliday,
                                 DayDeducted,
                                 Dayincluded,
                                 InvalidApplicationDate,
                                 ExceedSuccessiveDays
                            );
                        }
                        else {
                            return false;
                        }
                    }
                }
                else {
                    return false;
                }
            }
        }
        function LeaveApplicationAddClear(Dateval) {
            document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.selectedIndex = 0;
            document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex = 0;
            document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value = " ";
            document.getElementById('ctl00_BodyContentPH_ddl_Type').selectedIndex = 0;
            if (document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options.length != null) {
                for (var count = document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options.length - 1; count > -1; count--) {
                    document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options[count] = null;
                }
            }
            var newOptSelect = new Option(Select, '-Select-', false, false);
            document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options[0] = newOptSelect;
        }

        function Validation() {

            var TypeIndex = document.aspnetForm.ctl00_BodyContentPH_ddl_Type.selectedIndex;
            var leaveApplied = parseFloat(document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value);
            var leaveRemaining = parseFloat(document.aspnetForm.ctl00_BodyContentPH_txtRemainingNoOfLeave.value);
            document.getElementById('ctl00_BodyContentPH_hdnleaveRemaining').value = leaveRemaining;
            if (TypeIndex == -1) {
                return false;
            }
            var LTypeIndex = document.aspnetForm.ctl00_BodyContentPH_ddl_LeaveType.selectedIndex;
            if (LTypeIndex == -1) {
                alert(SelLeaveType);
                return false;
            }
            var LeaveType = document.aspnetForm.ctl00_BodyContentPH_ddl_LeaveType.options[LTypeIndex].value;
            var Type = document.aspnetForm.ctl00_BodyContentPH_ddl_Type.options[TypeIndex].value;
            if (Type == "-Select-") {
                alert(SelLeaveRestictHoliday);
                return false;
            }
            else if (LeaveType == "-Select-") {
                alert(SelLeaveType);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value == "") {
                alert(FillFromDate);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txtToDate.value == "") {
                alert(FillToDate);
                return false;
            }

            else if (document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.selectedIndex == 0) {
                alert(SelFromSession);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex == 0) {
                alert(SelToSession);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txtReason.value == "") {
                alert(FillReason);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value == "") {
                alert(AppliedDaysEmpty);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value == "0") {
                alert(AppliedDaysZero);
                return false;
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txtRemainingNoOfLeave.value == "0") {
                alert(RemainingDaysZero);
                return false;
            }
            else if (parseInt(document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value) > 365) {
                alert(AppliedShouldNotexceed);
                return false;

            }
                //to solve the issue from mantis 0019020 : Need to convert the string value into float and then check it. By Manjula.P on 24-Sep-2013
            else if (leaveRemaining < leaveApplied) {
                alert(CompOffShouldNotexceed);
                return false;
            }
            else {
                return confirm(ConfirmSave);
            }
        }
        function assignEmployeeId(empid, Select) {
            document.getElementById('ctl00_BodyContentPH_hdnEmployeeId').value = empid;
            document.getElementById('ctl00_BodyContentPH_ddl_Type').selectedIndex = 0;
            document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.selectedIndex = 0;
            document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex = 0;
            document.getElementById('ctl00_BodyContentPH_txtRemainingNoOfLeave').value = "";
            document.getElementById('ctl00_BodyContentPH_hdnisWFH').value = "0";
            document.getElementById('ctl00_BodyContentPH_hdnNumberofDaysApplied').value = "";
            document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value = "";
            document.getElementById('ctl00_BodyContentPH_divLeaveProcess').style.display = "none";
            if (document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options.length != null) {
                for (var count = document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options.length - 1; count > -1; count--) {
                    document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options[count] = null;
                }
            }
            var newOptSelect = new Option(Select, '-Select-', false, false);
            document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').options[0] = newOptSelect;
            document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').selectedIndex = 0;
            if (empid.value != "-Select-" && empid.value != "") {
                document.getElementById('ctl00_BodyContentPH_ddl_Type').focus();
            }
        }
        function validateNumberOfDays(NumberOfDays) {
            if (parseInt(NumberOfDays.value) > 365) {
                alert(AppliedShouldNotexceed);
            }
        }
        function ApplicationYear() {
            document.getElementById('ctl00_BodyContentPH_ddl_Type').selectedIndex = 0;
            document.getElementById('ctl00_BodyContentPH_ddl_LeaveType').selectedIndex = 0;
            var tmp_src = document.getElementById('ctl00_BodyContentPH_iframeLeave').src; 
            document.getElementById('ctl00_BodyContentPH_iframeLeave').src = '';
            document.getElementById('ctl00_BodyContentPH_iframeLeave').src = tmp_src;
        }
    </script>

    <div class="content-header">
        <h1 style="padding-right: 0px">
            <img src="../dist/img/lve-app.png" style="padding-right: 10px;" />
            <asp:Label ID="lbl_HeaderLeaveApplication" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="exda-table">
            <div class="col-md-2" id="previewhead" runat="server" style="display: none">
                <h5>
                    <asp:Label Text="Preview" ID="lblpreview" runat="server" Style="text-align: left !important"></asp:Label></h5>
            </div>
            <h6>
                <span style="color: Red">|</span><asp:Label ID="lblIndicatesMandatoryFields" runat="server">
                </asp:Label>(10 No.)
            </h6>
        </div>
        <asp:UpdatePanel ID="upLeave" runat="server">
            <ContentTemplate>
                <asp:Panel ID="pnlProgress" runat="server" Style="display: none;">
                    <asp:Panel ID="pnlLoading" runat="server" HorizontalAlign="center">
                        <div class="InsideProgressBar">
                            <div class="row" style="margin-top: 10px">
                                <img src="../dist/img/logo-Progress.png" />
                            </div>
                            <div class="row" style="min-width: 280px">
                                <img src="../dist/img/default.gif" style="width: 100px" />
                            </div>
                            <div class="row" style="margin-bottom: 10px">
                                <asp:Label ID="lblLoading" runat="server" ForeColor="black" Style="text-align: center"
                                    Text="Please Wait..." Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial"></asp:Label>
                            </div>
                            <div class="clear clearfix">
                            </div>
                        </div>
                    </asp:Panel>
                </asp:Panel>
                <asp:HiddenField ID="hdnProgress" runat="server" />
                <cc1:ModalPopupExtender ID="popupProgress" runat="server" TargetControlID="hdnProgress"
                    BackgroundCssClass="ModalPopup" PopupControlID="pnlProgress" BehaviorID="popupProgress">
                </cc1:ModalPopupExtender>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btnAdd" />
            </Triggers>
        </asp:UpdatePanel>
        <div id="myModal" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <!-- Modal content-->
                <div class="modal-content" style="margin-top: 100px">
                    <div class="modal-header">
                        <button type="button" id="closemodal" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="lblSelectEmployee" runat="server" Text="Select Employee(s)"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="500px"
                            style="border-style: none"></iframe>
                    </div>
                    <div class="modal-footer" style="display: none">
                        <button type="button" class="btn btn-primary pull-right" data-dismiss="modal">
                            Close</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="emp-filter">
            <div class="row">
                <div class="form-horizontal">
                    <div class="col-md-12 form-group" id="preview" runat="server" style="display: none">
                        <div class="col-md-12">
                            <%--Add Search text box and other search control here--%>
                            <asp:HiddenField ID="HiddenField1" runat="server" />
                            <asp:HiddenField ID="Hidden2" runat="server" />
                            <div class="row form-group" id="trSwipeCardNo" runat="server" style="display: none">
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmpSwipe" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-10">
                                    <asp:TextBox onpaste="return true" ID="txtSwipeCard" MaxLength="20" runat="server"
                                        CssClass="form-group">
                                    </asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acSwipeCardNo" runat="server" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtSwipeCard"
                                        ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetCardNo"
                                        CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                                    </cc1:AutoCompleteExtender>
                                </div>
                            </div>
                            <div class="row form-group" id="trEmployeeDetails" runat="server">
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="lbl_EmployeeName" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:TextBox onpaste="return true" ID="txt_EmpName" runat="server" CssClass="form-control"
                                        MaxLength="50" onkeypress="return employeename_singlequotes_maxlength(event,this,50,MaxLength);">
                                    </asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acEmpName" runat="server" CompletionInterval="10" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        Enabled="true" FirstRowSelected="true" MinimumPrefixLength="1" ServicePath="../WebServices/AutoCompleteExtender.asmx"
                                        ServiceMethod="GetEmployeeName" CompletionListCssClass="autocomplete_completionListElement"
                                        TargetControlID="txt_EmpName">
                                    </cc1:AutoCompleteExtender>
                                </div>
                                <div class="col-md-1 col-sm-0">
                                </div>
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="lbl_EmployeeId" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:TextBox onpaste="return true" ID="txtEmployeeId" runat="server" CssClass="form-control"
                                        MaxLength="15" onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);">
                                    </asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acEmployeeId" runat="server" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtEmployeeId"
                                        ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetEmployeeId"
                                        CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                                    </cc1:AutoCompleteExtender>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                                    <asp:Label ID="lblLeaveStartDate" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:TextBox onpaste="return true" ID="txtLeaveStartDate" runat="server" CssClass="form-control"
                                        EnableViewState="False" onCut="return false" onDrop="return false">
                                    </asp:TextBox>
                                </div>
                                <div class="col-md-1 col-sm-0">
                                </div>
                                <div class="col-md-2 col-sm-2">
                                    <asp:Label ID="lblLeaveEndDate" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:TextBox onpaste="return true" ID="txtLeaveEndDate" runat="server" CssClass="form-control"
                                        EnableViewState="False" onCut="return false" onDrop="return false">
                                    </asp:TextBox>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-5 col-sm-4">
                                </div>
                                <div class="col-md-6 col-sm-6">
                                    <div class="pull-right-button">
                                        <%--Add serach button here--%>
                                        <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
                                        <asp:LinkButton ID="lnkbtnSearch" CssClass="btn src-btn fa-search" runat="server"
                                            OnClientClick="return WeekdayValidation();" Text="&nbsp;&nbsp;Search" OnClick="lnkbtnSearch_Click" />
                                        <asp:LinkButton ID="btn_Clear" CssClass="btn clr-btn fa-refresh" runat="server" Text="&nbsp;&nbsp;Clear" OnClick="btn_Clear_Click" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <!--RES TABLE-->
                            <div class="new-space form-group">
                                <div class="table-responsive">
                                    <dxGridview:ASPxGridView ID="grv_LeaveApplication" runat="server" ClientInstanceName="grv_LeaveApplication"
                                        KeyFieldName="LeaveApplication_Id" EnableCallBacks="False" AutoGenerateColumns="False"
                                        Width="100%">
                                        <Columns>
                                            <dxGridview:GridViewDataTextColumn FieldName="LeaveApplication_Id" VisibleIndex="0"
                                                Visible="False">
                                                <DataItemTemplate>
                                                    <asp:Label ID="AppDate" Text='<%# Eval("LeaveApplication_Id") %>' runat="server"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataHyperLinkColumn FieldName="Leave_ApplicationDate" VisibleIndex="1"
                                                Width="112px">
                                                <Settings AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="AppDate1" Text='<%# Eval("Leave_ApplicationDate") %>' runat="server"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataHyperLinkColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="employeeid" VisibleIndex="2" Caption="Employee Id"
                                                Width="100px">
                                                <Settings AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="lblempid" runat="server" Text='<%# Bind("employeeid") %>' Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="Employee_FirstName" VisibleIndex="3"
                                                Width="112px">
                                                <Settings AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Employee_FirstName") %>' Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="name" VisibleIndex="4" Width="112px">
                                                <Settings AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("name") %>' Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataColumn FieldName="Duration" VisibleIndex="5" Width="112px">
                                                <Settings AllowAutoFilter="False" AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="lbl_Duration" Text='<%# Eval("Duration") %>' runat="server"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="LeaveType" VisibleIndex="6" Width="94px">
                                                <Settings AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="lbl_LeaveType" Text='<%# Eval("LeaveType") %>' runat="server" Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="Status" VisibleIndex="7" Width="85px">
                                                <Settings AllowDragDrop="False" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="lbl_Status" Text='<%# Eval("Status") %>' runat="server"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="Reason" VisibleIndex="8" Width="100px">
                                                <Settings AllowAutoFilter="False" AllowDragDrop="false" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="lbl_Reason" Text='<%# Eval("Reason") %>' runat="server" Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                            <dxGridview:GridViewDataTextColumn FieldName="Number of Days" VisibleIndex="8" Width="100px">
                                                <Settings AllowAutoFilter="False" AllowDragDrop="false" />
                                                <DataItemTemplate>
                                                    <asp:Label ID="lblNumberOfDays" Text='<%# Eval("NumberOfDays") %>' runat="server" Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Wrap="True" />
                                            </dxGridview:GridViewDataTextColumn>
                                        </Columns>
                                        <SettingsPager PageSize="8">
                                        </SettingsPager>
                                        <SettingsText EmptyDataRow="No Records Found" />
                                        <Settings ShowFilterRow="false" />
                                        <SettingsBehavior SortMode="Value" />
                                        <Styles AlternatingRow-CssClass="table-bg">
                                        </Styles>
                                    </dxGridview:ASPxGridView>
                                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectLeaveApplicationDetails"
                                        TypeName="LeaveApplicationEventData">
                                        <SelectParameters>
                                            <asp:SessionParameter Name="Employee_Id" SessionField="EmpAutoId" Type="Int32" />
                                            <asp:SessionParameter Name="GradeLevel" SessionField="GradeLevel" Type="String" />
                                            <asp:SessionParameter Name="LevelRights" SessionField="LevelRights" Type="String" />
                                            <asp:ControlParameter ControlID="txtLeaveStartDate" DefaultValue="01/01/1900" Type="String"
                                                Name="LeaveStartDate" />
                                            <asp:ControlParameter ControlID="txtLeaveEndDate" DefaultValue="01/01/1900" Type="String"
                                                Name="LeaveEndDate" />
                                            <asp:SessionParameter Name="UserGroupName" SessionField="UserGroupName" Type="string" />
                                            <asp:SessionParameter Name="parentLevelId" SessionField="parentLevelId" Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="SelectLeaveApplicationDetailsSuperAdmin"
                                        TypeName="LeaveApplicationEventData">
                                        <SelectParameters>
                                            <asp:SessionParameter Name="EmpID" SessionField="EmpAutoId" Type="Int32" />
                                            <asp:SessionParameter Name="LevelRights" SessionField="LevelRights" Type="String" />
                                            <asp:ControlParameter ControlID="txt_EmpName" Type="string" Name="EmpFirstName" PropertyName="Text" />
                                            <asp:ControlParameter ControlID="txtEmployeeId" Type="string" Name="EmpCodeId" PropertyName="Text" />
                                            <asp:ControlParameter ControlID="txtLeaveStartDate" DefaultValue="01/01/1900" Type="String"
                                                Name="LeaveStartDate" />
                                            <asp:ControlParameter ControlID="txtLeaveEndDate" DefaultValue="01/01/1900" Type="String"
                                                Name="LeaveEndDate" />
                                            <asp:ControlParameter ControlID="txtSwipeCard" Type="string" Name="strSwipeCard"
                                                PropertyName="Text" />
                                            <asp:SessionParameter Name="UserGroupName" SessionField="UserGroupName" Type="string" />
                                            <asp:SessionParameter Name="parentLevelId" Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                </div>
                            </div>
                            <!--RES TABLE-->
                        </div>

                    </div>
                    <div class="clearfix" id="divclear" runat="server">
                    </div>
                    <div class="row" id="divline" runat="server">
                        <div class="line16">
                        </div>
                    </div>
                    <div class="col-md-12 form-group">
                        <asp:HiddenField ID="Hidden1" runat="server" />
                        <div id="divAdmin" runat="server">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <div class="col-md-5">
                                        <asp:Label ID="lblEmpId" Text="Employee ID / PEN" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-7">
                                        <div class="input-group input-group-sm">
                                            <asp:TextBox ID="txt_EmployeeId" runat="server" CssClass="form-control mandatory"
                                                MaxLength="15" onblur="EmpName('Leave'); OpenWindowLeaveQuota(SelectanEmployee);"
                                                onkeypress="return chkMaxLen(event,this,15);"></asp:TextBox>
                                            <span class="input-group-btn">
                                                <asp:LinkButton ID="btn_Search" data-toggle="modal" data-target="#myModal" CssClass="btn src-btn fa-search"
                                                    runat="server" OnClientClick="return OpenWindowShiftExchange('txt_EmployeeId','LeaveApplication');" />
                                            </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-5">
                                        <asp:Label ID="lblempname" Text="Employee Name" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-7">
                                        <asp:TextBox ID="txt_Name" runat="server" CssClass="form-control" ReadOnly="True"></asp:TextBox>
                                        <asp:Label ID="lblError" runat="server" Style="color: #ff0000" Visible="false">
                                        </asp:Label>

                                        <asp:LinkButton ID="btnQuota" runat="server" CssClass="btn btn-primary btn-flat fa fa-list-alt"
                                            OnClientClick="return OpenWindowLeaveQuota(SelectanEmployee);" Visible="false" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div id="divEmployees" runat="server">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <div class="col-md-5">
                                        <asp:Label ID="lblEmployeeId" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-7">
                                        <asp:Label ID="lblEmployeeIdData" runat="server"></asp:Label>
                                        <asp:HiddenField ID="hfEmployeeCode" runat="server" />
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-5">
                                        <asp:Label ID="lblEmployeeName" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-7">
                                        <asp:Label ID="lblEmployeeNameData" runat="server"></asp:Label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="row">
                        <div class="line16">
                        </div>
                    </div>
                    <div class="col-md-12 form-group">
                        <div class="col-md-6">
                            <div class="row form-group" style="padding-bottom: 0px">
                                <div class="col-md-5">
                                    <asp:Label ID="lblApplicationYear" runat="server" CssClass="control-label"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <div class="col-md-6" style="padding-right: 2px; padding-left: 7px">
                                        <asp:RadioButton ID="rbtnCurrentYear" runat="server" GroupName="ApplicationYear"
                                            Checked="true" onclick="EmpName('Leave');" onchange="OpenWindowLeaveQuota(SelectanEmployee);" CssClass="radioLeave radioLeave-primary"
                                            Style="padding-right: 0px" />
                                    </div>
                                    <div class="col-md-6" style="padding-right: 2px; padding-left: 7px">
                                        <asp:RadioButton ID="rbtnSuccessiveYear" runat="server" onchange="OpenWindowLeaveQuota(SelectanEmployee);" onclick="EmpName('Leave');"
                                            GroupName="ApplicationYear" CssClass="radioLeave radioLeave-primary" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblLeaveApplicationDate" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <strong>
                                        <asp:Label ID="lblLeaveApplicationDateData" runat="server"></asp:Label>
                                    </strong>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblLeave" runat="server"></asp:Label>
                                    <asp:Label ID="lblFromDate" runat="server" Visible="false"></asp:Label>
                                    <asp:Label ID="lblToDate" runat="server" Visible="false"></asp:Label>
                                </div>
                                <div class="col-md-7" style="padding: 0px">
                                    <div class="col-sm-6 lve-mar Session-padright">
                                        <asp:TextBox onpaste="return true" ID="txtFromDate" runat="server" CssClass="form-control mandatory lve-pad"
                                            EnableViewState="False" MaxLength="11" onCut="return false" onDrop="return false"
                                            placeholder="From" onblur="return LeaveApplicationAddClear(this);">
                                        </asp:TextBox>
                                        <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" EnableClientScript="False"
                                            ErrorMessage="Select Valid Fromdate" OnServerValidate="CompareCurrentdate">
                                        </asp:CustomValidator>
                                    </div>
                                    <div class="col-sm-6 src-padleft">
                                        <asp:TextBox onpaste="return true" ID="txtToDate" runat="server" CssClass="form-control mandatory lve-pad"
                                            EnableViewState="False" MaxLength="11" onCut="return false" onDrop="return false"
                                            onblur="return LeaveApplicationAddClear(this);" placeholder="To"></asp:TextBox>
                                        <asp:CustomValidator ID="cus_ComDate" runat="server" Display="Dynamic" EnableClientScript="False"
                                            ErrorMessage="Todate greater then from date" OnServerValidate="CompareDate">
                                        </asp:CustomValidator>
                                        <asp:CustomValidator ID="CustomValidator2" runat="server" Display="Dynamic" EnableClientScript="False"
                                            ErrorMessage="Select Valid Todate" OnServerValidate="CompareTodate">
                                        </asp:CustomValidator>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblLeaveRestrictedHoliday" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <asp:DropDownList ID="ddl_Type" runat="server" onchange="return leaveOptions(this.value,SelectanEmployee,LOPnotdefined,RestrictedHoliday,LeavePolicy,ErrorinRetrive,Select,Others,document.getElementById('ctl00_BodyContentPH_txtFromDate').value,document.getElementById('ctl00_BodyContentPH_txtToDate').value,Selectleavefromandtodate,Selectleavefromdate,Selectleavetodate,Theleavedurationcrossestheleavepolicy);"
                                        CssClass="form-control mandatory">
                                        <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                        <asp:ListItem Text="Leave" Value="Leave"></asp:ListItem>
                                        <asp:ListItem Text="Restricted Holiday" Value="Restricted Holiday"></asp:ListItem>
                                        <asp:ListItem Text="Comp Off" Value="Comp Off"></asp:ListItem>
                                        <asp:ListItem Text="LOP" Value="LOP"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblLeaveType" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <asp:DropDownList ID="ddl_LeaveType" runat="server" CssClass="form-control mandatory"
                                        onchange="return RemainingNoOfLeaves(this.value,document.getElementById('ctl00_BodyContentPH_txtFromDate').value,document.getElementById('ctl00_BodyContentPH_txtToDate').value);">
                                        <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblSession" Text="Session" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7" style="padding: 0px">
                                    <div class="col-sm-6 lve-mar Session-padright">
                                        <asp:DropDownList ID="ddl_SessionFrom" runat="server" CssClass="form-control mandatory"
                                            onchange="return CheckDatesAndNumberOfDays();">
                                            <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                            <asp:ListItem Text="First half" Value="First half"></asp:ListItem>
                                            <asp:ListItem Text="Second half" Value="Second half"></asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                    <div class="col-sm-6 src-padleft">
                                        <asp:DropDownList ID="ddl_SessionTo" runat="server" CssClass="form-control mandatory"
                                            onchange="return CheckDatesAndNumberOfDays();">
                                            <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                            <asp:ListItem Text="First half" Value="First half"></asp:ListItem>
                                            <asp:ListItem Text="Second half" Value="Second half"></asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblReason" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <asp:TextBox onpaste="return true" ID="txtReason" runat="server" CssClass="form-control mandatory"
                                        Style="resize: none;" MaxLength="250" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                                        TextMode="MultiLine">
                                    </asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-5">
                                    <asp:Label ID="lblNumberofdaysapplied" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <asp:TextBox onpaste="return true" ID="txt_Numberofdays" runat="server" CssClass="form-control man-dat"
                                        MaxLength="8" onCut="return false" onDrop="return false" onkeydown="return key_press_nokey(event)"
                                        onkeypress="return key_press_nokey(event)" onchange="return validateNumberOfDays(this);"
                                        Enabled="false"></asp:TextBox>
                                    <div runat="server" id="divLeaveProcess" style="position: absolute;">
                                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/loading.gif" />Processing
                                    </div>
                                </div>
                            </div>
                            <div class="form-group" id="tr_RemainingNoOfLeave">
                                <div class="col-md-5">
                                    <asp:Label ID="lblRemainingNumberofLeave" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-7">
                                    <asp:TextBox onpaste="return true" ID="txtRemainingNoOfLeave" runat="server" CssClass="form-control man-dat"
                                        onDrag="return false;" onCut="return false" onDrop="return false" onkeydown="return key_press_nokey(event)"
                                        onkeypress="return key_press_nokey(event)" Enabled="false">
                                    </asp:TextBox>
                                    <asp:HiddenField runat="server" ID="hdnisWFH" />
                                    <div id="divBorrowLeave" runat="server" style="position: relative; padding-left: 2px; float: right;">
                                        <asp:CheckBox ID="chkBorrowLeave" runat="server" OnClick="return RemainingNoOfBorrowLeaves()" />
                                    </div>
                                    <input id="hdnEmployeeId" type="hidden" runat="server" /><input id="hdnTxtLeaveTypeId"
                                        runat="server" type="hidden" /><input id="hdnNumberofDaysApplied" runat="server"
                                            type="hidden" /><input id="hdnApplicationYear" type="hidden" runat="server" />
                                    <input id="hdnSuccessiveYear" runat="server" type="hidden" />
                                    <input id="hdnFinalValue" runat="server" type="hidden" />
                                    <input id="hdnSuccessiveDate" runat="server" type="hidden" />
                                    <input id="hdnleaveRemaining" runat="server" type="hidden" />
                                    <asp:HiddenField ID="Intervening" runat="server" />
                                    <asp:HiddenField ID="hdnAvailedLeave" runat="server" />
                                    <asp:HiddenField ID="hdnAvailedLOPLeave" runat="server" />
                                    <asp:HiddenField ID="PolicyExistsEmployees" runat="server" />
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-5">
                                </div>
                                <div class="col-md-7">
                                    <div class="pull-right-button">
                                        <asp:LinkButton ID="btnAdd" CssClass="btn save-btn fa-floppy-o" runat="server" OnClick="btn_add_Click"
                                            OnClientClick="javascript:if(Validation()) $find('popupProgress').show();else return false;" />
                                        <asp:HiddenField ID="hdf_orgLevel" runat="server" />
                                        <asp:LinkButton ID="btnCancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                            CausesValidation="False" OnClick="btn_cancel_Click" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6" align="center">
                            <iframe id="iframeLeave" runat="server" scrolling="auto" width="80%" style="border-style: none; margin-top: 0px; display: none; height: 450px;"></iframe>
                        </div>
                    </div>



                </div>
            </div>
            <div class="clearfix">
            </div>
        </div>
    </div>
</asp:Content>
