

function showfilters() {

    $("#ctl00_MainContent_hdn_showfilters").val("Yes");

    var duration = 1500;

    $('#ctl00_MainContent_myDiv').toggle("slide", duration);

    $('#btnhidefilters').css("display", "block");
    $('#btnshowfilters').css("display", "none");

}

function hidefilters() {

    $("#ctl00_MainContent_hdn_showfilters").val("No");

    var duration = 1500;

    $('#ctl00_MainContent_myDiv').toggle("slide", duration);

    $('#btnshowfilters').css("display", "block");
    $('#btnhidefilters').css("display", "none");
}


function ShowHideMasterFilter() {
    if ($('#ctl00_MainContent_btnHideFilter1').attr("class") == 'btnShow') {
        $('#FilterPad').slideDown(500);
        $('#ctl00_MainContent_btnHideFilter1').attr("class", "btnHide");
        $('#ctl00_MainContent_hdn_showmasterfilter').val("Show");
        $("#ctl00_MainContent_txtSliderPosition").val(1)
    }
    else if ($('#ctl00_MainContent_btnHideFilter1').attr("class") == 'btnHide') {
        $('#FilterPad').slideUp(500);
        $('#ctl00_MainContent_btnHideFilter1').attr("class", "btnShow");
        $('#ctl00_MainContent_hdn_showmasterfilter').val("Hide");
        $("#ctl00_MainContent_txtSliderPosition").val(0)
    }
}

function HideMasterFilters() {
    $("#ctl00_MainContent_PENav").toggleClass("rightNav");
    $("#ctl00_MainContent_PENav").removeClass("leftNav");
    $("#ctl00_MainContent_txtSliderPosition").val(1);
    $('.tblMainPE').stop().animate({
        left: (-1 * 550) + 'px'
    }, 0);
}

function toggleLink(ctlLink) {
    var ctlLink = $(ctlLink).attr('id');
    $("#" + ctlLink).toggleClass('off');
    var button = $("#" + ctlLink);
    button.text(button.text() == "List" ? "Tabular" : "List")
    $("#ctl00_MainContent_hdnRMWView").val(button.text());
    $("#<%=ctlLink.ClientID %>").click();
}

function setYesNo() {
    $(document).ready(function () {
        var ctlLink = "#ctl00_MainContent_lnkRMWView";

        var button = $(ctlLink);
        button.text($("#ctl00_MainContent_hdnRMWView").val() == "List" ? "List" : "Tabular")
        if ($("#ctl00_MainContent_hdnRMWView").val() == "Tabular") {
            $(ctlLink).toggleClass('off');
        }
    });
}

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (evt, args) {
    try {

        if ($("#ctl00_MainContent_txtSliderPosition").val() == 1) {
            $("#ctl00_MainContent_PENav").removeClass("rightNav");
            $("#ctl00_MainContent_PENav").removeClass("leftNav");
            $("#ctl00_MainContent_PENav").toggleClass("rightNav");
        }
        else {
            $("#ctl00_MainContent_PENav").removeClass("rightNav");
            $("#ctl00_MainContent_PENav").removeClass("leftNav");
            $("#ctl00_MainContent_PENav").toggleClass("leftNav");
        }
    }
    catch (e) {
        throw (e);
    }
});

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () {
    Sys.WebForms.PageRequestManager.getInstance().remove_endRequest();
    /*$(document).ready(function () {

        $('.Grid:not(.noFreeze)').each(function (index, grid) {

            if ($('thead:first-child', grid).length == 0) {
                $('thead:first-child', grid).remove();
                $('<thead></thead>').insertBefore($('tbody:first', grid));
                $('thead:first-child', grid).append($('.GridHeader', grid));
            }

            if ($('tfoot:first', grid).length == 0) {
                $('tfoot:first', grid).remove();
                $('<tfoot></tfoot>').insertAfter($('tbody:last', grid));
                $('tfoot:first', grid).append($('.GridFooter', grid));
            }
			
			//<start> Modified by Prachi || 17-07-2020 || For grid height
            //GridY = ($(grid).offset().top + $('thead', grid).height() + $('tfoot', grid).height()) + 20;
            //GridHT = Number(window.innerHeight - 42) - GridY;

            GridY = ($(grid).position().top + $('thead', grid).height() + $('tfoot', grid).height()) + 20;
            GridHT = Number(window.innerHeight - 200) - GridY;

            GridHT = Number(GridHT <= 80 ? '100' : GridHT);
            $('tbody:first', grid).height(GridHT);
			//Commented the below line by saili || 17-07-2020 || As asked by Prachi
            //$('tbody:first', grid).width($('tbody:first', grid).width() + 14);
			//<end> Modified by Prachi || 17-07-2020 || For grid height
        });
    });*/
});

function ToggleNAVClass(control) {
    $("#" + control.id).removeClass("leftNav");
    $("#" + control.id).toggleClass("rightNav");

    if ($("#" + control.id).attr('class') == "rightNav") {
        $("#ctl00_MainContent_txtSliderPosition").val(1);
        $('.tblMainPE').stop().animate({
            left: (-1 * 550) + 'px'
        }, 0);/* Modified by Saili D/Akanksha P on 28 July 2020 || For increasing the speed of filter tab */
    }
    else {
        $("#" + control.id).toggleClass("leftNav");
        $("#ctl00_MainContent_txtSliderPosition").val(0);
        $("#" + control.id).removeClass("rightNav");
        $('.tblMainPE').stop().animate({
            left: (0) + 'px'
        }, 0); /* Modified by Saili D/Akanksha P on 28 July 2020 || For increasing the speed of filter tab */
    }
}
