function isDecimal(evt, element) {

    var charCode = (evt.which) ? evt.which : event.keyCode

    if (
        (charCode != 45 || $(element).val().indexOf('-') != -1) && // “-” CHECK MINUS, AND ONLY ONE.
        (charCode != 46 || $(element).val().indexOf('.') != -1) && // “.” CHECK DOT, AND ONLY ONE.
        (charCode < 48 || charCode > 57))
        return false;

    return true;
}
function isInteger(evt, element) {

    var charCode = (evt.which) ? evt.which : event.keyCode

    if ((charCode < 48 || charCode > 57))
        return false;

    return true;
}
function inputAlphabet(inputtext) {
    var alphaExp = /^[a-zA-Z]+$/;
    if (inputtext.value.match(alphaExp)) {
        return true;
    } else {

        inputtext.focus();
        return false;
    }
}
function textNumeric(inputtext) {
    var numericExpression = /^[0-9]+$/;
    if (inputtext.value.match(numericExpression)) {
        return true;
    } else {
        inputtext.focus();
        return false;
    }
}

function textAlphanumeric(inputtext) {
    var alphaExp = /^[0-9a-zA-Z]+$/;
    if (inputtext.value.match(alphaExp)) {
        return true;
    } else {
        inputtext.focus();
        return false;
    }
}
function lengthDefine(inputtext, min, max) {
    var uInput = inputtext.value;
    if (uInput.length >= min && uInput.length <= max) {
        return true;
    } else {
        inputtext.focus();
        return false;
    }
}
function trueSelection(inputtext, alertMsg) {
    if (inputtext.value == "Please Choose") {
        inputtext.focus();
        return false;
    } else {
        return true;
    }
}
function emailValidation(inputtext) {
    var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
    if (inputtext.value.match(filter)) {
        return true;
    } else {

        inputtext.focus();
        return false;
    }
}
function remove_error(id) {
    var id_dom = $('#' + id);
    id_dom.removeClass('error');
}
function alpha_dot(id) {
    var value = $("#" + id).val();
    var preg_check = /[^ A-Za-z.]/ig;

    if (value[0] == " " || value[0] == ".") {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alphabets only allowed');
        //alert('Cannot Start With Dot and Space');
        $("#" + id).addClass('error');
        $("#" + id).val('');
        $("#" + id).focus();
    }

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alphabets only allowed');
        //alert('Alphates only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}

$('input[name="alpha_dot"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^ A-Za-z.]/ig;

    if (value[0] == " " || value[0] == ".") {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Only Alphabets,(.) and ( ) are allowed');
        //alert('Cannot Start With Dot and Space');
        $("#" + id).addClass('error');
        $("#" + id).val('');
        $("#" + id).focus();
    }

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Only Alphabets,(.) and ( ) are allowed');
        //alert('Alphates only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});

function Alphabets_only(id) {
    var value = $("#" + id).val();
    var preg_check = /[^ A-Za-z-]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alphabets only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z-]/ig, ''));
        //$("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="Alphabets_only"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^ A-Za-z-]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alphabets only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z-]/ig, ''));
        //$("#" + id).addClass('error');
        $("#" + id).focus();
    }
});

function alpha_num_hyphen(id) {
    var value = $("#" + id).val();
    var preg_check = /[^A-Za-z0-9-]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alpha numerics and hyphen only allowed');

        $("#" + id).val(value.replace(/[^A-Za-z0-9-]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="alpha_num_hyphen"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^A-Za-z0-9-]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alpha numerics and hyphen only allowed');
        $("#" + id).val(value.replace(/[^A-Za-z0-9-]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }

});

function alpha_hyphen(id) {
    var value = $("#" + id).val();
    var preg_check = /[^ A-Za-z-_]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Alphabets,hypen and underscore only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z-_]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="alpha_hyphen"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^ A-Za-z-_]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Alphabets,hypen and underscore only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z-_]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});
function alpha_hyphen_dot(id) {
    var value = $("#" + id).val();
    var preg_check = /[^ A-Za-z-_.]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Alphabets,hypen and underscore only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z-_]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="alpha_hyphen_dot"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^ A-Za-z-_.]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Alphabets,hypen and underscore only allowed');
        $("#" + id).val(value.replace(/[^ A-Za-z-_]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});

