// JScript File
var objOT = null;
function ajaxOTRoundoffModify() {
    if (window.ActiveXObject) {
        try {
            objOT = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objOT = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objOT = null;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            objOT = new XMLHttpRequest("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objOT = new XMLHttpRequest("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objOT = null;
            }
        }
    }
    if (objOT != null) {

        var k = Math.floor(Math.random() * 111);
        if (window.ActiveXObject) {
            objOT.onreadystatechange = Process_Response_OTRoundoff1;
            objOT.open("GET", "OTRoundoffModify_Remote.aspx?CompanyID=" + document.getElementById("ctl00_BodyContentPH_hdfCompanyId").value + "&Random=" + k, true);
            objOT.send(null);
        }
        else if (window.XMLHttpRequest) {
            objOT.open("GET", "OTRoundoffModify_Remote.aspx?CompanyID=" + document.getElementById("ctl00_BodyContentPH_hdfCompanyId").value + "&Random=" + k, false);
            objOT.send(null);
            objOT.onreadystatechange = Process_Response_OTRoundoff1();
        }
    }
    return false;
}
function Process_Response_OTRoundoff1() {
    debugger;
    if (objOT.readyState == 4) {
        if (objOT.status == 200) {
            var retval = objOT.responseText;
            if (retval.length > 0 && retval != "Fail") {
                var arr = retval.split('$');
                document.getElementById('ctl00_BodyContentPH_divOTRoundoff').innerHTML = "";
                document.getElementById('ctl00_BodyContentPH_divOTRoundoff').innerHTML += arr[0];
                document.getElementById('ctl00_BodyContentPH_txtBeforeShiftMax').value = arr[1];
                document.getElementById('ctl00_BodyContentPH_txtAfterShiftMax').value = arr[2];
                //				    document.getElementById('ctl00_BodyContentPH_txt_OvertmeOnholidays').value=arr[3];
                //				    document.getElementById('ctl00_BodyContentPH_txt_OvertimeOnWeeklyOff').value=arr[4];
                document.getElementById('ctl00_BodyContentPH_txtNoOfSuccessiveDays').value = arr[18];
                document.getElementById('ctl00_BodyContentPH_txtCompensationDays').value = arr[20];

                //TODO: vaigai license
                document.getElementById('ctl00_BodyContentPH_txtLatePerDay').value = arr[46];
                document.getElementById('ctl00_BodyContentPH_txtLateMonth').value = arr[47];
                //TODO: Sohit license
                document.getElementById('ctl00_BodyContentPH_txtEarlyExitPerDay').value = arr[48];
                document.getElementById('ctl00_BodyContentPH_txtEarlyExitDayperMonth').value = arr[49];
                document.getElementById('ctl00_BodyContentPH_txtMonthlyExceptionBufferHrs').value = arr[51];
                //TODO: vaigai license
                if (arr[50] == "1") {
                    document.getElementById('ctl00_BodyContentPH_chkEnableAbsent').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkEnableAbsent').checked = false;
                }

                if (arr[5] == "True") {
                    document.getElementById('ctl00_BodyContentPH_rbFullDayYes').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbFullDayNo').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbFullDayYes').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbFullDayNo').checked = true;
                }
                if (arr[6] == "True") {
                    document.getElementById('ctl00_BodyContentPH_rbHalfDayYes').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbHalfDayNo').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbHalfDayYes').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbHalfDayNo').checked = true;
                }

                if (arr[8] == 1) {
                    document.getElementById('ctl00_BodyContentPH_divFlexibleParameter').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_rbtnYes').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_divFlexibleParameter').style.display = "none";
                    document.getElementById('ctl00_BodyContentPH_rbtnNo').checked = true;
                }




                document.getElementById('ctl00_BodyContentPH_txtMonthClosureDate').value = arr[7];

                if (arr[9] == 1) {
                    document.getElementById('ctl00_BodyContentPH_rbtnOrganization').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnIndividualEmployee').checked = true;
                }
                //                    if(arr[10]=='Holiday')
                //                    {
                //                        document.getElementById('ctl00_BodyContentPH_rbtnHoliday').checked=true;
                //                    }
                //                    else
                //                    {
                //                        document.getElementById('ctl00_BodyContentPH_rbtnWeekoff').checked=true;
                //                    }  
                if (arr[11] == '1') {
                    document.getElementById('ctl00_BodyContentPH_rbtnOTEnable').checked = true;
                    document.getElementById('ctl00_BodyContentPH_divOTParameter').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_divOTRoundoff').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_hdf_controlID').value = arr[arr.length - 1];
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnOTDisable').checked = true;
                }
                document.getElementById("ctl00_BodyContentPH_txtWeekOffStartHours").value = arr[12];
                document.getElementById("ctl00_BodyContentPH_txtBeforeShiftMax_24HrsShift").value = arr[34];
                document.getElementById("ctl00_BodyContentPH_txtWeekOffStartHours_24HrsShift").value = arr[35];
                if (arr[13] == "True") {
                    document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesYes").checked = true;
                    document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesNo").checked = false;
                    document.getElementById("ctl00_BodyContentPH_txtTimeInterval").value = arr[14];
                }
                else {
                    document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesYes").checked = false;
                    document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesNo").checked = true;
                }
                if (document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesYes").checked == true) {
                    document.getElementById("ctl00_BodyContentPH_txtTimeInterval").disabled = false;
                }
                else if (document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesNo").checked == true) {
                    document.getElementById("ctl00_BodyContentPH_txtTimeInterval").disabled = true;
                }
                if (arr[arr.length - 2] != "") {
                    document.getElementById('ctl00_BodyContentPH_txtExceptionHours').value = arr[arr.length - 2];
                }
                document.getElementById('ctl00_BodyContentPH_txtDefaultLunch').value = arr[arr.length - 4];
                document.getElementById('ctl00_BodyContentPH_txtLunchHrs').value = arr[arr.length - 3];
                //                    if(arr[15]=="True")
                //				    {
                //				        document.getElementById('ctl00_BodyContentPH_chkboxAfterShiftTime').checked=true;				        
                //				    }
                //				    else
                //				    {
                //				        document.getElementById('ctl00_BodyContentPH_chkboxAfterShiftTime').checked=false;
                //				    }
                //                    if(arr[16]=="True")
                //				    {
                //				        document.getElementById('ctl00_BodyContentPH_chkboxBeforeShiftTime').checked=true;				        
                //				    }
                //				    else
                //				    {
                //				        document.getElementById('ctl00_BodyContentPH_chkboxBeforeShiftTime').checked=false;
                //				    }                    
                //                    if(arr[17]=="True")
                //				    {
                //				        document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursYes').checked=true;
                //				        document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursNo').checked=false;
                //				    }
                //				    else
                //				    {
                //				        document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursYes').checked=false;
                //				        document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursNo').checked=true;
                //				    }
                if (arr[19] > 0) {
                    //                        document.getElementById('ctl00_BodyContentPH_txtNoOfSuccessiveDays').disabled=true;
                    $('#ctl00_BodyContentPH_txtNoOfSuccessiveDays').attr('readonly', true);
                }
                else if (arr[19] == 0) {
                    //                        document.getElementById('ctl00_BodyContentPH_txtNoOfSuccessiveDays').disabled=false;
                    $('#ctl00_BodyContentPH_txtNoOfSuccessiveDays').attr('readonly', false);
                }
                //                    document.getElementById('ctl00_BodyContentPH_txtHalfDayComoff').value=arr[22];
                //                    document.getElementById('ctl00_BodyContentPH_txtFullDayComoff').value=arr[23];
                //                    document.getElementById('ctl00_BodyContentPH_txtValidsDays').value=arr[24];
                if (arr[25] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_0').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_0').checked = false;
                }
                if (arr[26] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_1').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_1').checked = false;
                }
                if (arr[27] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_2').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_2').checked = false;
                }
                if (arr[28] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_3').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxExceptionDetails_3').checked = false;
                }
                //freescan
                if (arr[43] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxFreescan').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxFreescan').checked = false;
                }

                if (arr[29] == "True") {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesLunch').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoLunch').checked = false;
                    document.getElementById('ctl00_BodyContentPH_txtDeductionHours').value = arr[30];
                    document.getElementById('ctl00_BodyContentPH_txtDeductionHours').disabled = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesLunch').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoLunch').checked = true;
                    document.getElementById('ctl00_BodyContentPH_txtDeductionHours').value = "";
                    document.getElementById('ctl00_BodyContentPH_txtDeductionHours').disabled = true;
                }
                //                    if(arr[31]=="True")
                //                    {
                //                        document.getElementById('ctl00_BodyContentPH_chkflexAfter').checked=true;
                //                    }
                //                    else
                //                    {   
                //                        document.getElementById('ctl00_BodyContentPH_chkflexAfter').checked=false;
                //                    }
                //                    if(arr[32]=="True")
                //                    {   
                //                        document.getElementById('ctl00_BodyContentPH_chkflexBefore').checked=true;
                //                    }
                //                    else
                //                    {   
                //                        document.getElementById('ctl00_BodyContentPH_chkflexBefore').checked=false;
                //                    }  
                //The below Line Comment by karthikeyan.R 
                //                    if(arr[36]!="")
                //                    {
                //                        document.getElementById("ctl00_BodyContentPH_ddlWeekStartDay").value=arr[36];
                //                        $("#ctl00_BodyContentPH_ddlWeekStartDay").select2("val", arr[36]);
                //                    }
                //                    else
                //                    {
                //                        document.getElementById("ctl00_BodyContentPH_ddlWeekStartDay").value=2;
                //                        $("#ctl00_BodyContentPH_ddlWeekStartDay").select2("val", 2);
                //                    }
                //                    if(arr[37]!="")
                //                    { 
                //                        document.getElementById("ctl00_BodyContentPH_ddlWeekEndDay").value=arr[37];                  
                //                        $("#ctl00_BodyContentPH_ddlWeekEndDay").select2("val", arr[37]);
                //                    }
                //                    else
                //                    {
                //                        document.getElementById("ctl00_BodyContentPH_ddlWeekEndDay").value=7;
                //                        $("#ctl00_BodyContentPH_ddlWeekEndDay").select2("val", 7);
                //                    }
            }
            else {
                document.getElementById('ctl00_BodyContentPH_txtBeforeShiftMax').value = '';
                document.getElementById('ctl00_BodyContentPH_txtAfterShiftMax').value = '02:00';
                document.getElementById('ctl00_BodyContentPH_txtBeforeShiftMax_24HrsShift').value = '';
                document.getElementById('ctl00_BodyContentPH_txtMonthClosureDate').value = '';
                document.getElementById('ctl00_BodyContentPH_divFlexibleParameter').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_trFlexiOverTime').style.display = "none";
                document.getElementById('ctl00_BodyContentPH_rbtnNo').checked = true;
                document.getElementById('ctl00_BodyContentPH_rbtnIndividualEmployee').checked = true;
                document.getElementById('ctl00_BodyContentPH_hdf_controlID').value = '';
                document.getElementById('ctl00_BodyContentPH_divOTRoundoff').innerHTML = ''
                document.getElementById("ctl00_BodyContentPH_txtWeekOffStartHours").value = '';
                document.getElementById("ctl00_BodyContentPH_txtWeekOffStartHours_24HrsShift").value = '';
                document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesYes").checked = false;
                document.getElementById("ctl00_BodyContentPH_rbtIgnoreDuplicatesNo").checked = true;
                document.getElementById("ctl00_BodyContentPH_txtTimeInterval").value = '';
                document.getElementById("ctl00_BodyContentPH_txtNoOfSuccessiveDays").value = '';
                document.getElementById("ctl00_BodyContentPH_txtCompensationDays").value = '';
                document.getElementById("ctl00_BodyContentPH_rbtnYesLunch").checked = false;
                document.getElementById("ctl00_BodyContentPH_rbtnNoLunch").checked = true;
                document.getElementById("ctl00_BodyContentPH_txtDeductionHours").value = '';
                document.getElementById('ctl00_BodyContentPH_txtDeductionHours').disabled = true;
                document.getElementById('ctl00_BodyContentPH_txtExceptionHours').value = "";
                document.getElementById('ctl00_BodyContentPH_txtDefaultLunch').value = "";
                document.getElementById('ctl00_BodyContentPH_txtLunchHrs').value = "";
                document.getElementById('ctl00_BodyContentPH_txtMonthlyExceptionBufferHrs').Value = "";
            }
        }
    }
}
// JScript File
var objOT = null;
function ajaxOTCompOff() {
    if (window.ActiveXObject) {
        try {
            objOT = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objOT = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objOT = null;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            objOT = new XMLHttpRequest("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objOT = new XMLHttpRequest("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objOT = null;
            }
        }
    }
    if (objOT != null) {
        var k = Math.floor(Math.random() * 111);
        if (window.ActiveXObject) {
            objOT.onreadystatechange = Process_Response_OTCompOff;
            objOT.open("GET", "OTRoundoffModify_Remote.aspx?CompanyID=" + document.getElementById("ctl00_BodyContentPH_hdfCompanyId").value + "&Random=" + k, true);
            objOT.send(null);
        }
        else if (window.XMLHttpRequest) {
            objOT.open("GET", "OTRoundoffModify_Remote.aspx?CompanyID=" + document.getElementById("ctl00_BodyContentPH_hdfCompanyId").value + "&Random=" + k, false);
            objOT.send(null);
            objOT.onreadystatechange = Process_Response_OTCompOff();
        }
    }
    return false;
}
function Process_Response_OTCompOff() {   //OT and Comp off Filling portion
    if (objOT.readyState == 4) {
        if (objOT.status == 200) {
            var retval = objOT.responseText;
            if (retval.length > 0 && retval != "Fail") {
                var arr = retval.split('$');
                document.getElementById('ctl00_BodyContentPH_divOTRoundoff').innerHTML = "";
                document.getElementById('ctl00_BodyContentPH_divOTRoundoff').innerHTML += arr[0];
                document.getElementById('ctl00_BodyContentPH_txt_OvertmeOnholidays').value = arr[3];
                document.getElementById('ctl00_BodyContentPH_txt_OvertimeOnWeeklyOff').value = arr[4];
                document.getElementById('ctl00_BodyContentPH_txtCompensationDays').value = arr[20];
                if (arr[10] == 'Holiday') {
                    document.getElementById('ctl00_BodyContentPH_rbtnHoliday').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnWeekoff').checked = true;
                }
                if (arr[11] == '1') {
                    document.getElementById('ctl00_BodyContentPH_rbtnOTEnable').checked = true;
                    document.getElementById('ctl00_BodyContentPH_divOTParameter').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_divOTRoundoff').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_hdf_controlID').value = arr[arr.length - 1];
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnOTDisable').checked = true;
                }
                if (arr[15] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxAfterShiftTime').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxAfterShiftTime').checked = false;
                }
                if (arr[16] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkboxBeforeShiftTime').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkboxBeforeShiftTime').checked = false;
                }
                if (arr[8] == 1) {
                    document.getElementById('ctl00_BodyContentPH_divFlexibleParameter').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_trFlexiOverTime').style.display = "block";
                    document.getElementById('ctl00_BodyContentPH_rbtnYes').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_divFlexibleParameter').style.display = "none";
                    document.getElementById('ctl00_BodyContentPH_trFlexiOverTime').style.display = "none";
                    document.getElementById('ctl00_BodyContentPH_rbtnNo').checked = true;
                }
                if (arr[17] == "True") {
                    document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursYes').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursNo').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursYes').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursNo').checked = true;
                }
                document.getElementById('ctl00_BodyContentPH_txtHalfDayComoff').value = arr[22];
                document.getElementById('ctl00_BodyContentPH_txtFullDayComoff').value = arr[23];
                document.getElementById('ctl00_BodyContentPH_txtValidsDays').value = arr[24];
                if (arr[31] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkflexAfter').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkflexAfter').checked = false;
                }
                if (arr[32] == "True") {
                    document.getElementById('ctl00_BodyContentPH_chkflexBefore').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_chkflexBefore').checked = false;
                }
                if (arr[41] == "0") {
                    document.getElementById('ctl00_BodyContentPH_rbtnCompCarryNo').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnCompCarryYes').checked = true;
                }
                if (arr[42] == "False") {
                    document.getElementById('ctl00_BodyContentPH_rbtCompoffRequestNo').checked = true;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtCompoffRequestYes').checked = true;
                }
                document.getElementById('ctl00_BodyContentPH_txtspecialOvertim1').value = arr[44];
                document.getElementById('ctl00_BodyContentPH_txtspecialOvertim2').value = arr[45];
            }
            else
            {
                ClearContentsOT();
            }
        }
    }
}

