// JScript File
var objOT = null;
function GettingPenaltyPercentageDetails() {
    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", "PenaltyPercentage.aspx?CompanyID=" + document.getElementById("ctl00_BodyContentPH_hdfCompanyId").value + "&Random=" + k, true);
            objOT.send(null);
        }
        else if (window.XMLHttpRequest) {
            objOT.open("GET", "PenaltyPercentage.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() {
    if (objOT.readyState == 4) {
        if (objOT.status == 200) {
            var retval = objOT.responseText;
            if (retval.length > 0 && retval != "Fail") {
                var arr = retval.split('$');
                if (arr != null) {
                    //Disruptive values
                    document.getElementById('ctl00_BodyContentPH_txtfirstLateStart').value = arr[0];
                    document.getElementById('ctl00_BodyContentPH_txtfirstLateEnd').value = arr[1];
                    document.getElementById('ctl00_BodyContentPH_txtsecondLateStart').value = arr[2];
                    document.getElementById('ctl00_BodyContentPH_txtsecondLateEnd').value = arr[3];
                    document.getElementById('ctl00_BodyContentPH_txtThirdLateStart').value = arr[4];
                    document.getElementById('ctl00_BodyContentPH_txtThirdLateEnd').value = arr[5];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue11').value = arr[6];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue12').value = arr[7];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue13').value = arr[8];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue14').value = arr[9];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue21').value = arr[10];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue22').value = arr[11];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue23').value = arr[12];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue24').value = arr[13];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue31').value = arr[14];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue32').value = arr[15];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue33').value = arr[16];
                    document.getElementById('ctl00_BodyContentPH_TxtLateInValue34').value = arr[17];
                    //Non Disruptive values
                    document.getElementById('ctl00_BodyContentPH_txtnonfirstLateStart').value = arr[18];
                    document.getElementById('ctl00_BodyContentPH_txtnonfirstLateEnd').value = arr[19];
                    document.getElementById('ctl00_BodyContentPH_txtnonsecondLateStart').value = arr[20];
                    document.getElementById('ctl00_BodyContentPH_txtnonsecondLateEnd').value = arr[21];
                    document.getElementById('ctl00_BodyContentPH_txtnonthirdLateStart').value = arr[22];
                    document.getElementById('ctl00_BodyContentPH_txtnonthirdLateEnd').value = arr[23];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue11').value = arr[24];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue12').value = arr[25];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue13').value = arr[26];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue14').value = arr[27];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue21').value = arr[28];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue22').value = arr[29];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue23').value = arr[30];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue24').value = arr[31];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue31').value = arr[32];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue32').value = arr[33];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue33').value = arr[34];
                    document.getElementById('ctl00_BodyContentPH_TxtnonLateInValue34').value = arr[35];
                    //Disruptive and Non Disruptive values
                    document.getElementById('ctl00_BodyContentPH_TxtearlyStart').value = arr[36];
                    document.getElementById('ctl00_BodyContentPH_TxtearlyEnd').value = arr[37];
                    document.getElementById('ctl00_BodyContentPH_Txtearly11').value = arr[38];
                    document.getElementById('ctl00_BodyContentPH_Txtearly12').value = arr[39];
                    document.getElementById('ctl00_BodyContentPH_Txtearly13').value = arr[40];
                    document.getElementById('ctl00_BodyContentPH_Txtearly14').value = arr[41];
                }
            }
        }
    }
}
function numbers_dot(e, ctrl) {
    dec_limit = arguments[1];
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if ((keycode == 8) || (keycode == 0)) {
        return true;
    }
    val = ctrl.value;
    dot_index = val.indexOf('.');
    if (dot_index != -1) {
        dec_pts = (val.length - dot_index);
        if (!dec_limit) dec_limit = 3; else dec_limit = dec_limit + 1;
    }
    if (document.selection) {
        var selection = document.selection.createRange();
        var selected_text = selection.text;
    }
    else if (document.getSelection) {
        var start = ctrl.selectionStart;
        var end = ctrl.selectionEnd;
        var selected_text = ctrl.value.substring(start, end);
    }
    if ((val.length == 0 || selected_text != "") && (keycode == 46))	// || keycode==48
    {
        return false;
    }
    else if (dot_index != -1 && keycode == 46) {
        return false;
    }
    else if (!(keycode >= 48 && keycode <= 57) && (keycode != 13) && (keycode != 46) && (keycode = 36) && (keycode != 8) && (keycode != 0)) {
        return false;
    }
    else return true;
}