function alpha_numeric_withoutspace(id) {
    var value = $("#" + id).val();
    var preg_check = /[^A-Za-z0-9]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Alpha Numerics only allowed');
        $("#" + id).val(value.replace(/[^A-Za-z0-9]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}

$('input[name="alpha_numeric_withoutspace"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^A-Za-z0-9]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Alpha Numerics only allowed');
        $("#" + id).val(value.replace(/[^A-Za-z0-9]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});
function numeric_only(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        //alert('Numerics only allowed');
        $("#P" + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="numeric_only"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^0-9]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        //alert('Numerics only allowed');
        $("#P" + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});

function numeric_dot(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}

function numeric_dot_crt(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;
    if (preg_check.test(value)) {

        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="numeric_dot"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^0-9.]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});


function numeric_slash(id, content) {
    debugger;
    var value = $("#" + id).val();
    var preg_check = /[^0-9/]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning(content);
        $("#" + id).val(value.replace(/[^0-9/]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}

function gramCheck(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
    else {
        var numbers = $("#" + id).val().split('.');
        var preDecimal = numbers[0];
        var postDecimal = numbers[1];

        if (preDecimal.length > 3 || postDecimal.length > 2) {
            if (preDecimal.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 3 digits before the decimal point.");
                var newval = preDecimal.substring(0, 3);
                //var newval = preDecimal.substring(0, (preDecimal.length) - 1);''
                if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                    postDecimal = "00";
                    newval = newval + '.' + postDecimal;
                }
                else {
                    newval = newval + '.' + postDecimal;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            else {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits after the decimal point.");
                var newval = postDecimal.substring(0, 2);
                console.log(newval);
                if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                    preDecimal = "0";
                    newval = preDecimal + '.' + newval;
                }
                else {
                    newval = preDecimal + '.' + newval;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            $("#" + id).addClass('error');
            $("#" + id).focus();
        }
    }
}
$('input[name="gramCheck"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
    else {
        var numbers = $("#" + id).val().split('.');
        var preDecimal = numbers[0];
        var postDecimal = numbers[1];

        if (preDecimal.length > 3 || postDecimal.length > 2) {
            if (preDecimal.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 3 digits before the decimal point.");
                var newval = preDecimal.substring(0, 3);
                //var newval = preDecimal.substring(0, (preDecimal.length) - 1);''
                if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                    postDecimal = "00";
                    newval = newval + '.' + postDecimal;
                }
                else {
                    newval = newval + '.' + postDecimal;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            else {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits after the decimal point.");
                var newval = postDecimal.substring(0, 2);
                console.log(newval);
                if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                    preDecimal = "0";
                    newval = preDecimal + '.' + newval;
                }
                else {
                    newval = preDecimal + '.' + newval;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            $("#" + id).addClass('error');
            $("#" + id).focus();
        }
    }
});

function CalCheck(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
    else {
        var numbers = $("#" + id).val().split('.');
        var preDecimal = numbers[0];
        var postDecimal = numbers[1];

        if (preDecimal.length > 2 || postDecimal.length > 2) {
            if (preDecimal.length > 2) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits before the decimal point.");
                var newval = preDecimal.substring(0, 2);
                //var newval = preDecimal.substring(0, (preDecimal.length) - 1);''
                if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                    postDecimal = "00";
                    newval = newval + '.' + postDecimal;
                }
                else {
                    newval = newval + '.' + postDecimal;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            else {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits after the decimal point.");
                var newval = postDecimal.substring(0, 2);
                console.log(newval);
                if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                    preDecimal = "0";
                    newval = preDecimal + '.' + newval;
                }
                else {
                    newval = preDecimal + '.' + newval;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            $("#" + id).addClass('error');
            $("#" + id).focus();
        }
    }
}
$('input[name="CalCheck"]').keyup(function (e) {
    debugger;
    var value = this.val
    var id = this.id;
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
    else {
        var numbers = $("#" + id).val().split('.');
        var preDecimal = numbers[0];
        var postDecimal = numbers[1];

        if (preDecimal.length > 2 || postDecimal.length > 2) {
            if (preDecimal.length > 2) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits before the decimal point.");
                var newval = preDecimal.substring(0, 2);
                //var newval = preDecimal.substring(0, (preDecimal.length) - 1);''
                if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                    postDecimal = "00";
                    newval = newval + '.' + postDecimal;
                }
                else {
                    newval = newval + '.' + postDecimal;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            else {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                alert("Maximum 2 digits after the decimal point.");
                var newval = postDecimal.substring(0, 2);
                console.log(newval);
                if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                    preDecimal = "0";
                    newval = preDecimal + '.' + newval;
                }
                else {
                    newval = preDecimal + '.' + newval;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            $("#" + id).addClass('error');
            $("#" + id).focus();
        }
    }
});
function CalCheckss(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
    else {
        var numbers = $("#" + id).val().split('.');
        var preDecimal = numbers[0];
        var postDecimal = numbers[1];

        if (preDecimal.length > 2 || postDecimal.length > 2) {
            if (preDecimal.length > 2) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits before the decimal point.");
                var newval = preDecimal.substring(0, 2);
                //var newval = preDecimal.substring(0, (preDecimal.length) - 1);''
                if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                    postDecimal = "00";
                    newval = newval + '.' + postDecimal;
                }
                else {
                    newval = newval + '.' + postDecimal;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            else {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits after the decimal point.");
                var newval = postDecimal.substring(0, 2);
                console.log(newval);
                if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                    preDecimal = "0";
                    newval = preDecimal + '.' + newval;
                }
                else {
                    newval = preDecimal + '.' + newval;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            $("#" + id).addClass('error');
            $("#" + id).focus();
        }
    }
}
$('input[name="CalCheckss"]').keyup(function (e) {
    debugger;
    var value = this.val
    var id = this.id;
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        toastr.warning('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
    else {
        var numbers = $("#" + id).val().split('.');
        var preDecimal = numbers[0];
        var postDecimal = numbers[1];

        if (preDecimal.length > 2 || postDecimal.length > 2) {
            if (preDecimal.length > 2) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits before the decimal point.");
                var newval = preDecimal.substring(0, 2);
                //var newval = preDecimal.substring(0, (preDecimal.length) - 1);''
                if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                    postDecimal = "00";
                    newval = newval + '.' + postDecimal;
                }
                else {
                    newval = newval + '.' + postDecimal;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            else {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                toastr.warning("Maximum 2 digits after the decimal point.");
                var newval = postDecimal.substring(0, 2);
                console.log(newval);
                if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                    preDecimal = "0";
                    newval = preDecimal + '.' + newval;
                }
                else {
                    newval = preDecimal + '.' + newval;
                }
                console.log(newval);
                $("#" + id).val(newval);
            }
            $("#" + id).addClass('error');
            $("#" + id).focus();
        }
    }
});
function email(pass) {
    debugger;
    var reg = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
    if (document.getElementById(pass.id).value != "") {
        var id = pass.id;
        if (!(pass.value.match(reg))) {
            $('#P' + id).show();
            $('#P' + id).fadeOut(8000);
            $('#P' + id).html('Enter email ID in this format “example@gmail.com”');
            //$("#" + pass.id).val('');
            $("#" + pass.id).focus();
            $('#' + id).val('');
            return false;
        }
    }

}

function isNumber(evt) {
    var iKeyCode = (evt.which) ? evt.which : evt.keyCode
    if (iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57))
        return false;

    return true;
}

function alphabetsOnly(id) {
    var value = $("#" + id).val();
    var preg_check = /[^A-Za-z ]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alphabets only allowed');
        $("#" + id).val(value.replace(/[^A-Za-z ]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
$('input[name="alphabetsOnly"]').keyup(function (e) {
    debugger;
    var pass = this.val
    var id = this.id
    var preg_check = /[^A-Za-z ]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Alphabets only allowed');
        $("#" + id).val(value.replace(/[^A-Za-z ]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});

function ClearError(id) {
    if ($('#' + id).val().trim() != '') {

        var id_dom = $('#' + id);
        $('#P' + id).html('');
        //id_dom.html('');
    }
}

function sixcomotwo(id) {
    debugger;
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 6 || postDecimal.length > 2) {
                if (preDecimal.length > 6) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999999.99.');
                    var newval = preDecimal.substring(0, 6);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal.');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 6) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999999.99.');
                var newval = txtval.substring(0, 6);
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
}

$('input[name="sixcomotwo"]').keyup(function (e) {
    debugger;
    var pass = this.val
    var id = this.id
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 6 || postDecimal.length > 2) {
                if (preDecimal.length > 6) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999999.99.');
                    var newval = preDecimal.substring(0, 6);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal.');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 6) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999999.99.');
                var newval = txtval.substring(0, 6);
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
});

function sixcomotwo_wot(evt, id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode >= 65 && charCode <= 90) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
        $(id).val("");
    }

    else if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
        $("#" + id).val("");
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 6 || postDecimal.length > 2) {
                if (preDecimal.length > 6) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999999.99.');
                    var newval = preDecimal.substring(0, 3);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal.');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 6) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999999.99.');
                var newval = txtval.substring(0, 3);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
}

function threecomotwo(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 3 || postDecimal.length > 2) {
                if (preDecimal.length > 3) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999.99.');
                    var newval = preDecimal.substring(0, 3);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal.');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999.99.');
                var newval = txtval.substring(0, 3);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
}
$('input[name="threecomotwo"]').keyup(function (e) {
    debugger;
    var pass = this.val
    var id = this.id
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 3 || postDecimal.length > 2) {
                if (preDecimal.length > 3) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999.99.');
                    var newval = preDecimal.substring(0, 3);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal.');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999.99.');
                var newval = txtval.substring(0, 3);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
});
function threecomotwo_wot(evt, id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode >= 65 && charCode <= 90) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }

    else if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 3 || postDecimal.length > 2) {
                if (preDecimal.length > 3) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999.99.');
                    var newval = preDecimal.substring(0, 3);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal.');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999.99.');
                var newval = txtval.substring(0, 3);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
}



function threecomoone(id) {
    debugger;
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 3 || postDecimal.length > 1) {
                if (preDecimal.length > 3) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999.99.');
                    var newval = preDecimal.substring(0, 3);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('1 digits after decimal.');
                    var newval = postDecimal.substring(0, 1);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999.9');
                var newval = txtval.substring(0, 3);
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
}
$('input[name="threecomoone"]').keyup(function (e) {
    debugger;
    var pass = this.val
    var id = this.id
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 3 || postDecimal.length > 1) {
                if (preDecimal.length > 3) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 999.99.');
                    var newval = preDecimal.substring(0, 3);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('1 digits after decimal.');
                    var newval = postDecimal.substring(0, 1);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 3) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 999.9');
                var newval = txtval.substring(0, 3);
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
});

function twocomoOne(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 2 || postDecimal.length > 1) {
                if (preDecimal.length > 2) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 99.9.');
                    var newval = preDecimal.substring(0, 2);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('1 digits after decimal.');
                    var newval = postDecimal.substring(0, 1);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 2) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 99.9.');
                var newval = txtval.substring(0, 2);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
}
$('input[name="threecomoone"]').keyup(function (e) {
    debugger;
    var pass = this.val
    var id = this.id
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 2 || postDecimal.length > 1) {
                if (preDecimal.length > 2) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 99.9.');
                    var newval = preDecimal.substring(0, 2);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('1 digits after decimal.');
                    var newval = postDecimal.substring(0, 1);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 2) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 99.9.');
                var newval = txtval.substring(0, 2);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }
    }
});