function ClearContentsOT() {

    document.getElementById('ctl00_BodyContentPH_trFlexiOverTime').style.display = "none";
    document.getElementById('ctl00_BodyContentPH_chkboxAfterShiftTime').checked = false;
    document.getElementById('ctl00_BodyContentPH_chkboxBeforeShiftTime').checked = false;
    document.getElementById("ctl00_BodyContentPH_txt_OvertmeOnholidays").value = '';
    document.getElementById('ctl00_BodyContentPH_txt_OvertimeOnWeeklyOff').value = '';
    document.getElementById('ctl00_BodyContentPH_rbtnWeekoff').checked = true;
    document.getElementById('ctl00_BodyContentPH_divOTParameter').style.display = "none";
    document.getElementById('ctl00_BodyContentPH_divOTRoundoff').style.display = "none";
    document.getElementById('ctl00_BodyContentPH_rbtnOTDisable').checked = true;
    document.getElementById("ctl00_BodyContentPH_txtHalfDayComoff").value = '';
    document.getElementById("ctl00_BodyContentPH_txtFullDayComoff").value = '';
    document.getElementById("ctl00_BodyContentPH_txtValidsDays").value = '';

    document.getElementById("ctl00_BodyContentPH_txtspecialOvertim1").value = '';
    document.getElementById("ctl00_BodyContentPH_txtspecialOvertim2").value = '';

    document.getElementById('ctl00_BodyContentPH_rbtnDefinedWorkHoursNo').checked = true;
}

