function UnderlyingSearch(control) {
    try {
        var key = window.event.keyCode;
        if (key == 13 || key == 9) {
            document.getElementById("ctl00_MainContent_btnSearch").click();
            return false;
        }
    } catch (e) {
        throw (e);
    }
}

function ExpandCollapse(e) {
    try {
        $(e).closest('div').find('#ctl00_MainContent_dgAssetDef').find('.tdtoggle').toggle()
    } catch (error) {
        throw (error);
    }
}

function RowsPerPageChanged() {
    try {
        var key = window.event.keyCode;
        if (key == 13 || key == 9) {
            document.getElementById("ctl00_MainContent_btnRowsPerPage").click();
            return false;
        }
    } catch (e) {
        throw (e);
    }
}

function onlyNominal(event, t) {
    try {
        var keyCodeEntered = (event.which) ? event.which : (window.event.keyCode) ? window.event.keyCode : -1;
        if (((keyCodeEntered >= 48) && (keyCodeEntered <= 57)) || keyCodeEntered == 46) { //changed to include decimal point || 24-Sep-2020 || Prachi
            return true;
        }
        else if (t.value.length > 0) {
            if (keyCodeEntered == 75 || keyCodeEntered == 107 || keyCodeEntered == 77 || keyCodeEntered == 109 || keyCodeEntered == 66 || keyCodeEntered == 98 || keyCodeEntered == 84 || keyCodeEntered == 116 || keyCodeEntered == 76 || keyCodeEntered == 108 || keyCodeEntered == 80 || keyCodeEntered == 112) {
                if (((t.value) && (t.value.indexOf('K') >= 0)) || ((t.value) && (t.value.indexOf('k') >= 0)) || ((t.value) && (t.value.indexOf('M') >= 0)) || ((t.value) && (t.value.indexOf('m') >= 0)) || ((t.value) && (t.value.indexOf('B') >= 0)) || (t.value) && (t.value.indexOf('b') >= 0) || (t.value) && (t.value.indexOf('T') >= 0) || (t.value) && (t.value.indexOf('t') >= 0) || (t.value) && (t.value.indexOf('L') >= 0) || (t.value) && (t.value.indexOf('l') >= 0) || (t.value) && (t.value.indexOf('P') >= 0) || (t.value) && (t.value.indexOf('p') >= 0))
                    return false;
                else
                    return true;
            }
        }

        return false;
    } catch (err) {
        console.log(err.Description);
    }
}

function OpenPopup(control, width, height, inCenter) {

    try {
        var strSource;
        strSource = $("#" + control.id).attr('sourceLink');
        var Title;
        Title = $("#" + control.id).attr('Title');

        if ($('#ctl00_MainContent_isPopupIframe').val() === "IFRAME") {
            $('body').find("#ModalBoxInside113").remove();

            var element;

            var iframe = $('<iframe id="#ModalDialog1" src="' + strSource + '&Master_Popup=POPUP"OpenPopup", status="no", resizable="yes", toolbar="no", scrollbars="no", menubar="no", frameborder="0", marginwidth="0", marginheight="0"></iframe>');

            var dialog = $("<div id='ModalBoxInside113'></div>").append(iframe).appendTo("body").dialog({
                height: height,
                width: width,
                modal: true,
                resizable: true,
                draggable: true,
                autoOpen: true,
                bgiframe: true,
                close: function (event, ui) { $('html').find('#collDialog').html(); },
                open: function (event, ui) { $('html').find('#collDialog').html(''); }
            });

            element = $('body > .ui-widget-overlay');
            if (element.length > 0) {
                element[0].style.height = $(window).height();
            }

            if (inCenter == false) {
                element = $('body > .ui-dialog');
                if (element.length > 0) {
                    element[element.length - 1].style.left = 75;
                    element[element.length - 1].style.top = 50;
                }
            }

            $(window).scrollLeft(0);
        }
        else {
            window.open(strSource + '&Master_Popup=POPUP', Title, 'top=50,left=75,status= no, resizable=yes, scrollbars=yes, toolbar=no,width=1750,height=850');
        }
    }
    catch (error) {
        throw (error);
    }
}

function CheckOptionalCheckChanged(control) {
    try {
        if ($('#ctl00_MainContent_chkOptional').is(':checked') === true)
            $('#ctl00_MainContent_grpTblOptional').show();
        else
            $('#ctl00_MainContent_grpTblOptional').hide();
    } catch (e) {
        throw (e);
    }
}