function Onecomotwo(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 1 || postDecimal.length > 2) {
                if (preDecimal.length > 1) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 9.99.');
                    var newval = preDecimal.substring(0, 1);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 1) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 9.99.');
                var newval = txtval.substring(0, 1);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }

    }
}
$('input[name="Onecomotwo"]').keyup(function (e) {
    debugger;
    var pass = this.val
    var id = this.id
    var preg_check = /[^0-9.]/ig;

    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).focus();
    }
    else {
        if ($("#" + id).val().indexOf('.') > -1) {
            var numbers = $("#" + id).val().split('.');
            var preDecimal = numbers[0];
            var postDecimal = numbers[1];

            if (preDecimal.length > 1 || postDecimal.length > 2) {
                if (preDecimal.length > 1) {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('Max value 9.99.');
                    var newval = preDecimal.substring(0, 1);
                    if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                        postDecimal = "00";
                        newval = newval + '.' + postDecimal;
                    }
                    else {
                        newval = newval + '.' + postDecimal;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                else {
                    $('#P' + id).show();
                    $('#P' + id).fadeOut(8000);
                    $('#P' + id).html('2 digits after decimal');
                    var newval = postDecimal.substring(0, 2);
                    console.log(newval);
                    if ($.trim(preDecimal) == "" || $.trim(preDecimal) == null) {
                        preDecimal = "0";
                        newval = preDecimal + '.' + newval;
                    }
                    else {
                        newval = preDecimal + '.' + newval;
                    }
                    console.log(newval);
                    $("#" + id).val(newval);
                }
                $("#" + id).focus();
            }
        }
        else {
            var txtval = $("#" + id).val();
            if (txtval.length > 1) {
                $('#P' + id).show();
                $('#P' + id).fadeOut(8000);
                $('#P' + id).html('Max value 9.99.');
                var newval = txtval.substring(0, 1);
                //if ($.trim(postDecimal) == "" || $.trim(postDecimal) == null) {
                // postDecimal = "00";
                // newval = newval + '.' + postDecimal;
                //}
                //else {
                // newval = newval + '.' + postDecimal;
                //}
                $("#" + id).val(newval);
                $("#" + id).focus();
            }
        }

    }
});
function sys(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 200) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High Value! Are you sure ?');
    }
}