// JScript File
var objAppSettings = null;
function ajaxApprovalSettings(CompanyID) {
    if (window.ActiveXObject) {
        try {
            objAppSettings = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objAppSettings = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objAppSettings = null;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            objAppSettings = new XMLHttpRequest("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objAppSettings = new XMLHttpRequest("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objAppSettings = null;
            }
        }
    }
    if (objAppSettings != null) {
        var k = Math.floor(Math.random() * 111);
        if (window.ActiveXObject) {
            objAppSettings.onreadystatechange = Process_Response_ApprovalSettings;
            objAppSettings.open("GET", "GetApprovalDetails.aspx?CompanyID=" + CompanyID + "&Random=" + k, true);
            objAppSettings.send(null);
        }
        else if (window.XMLHttpRequest) {
            objAppSettings.open("GET", "GetApprovalDetails.aspx?CompanyID=" + CompanyID + "&Random=" + k, false);
            objAppSettings.send(null);
            objAppSettings.onreadystatechange = Process_Response_ApprovalSettings();
        }
    }
    return false;
}
function Process_Response_ApprovalSettings() {
    if (objAppSettings.readyState == 4) {
        if (objAppSettings.status == 200) {
            var retval = objAppSettings.responseText;
            if (retval.length > 0 && retval != "Fail") {
                var arr = retval.split('$');
                if (arr[1] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesPattern').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoPattern').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesPattern').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoPattern').checked = true;
                }
                if (arr[2] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesRoster').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoRoster').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesRoster').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoRoster').checked = true;
                }
                if (arr[3] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesManualEntry').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoManualEntry').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesManualEntry').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoManualEntry').checked = true;
                }
                if (arr[4] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesLeaveSanction').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoLeaveSanction').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesLeaveSanction').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoLeaveSanction').checked = true;
                }
                if (arr[5] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesOnDutyEntry').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoOnDutyEntry').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesOnDutyEntry').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoOnDutyEntry').checked = true;
                }
                if (arr[6] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesPermissionSanction').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoPermissionSanction').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesPermissionSanction').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoPermissionSanction').checked = true;
                }
                if (arr[7] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesOTApproval').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoOTApproval').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesOTApproval').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoOTApproval').checked = true;
                }

                if (arr[8] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesApproval').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoApproval').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnYesApproval').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnNoApproval').checked = true;
                }
                if (arr[9] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnwebclkYes').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnwebclkNo').checked = false;
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnwebclkYes').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnwebclkNo').checked = true;
                }
                var divMinHours = document.getElementById('divMinWeeklyHoursContainer');
                var rfv = document.getElementById('ctl00_BodyContentPH_rfvMinWeeklyHours');
                var rev = document.getElementById('ctl00_BodyContentPH_revMinWeeklyHours');
                if (arr[10] == 'true') {
                    document.getElementById('ctl00_BodyContentPH_rbtnCompressedWorkYes').checked = true;
                    document.getElementById('ctl00_BodyContentPH_rbtnCompressedWorkNo').checked = false;
                    divMinHours.style.display = 'inline-block';
                    ValidatorEnable(rfv, true);
                    ValidatorEnable(rev, true);
                    if (arr[11]) {
                        document.getElementById('ctl00_BodyContentPH_txtMinWeeklyHours').value = arr[11];
                    }
                }
                else {
                    document.getElementById('ctl00_BodyContentPH_rbtnCompressedWorkYes').checked = false;
                    document.getElementById('ctl00_BodyContentPH_rbtnCompressedWorkNo').checked = true;
                    divMinHours.style.display = 'none';
                    ValidatorEnable(rfv, false);
                    ValidatorEnable(rev, false);
                    document.getElementById('ctl00_BodyContentPH_txtMinWeeklyHours').value = '';
                }

            }
            else {
                alert("Approval yet to configured for this company");
                return false;
            }
        }
    }
}