function Dia(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 350) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function hypoglycemic(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 10) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function Pulse(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 300) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function HB(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 20) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function HbA1c(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 13) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function fastingblood(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 550) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}
function Tfastingblood(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_1').val();
    if (txtType == 1) {
        txtvalue = (txtvalue * 18).toFixed(2);
        if (txtvalue > 550) {
            $('#PtxtBloodsugarV_1').show();
            $('#PtxtBloodsugarV_1').fadeOut(8000);
            $('#PtxtBloodsugarV_1').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_1').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        console.log(txtvalue);
        if (txtvalue > 30.5) {
            $('#PtxtBloodsugarV_1').show();
            $('#PtxtBloodsugarV_1').fadeOut(8000);
            $('#PtxtBloodsugarV_1').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_1').val(txtvalue);
    }
}

function PostPrandialblood(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 750) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}


function PostPrandialblood_2(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_2').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_2').show();
            $('#PtxtBloodsugarV_2').fadeOut(8000);
            $('#PtxtBloodsugarV_2').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_2').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_2').show();
            $('#PtxtBloodsugarV_2').fadeOut(8000);
            $('#PtxtBloodsugarV_2').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_2').val(txtvalue);
    }
}


function PostPrandialblood_3(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_3').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_3').show();
            $('#PtxtBloodsugarV_3').fadeOut(8000);
            $('#PtxtBloodsugarV_3').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_3').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_3').show();
            $('#PtxtBloodsugarV_3').fadeOut(8000);
            $('#PtxtBloodsugarV_3').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_3').val(txtvalue);
    }
}


function PostPrandialblood_4(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_4').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_4').show();
            $('#PtxtBloodsugarV_4').fadeOut(8000);
            $('#PtxtBloodsugarV_4').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_4').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_4').show();
            $('#PtxtBloodsugarV_4').fadeOut(8000);
            $('#PtxtBloodsugarV_4').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_4').val(txtvalue);
    }
}



function PostPrandialblood_5(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_5').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_5').show();
            $('#PtxtBloodsugarV_5').fadeOut(8000);
            $('#PtxtBloodsugarV_5').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_5').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_5').show();
            $('#PtxtBloodsugarV_5').fadeOut(8000);
            $('#PtxtBloodsugarV_5').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_5').val(txtvalue);
    }
}

function PostPrandialblood_6(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_6').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_6').show();
            $('#PtxtBloodsugarV_6').fadeOut(8000);
            $('#PtxtBloodsugarV_6').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_6').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_6').show();
            $('#PtxtBloodsugarV_6').fadeOut(8000);
            $('#PtxtBloodsugarV_6').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_6').val(txtvalue);
    }
}


function PostPrandialblood_7(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_7').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_7').show();
            $('#PtxtBloodsugarV_7').fadeOut(8000);
            $('#PtxtBloodsugarV_7').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_7').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_7').show();
            $('#PtxtBloodsugarV_7').fadeOut(8000);
            $('#PtxtBloodsugarV_7').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_7').val(txtvalue);
    }
}

function PostPrandialblood_8(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtBloodsugarV_8').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 18
        if (txtvalue > 750) {
            $('#PtxtBloodsugarV_8').show();
            $('#PtxtBloodsugarV_8').fadeOut(8000);
            $('#PtxtBloodsugarV_8').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_8').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 18).toFixed(2);
        if (txtvalue > 41.6) {
            $('#PtxtBloodsugarV_8').show();
            $('#PtxtBloodsugarV_8').fadeOut(8000);
            $('#PtxtBloodsugarV_8').html('High value! Are you sure ?');
        }
        $('#txtBloodsugarV_8').val(txtvalue);
    }
}
function Insulin(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 600) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}


function TfastingInsulin(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtfastingInsulin').val();
    if (txtType == 1) {
        txtvalue = (txtvalue * 6.945).toFixed(2);
        if (txtvalue > 600) {
            $('#PtxtfastingInsulin').show();
            $('#PtxtfastingInsulin').fadeOut(8000);
            $('#PtxtfastingInsulin').html('High value! Are you sure ?');
        }
        $('#txtfastingInsulin').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 6.945).toFixed(2);
        if (txtvalue > 86.3) {
            $('#PtxtfastingInsulin').show();
            $('#PtxtfastingInsulin').fadeOut(8000);
            $('#PtxtfastingInsulin').html('High value! Are you sure ?');
        }
        $('#txtfastingInsulin').val(txtvalue);
    }
}


function CPeptide(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 9) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function LDL(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 300) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function TLDL(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtLDL').val();
    if (txtType == 1) {
        txtvalue = (txtvalue * 0.0259).toFixed(2);
        if (txtvalue > 300) {
            $('#PtxtLDL').show();
            $('#PtxtLDL').fadeOut(8000);
            $('#PtxtLDL').html('High value! Are you sure ?');
        }
        $('#txtLDL').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 0.0259).toFixed(2);
        if (txtvalue > 7.7) {
            $('#PtxtLDL').show();
            $('#PtxtLDL').fadeOut(8000);
            $('#PtxtLDL').html('High value! Are you sure ?');
        }
        $('#txtLDL').val(txtvalue);
    }
}



function HDL(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 300) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
    if (txtvalue < 10 && txtvalue > 0) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('The seems to be low. Are you sure ?');
    }
}


function THDL(id) {

    var txtType = $('#' + id).val();
    var txtvalue = $('#txtHDL').val();
    if (txtType == 1) {
        txtvalue = (txtvalue * 0.0259).toFixed(2);
        if (txtvalue > 300) {
            $('#PtxtHDL').show();
            $('#PtxtHDL').fadeOut(8000);
            $('#PtxtHDL').html('High value! Are you sure ?');
        }
        $('#txtHDL').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 0.0259).toFixed(2);
        if (txtvalue > 7.7) {
            $('#PtxtHDL').show();
            $('#PtxtHDL').fadeOut(8000);
            $('#PtxtHDL').html('High value! Are you sure ?');
        }
        $('#txtHDL').val(txtvalue);
    }
}