// JScript File
var objDomain = null;
function ajaxDomainSettings(DomainName, UserName, Password) {
    if (window.ActiveXObject) {
        try {
            objDomain = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objDomain = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objDomain = null;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            objDomain = new XMLHttpRequest("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                objDomain = new XMLHttpRequest("Microsoft.XMLHTTP");
            }
            catch (e1) {
                objDomain = null;
            }
        }
    }
    if (objDomain != null) {
        var k = Math.floor(Math.random() * 111);
        if (window.ActiveXObject) {
            Password = Password.replace('#', '%23');
            objDomain.onreadystatechange = Process_Response_Domain;
            objDomain.open("GET", "GetApprovalDetails.aspx?DomainName=" + DomainName + "&User=" + UserName + "&Password=" + Password, true);
            objDomain.send(null);
        }
        else if (window.XMLHttpRequest) {
            Password = Password.replace('#', '%23');
            objDomain.open("GET", "GetApprovalDetails.aspx?DomainName=" + DomainName + "&User=" + UserName + "&Password=" + Password, false);
            objDomain.send(null);
            objDomain.onreadystatechange = Process_Response_Domain();
        }
    }
    return false;
}
function Process_Response_Domain() {
    if (objDomain.readyState == 4) {
        if (objDomain.status == 200) {
            var retval = objDomain.responseText;
            if (retval.length > 0 && retval == "Success") {
                alert("Success");
                return false;
            }
            else {
                alert(retval);
                return false;
            }
        }
    }
}