function LDLsum() {
    var LDL = $('#txtLDL').val();
    var HDL = $('#txtHDL').val();
    var totCholesterol = '';
    if (LDL != '' && HDL != '') {
        totCholesterol = parseFloat(LDL) + parseFloat(HDL);
    }
    $('#txtTCholesterol').val(totCholesterol);
}

function HDLRatio() {
    var HDL = $('#txtHDL').val();
    var totCholesterol = $('#txtTCholesterol').val();
    var HDLRatio = '';
    if (HDL != '' && totCholesterol != '') {
        HDLRatio = parseFloat(totCholesterol) / parseFloat(HDL);
        HDLRatio = HDLRatio.toFixed(2);
    }
    $('#txtHDLRatio').val(HDLRatio);
}

function Urea(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 75) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}


function TUrea(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtUrea').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 0.357
        if (txtvalue > 75) {
            $('#PtxtUrea').show();
            $('#PtxtUrea').fadeOut(8000);
            $('#PtxtUrea').html('High value! Are you sure ?');
        }
        $('#txtUrea').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 0.357).toFixed(2);
        if (txtvalue > 210) {
            $('#PtxtUrea').show();
            $('#PtxtUrea').fadeOut(8000);
            $('#PtxtUrea').html('High value! Are you sure ?');
        }
        $('#txtUrea').val(txtvalue);
    }
}


function Creatinine(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 250) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function TCreatinine(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtCreatinine').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 88.4
        if (txtvalue > 250) {
            $('#PtxtCreatinine').show();
            $('#PtxtCreatinine').fadeOut(8000);
            $('#PtxtCreatinine').html('High value! Are you sure ?');
        }
        $('#txtCreatinine').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 88.4).toFixed(2);
        if (txtvalue > 88.42) {
            $('#PtxtCreatinine').show();
            $('#PtxtCreatinine').fadeOut(8000);
            $('#PtxtCreatinine').html('High value! Are you sure ?');
        }
        $('#txtCreatinine').val(txtvalue);
    }
}

function Sodium(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 400) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}
function Potassium(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 20) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function Chlorine(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 200) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function BiCarbonate(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 350) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function Calcium(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 30) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function TCalcium(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtCalcium').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 0.25
        if (txtvalue > 30) {
            $('#PtxtCalcium').show();
            $('#PtxtCalcium').fadeOut(8000);
            $('#PtxtCalcium').html('High value! Are you sure ?');
        }
        $('#txtCalcium').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 0.25).toFixed(2);
        if (txtvalue > 120) {
            $('#PtxtCalcium').show();
            $('#PtxtCalcium').fadeOut(8000);
            $('#PtxtCalcium').html('High value! Are you sure ?');
        }
        $('#txtCalcium').val(txtvalue);
    }
}

function Phosphorus(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 35) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function TPhosphorus(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtPhosphorus').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 0.25
        if (txtvalue > 30) {
            $('#PtxtPhosphorus').show();
            $('#PtxtPhosphorus').fadeOut(8000);
            $('#PtxtPhosphorus').html('High value! Are you sure ?');
        }
        $('#txtPhosphorus').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 0.25).toFixed(2);
        if (txtvalue > 120) {
            $('#PtxtPhosphorus').show();
            $('#PtxtPhosphorus').fadeOut(8000);
            $('#PtxtPhosphorus').html('High value! Are you sure ?');
        }
        $('#txtPhosphorus').val(txtvalue);
    }
}

function Magnesium(id) {
    var txtvalue = $('#' + id).val();
    if (txtvalue > 8) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $('#P' + id).html('High value! Are you sure ?');
    }
}

function TMagnesium(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtMagnesium').val();
    if (txtType == 1) {
        txtvalue = txtvalue * 0.411
        if (txtvalue > 8) {
            $('#PtxtMagnesium').show();
            $('#PtxtMagnesium').fadeOut(8000);
            $('#PtxtMagnesium').html('High value! Are you sure ?');
        }
        $('#txtMagnesium').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 0.411).toFixed(2);
        if (txtvalue > 19.4) {
            $('#PtxtMagnesium').show();
            $('#PtxtMagnesium').fadeOut(8000);
            $('#PtxtMagnesium').html('High value! Are you sure ?');
        }
        $('#txtMagnesium').val(txtvalue);
    }
}



function Triglycerides(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtTriglycerides').val();
    if (txtType == 1) {
        txtvalue = (txtvalue * 6.945).toFixed(2);
        if (txtvalue > 300) {
            $('#PtxtTriglycerides').show();
            $('#PtxtTriglycerides').fadeOut(8000);
            $('#PtxtTriglycerides').html('High value! Are you sure ?');
        }
        $('#txtTriglycerides').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 6.945).toFixed(2);
        if (txtvalue > 86.3) {
            $('#PtxtTriglycerides').show();
            $('#PtxtTriglycerides').fadeOut(8000);
            $('#PtxtTriglycerides').html('High value! Are you sure ?');
        }
        $('#txtTriglycerides').val(txtvalue);
    }
}


function TVLDL(id) {
    var txtType = $('#' + id).val();
    var txtvalue = $('#txtVLDL').val();
    if (txtType == 1) {
        txtvalue = (txtvalue * 6.945).toFixed(2);
        if (txtvalue > 300) {
            $('#PtxtVLDL').show();
            $('#PtxtVLDL').fadeOut(8000);
            $('#PtxtVLDL').html('High value! Are you sure ?');
        }
        $('#txtVLDL').val(txtvalue);
    }
    else {
        txtvalue = (txtvalue / 6.945).toFixed(2);
        if (txtvalue > 86.3) {
            $('#PtxtVLDL').show();
            $('#PtxtVLDL').fadeOut(8000);
            $('#PtxtVLDL').html('High value! Are you sure ?');
        }
        $('#txtVLDL').val(txtvalue);
    }
}

function hundredonly(id) {
    var txtval = $('#' + id).val();
    if (txtval > 100) {
        $('#P_' + id).show();
        $('#P_' + id).fadeOut(8000);
        $('#P_' + id).html('High value! please check');
        $('#' + id).val('');
        $('#' + id).focus();
    }
    else {

    }

}

//$('#service_table_list').DataTable({
// "columnDefs": [{
// "responsive": true,
// "orderable": false,
// }]
//});

//$.when($('#divserviceReport').append(tr)).then($('#service_table_list').DataTable({
// "columnDefs": [{
// "orderable": false,
// }]
//}));
//$('#service_table_list').DataTable({
// pageLength: 25,
// responsive: true,
// dom: '<"html5buttons"B>lTfgitp',
// buttons: [
// { extend: 'copy' },
// { extend: 'csv' },
// { extend: 'excel', title: 'ExampleFile' },
// { extend: 'pdf', title: 'ExampleFile' },

// {
// extend: 'print',
// customize: function (win) {
// $(win.document.body).addClass('white-bg');
// $(win.document.body).css('font-size', '10px');

// $(win.document.body).find('table')
// .addClass('compact')
// .css('font-size', 'inherit');
// }
// }
// ]

//});
$('#radioBtn a').on('click', function () {
    var sel = $(this).data('title');
    var tog = $(this).data('toggle');
    $('#' + tog).prop('value', sel).trigger('change');

    $('a[data-toggle="' + tog + '"]').not('[data-title="' + sel + '"]').removeClass('active').addClass('not-active');
    $('a[data-toggle="' + tog + '"][data-title="' + sel + '"]').removeClass('not-active').addClass('active');

})

$('#radioBtncolor a').on('click', function () {
    var sel = $(this).data('title');
    var tog = $(this).data('toggle');
    $('#' + tog).prop('value', sel).trigger('change');

    $('a[data-toggle="' + tog + '"]').not('[data-title="' + sel + '"]').removeClass('active').addClass('not-active');
    $('a[data-toggle="' + tog + '"][data-title="' + sel + '"]').removeClass('not-active').addClass('active');

})
//var uploadField = document.getElementById("labdocuments");

//uploadField.onchange = function () {
// alert('test');
// if (this.files[0].size > 0) {
// alert("File is too big!");
// this.value = "";
// return false;
// };
//};

$('input[name="number"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var preg_check = /[^0-9]/ig;
    if (preg_check.test(value)) {
        $('#P' + this.id).show();
        $('#P' + this.id).fadeOut(8000);
        //alert('Numerics only allowed');
        $("#P" + this.id).html('Numerics only allowed');
        $("#" + this.id).val(value.replace(/[^0-9]/ig, ''));
        $("#" + this.id).addClass('error');
        $("#" + this.id).focus();
    }

});
//var MaxLength = 5;
//$('input[name="address1"]').keyup(function (e) {
// debugger;
// alert('test')
// var text = $(this).val();
// var chars = text.length;
// if (chars > MaxLength) {
// if (e.keyCode == 46 || e.keyCode == 8 || e.keyCode == 37 || e.keyCode == 38 || e.keyCode == 39 || e.keyCode == 40) {
// return true;
// }
// return false;
// }
// return true;
//});
$("textarea[maxlength]").on("propertychange input", function () {
    debugger;
    var limit = parseInt($(this).attr('maxlength'));
    if (this.value.length >= limit) {
        $('#P' + this.id).show();
        $('#P' + this.id).fadeOut(8000);
        $("#P" + this.id).html('Characters limit exceeded');
        this.value = this.value.substring(0, limit);
    }
});
function pan_validation(pass) {
    var reg = /[A-Z]{5}[0-9]{4}[A-Z]{1}$/;
    if (document.getElementById(pass.id).value != "") {
        var id = pass.id;
        if (!(pass.value.match(reg))) {
            $('#P' + id).show();
            $('#P' + id).fadeOut(8000);
            $('#P' + id).html('Invalid PAN Number');
            //$("#" + pass.id).val('');
            $("#" + pass.id).focus();
            $('#' + id).val('');
            return false;
        }
    }
}


function ifsc_validation(pass) {
    var reg = /^[A-Za-z]{4}\d{7}$/;
    if (document.getElementById(pass.id).value != "") {
        var id = pass.id;
        if (!(pass.value.match(reg))) {
            $('#P' + id).show();
            $('#P' + id).fadeOut(8000);
            $('#P' + id).html('Invalid IFSC Code');
            //$("#" + pass.id).val('');
            $("#" + pass.id).focus();
            $('#' + id).val('');
            return false;
        }
    }
}

function account_number_validation(pass) {
    var reg = "^\d{9,18}$";
    var reg1 = "^[-+\/\s]*([0-9][-+\/\s]*){9,}$";
    if (document.getElementById(pass.id).value != "") {
        var id = pass.id;
        if (!(pass.value.match(reg1))) {
            $('#P' + id).show();
            $('#P' + id).fadeOut(8000);
            $('#P' + id).html('Invalid Account Number');
            //$("#" + pass.id).val('');
            $("#" + pass.id).focus();
            $('#' + id).val('');
            return false;
        }
    }
}

function webistelinkorURL_validation(pass) {
    var reg = /^((https?|ftp|smtp):\/\/)?(www.)?[a-z0-9]+\.[a-z]+(\/[a-zA-Z0-9#]+\/?)*$/;
    if (document.getElementById(pass.id).value != "") {
        var id = pass.id;
        if (!(pass.value.match(reg))) {
            $('#P' + id).show();
            $('#P' + id).fadeOut(8000);
            $('#P' + id).html('Invalid Link');
            //$("#" + pass.id).val('');
            $("#" + pass.id).focus();
            $('#' + id).val('');
            return false;
        }
    }
}
//Decimal point limit upto 2
var validate = function (e) {
    var t = e.value;
    e.value = (t.indexOf(".") >= 0) ? (t.substr(0, t.indexOf(".")) + t.substr(t.indexOf("."), 3)) : t;
}
// first value of amount should not be zero-validation
var first_zero_validation = function (e) {
    debugger;
    var myLength = e.value;
    var len1 = (myLength.length) - 2;
    var len2 = (myLength.length) - 1;
    var id = e.id;
    if (myLength.charAt(len1) === '.' && myLength.charAt(len2) == '.') {
        $('#' + id).val(myLength.replace(/[^0-9]/ig, ''));
    }
    if (myLength.charAt(0) === '0' || myLength.charAt(0) === '.') {
        $('#' + id).val('');
    }
}
//first and second(both) should be only '.'-validation
var two_zero_validation = function (e) {
    var myLength = e.value;
    var id = e.id;
    var len1 = (myLength.length) - 2;
    var len2 = (myLength.length) - 1;
    if (myLength.charAt(0) === '.') {
        $('#' + id).val('');
        return false;
    }
    if (myLength.charAt(len1) === '.' && myLength.charAt(len2) == '.') {
        $('#' + id).val(myLength.replace(/[^0-9]/ig, ''));
    }
    if (myLength.charAt(0) === '0' && myLength.charAt(1).match(/\d/)) {
        $('#' + id).val(myLength.charAt(0));
    }
}
$('input[name="numeric_comma_only"]').keyup(function (e) {
    debugger;
    var value = this.value;
    var id = this.id;
    var preg_check = /[^0-9,]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        //alert('Numerics only allowed');
        $("#P" + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9,]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
});
//
function numeric_hypen_only(id) {
    var value = $("#" + id).val();
    var preg_check = /[^-0-9.]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        //alert('Numerics only allowed');
        $("#P" + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^-0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}
function numeric_dot_err(id) {
    var value = $("#" + id).val();
    var preg_check = /[^0-9.]/ig;
    if (preg_check.test(value)) {
        $('#P' + id).show();
        $('#P' + id).fadeOut(8000);
        $("#P" + id).html('Numerics only allowed');
        $("#" + id).val(value.replace(/[^0-9.]/ig, ''));
        $("#" + id).addClass('error');
        $("#" + id).focus();
    }
}