<%if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("yes")) {%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.sql.*,java.util.Vector,sapphire.reports.*" %>
<%@page import="org.xnap.commons.i18n.I18n" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@page import="java.io.Serializable" %>
<%@page import="org.owasp.encoder.Encode"%>
<%@ taglib uri="/WEB-INF/ajaxtld/ajaxtags.tld" prefix="ajax" %>
<%@ taglib uri="/WEB-INF/ajaxtld/displaytag-12.tld" prefix="display" %>
<%@ include file="AJAXPopup.jsp" %>
<%@ include file="topPane.jsp" %>
<%@page import="org.apache.commons.logging.Log,org.apache.commons.logging.LogFactory" %>
<%}%>
<%
    I18n i18n = Sapphire.LANGUAGE_MAP.get((String) session.getAttribute("LANGUAGE_UNICODE"));
    String messageIn = "";
    String messageIn1 = "";
    String telantName = (String) session.getAttribute("TELANTNAME");%>
<%
    if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("yes")) {
        if (new Sapphire().checkModuleAccess((String) session.getAttribute("login"), "Settings", telantName) == 0) {
%>
<jsp:forward page="login_page.htm"></jsp:forward>
<%}%>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/ajaxtags.css"/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/displaytag.css"/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css1/displaytag1.css"/>
<%@include file="EXTJSIncludes-4.jsp" %>
<script type="text/javascript" src="cookies.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/prototype-1.6.0.3.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/scriptaculous.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/ajaxtags-1.2-beta1.js"></script>
<link href="<%=request.getContextPath()%>/CalendarControl.css" rel="stylesheet" type="text/css">
<script src="<%=request.getContextPath()%>/CalendarControl.js" language="JavaScript" type="text/javascript"></script>
</head>


<%@ include file="toptable.jsp" %>

<%}%>
<%if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("no")) {%>
<%@taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ include file="sd_commonImports.jsp" %>
<%@page import="sapphire.reports.DomainsVector" %>
<%@ taglib uri="/WEB-INF/ajaxtld/ajaxtags.tld" prefix="ajax" %>
<%@ taglib uri="/WEB-INF/ajaxtld/displaytag-12.tld" prefix="display" %>
<%@ include file="sd_commonHeadSection.jsp" %>
<%
    if (new GetUserData().getProjectPermission((String) session.getAttribute("LOGGEDUSERID"), request.getParameter("project"), telantNameHe) == 0) {
%>
<%@ include file="clearCache.jsp" %>
<jsp:forward page="login_page.htm"></jsp:forward>
<%} %>
<%@include file="EXTJSIncludes-4.jsp" %>
<%@ include file="SapphireStdCSS.jsp" %>
<%@ include file="AJAXPopup.jsp" %>
<%@ include file="SapphireStdJs.jsp" %>
<%if (session.getAttribute("SERVICEDESK_NEWUI_PAGE") != null) {%>
<link rel="stylesheet" type="text/css" href="css/style_sapphireIMS_New.css">
<%}%>

</head>
<%@ include file="toptable_ServiceDesk.jsp" %>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload='changeFunction()'>
<div id="mainContentArea1">
    <form name="form1" id="form1" method="post" action="">
        <security:csrfInput/>
        <table width="100%" border="0" height="70%" cellspacing="0" cellpadding="0">
            <tr><%String pID = request.getParameter("project");%>
                <td valign="top" id="settingstd" width="9%">
                    <div class="widgetBlock" id="settingsdiv">
                        <div class="widgetHeader"><h2>Settings</h2><span></span><a href="#" title="Collapse"
                                                                                   onclick="collapseSettings()"><img
                                src="updatedImages/widget_collapse.png" alt="Collapse"/></a></div>
                        <div class="widgetOuterWrapper">
                            <div class="widgetInnerWrapper">
                                <jsp:include page="SDProjectSettingsLeftPanelMenu.jsp">
                                    <jsp:param name="project" value="<%=request.getParameter("project")%>"/>
                                    <jsp:param name="module" value="templates"/>
                                </jsp:include>
                            </div>
                            <div class="widgetFooter"></div>
                        </div>
                    </div>
                    <div class="widgetBlock" id="settingscollapsediv" style="display:none">
                        <img style="cursor:pointer;" src="updatedImages/widget_expand_right.png"
                             title="Expand Project Settings" onclick="showSettings()"/>
                    </div>
                <td valign="top" id="settingsdatatd">
                    <div class="widgetBlock">
                        <div class="widgetHeader"><h2>Email Template Designer</h2>
                            <span></span><%=Sapphire.getProjectNames((String) session.getAttribute("LOGGEDUSERID"), request.getParameter("project"), telantNameHe)%>
                            <img src="assets/images/auditIco.png" title="Audit Log" border="0" class="newUIAudit" onclick="auditLogDetails();">
                            <img src="img/Audit_Log.png" title="Audit Log" border="0" style="cursor: pointer;margin: 15px;margin-top: 4px;height: 18px;width: 18px;" onclick="auditLogDetails();"></div>

                            <%}%>


                            <%if(request.getParameter("fromMainSettings")!=null && request.getParameter("fromMainSettings").equals("yes")){%>
                        <script type="text/javascript" src="assets/js/jquery.min.js"></script>
                        <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
                              onload='changeFunction()'>
                        <div id="mainContentArea1">
                            <table width="100%" height="70%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="100%" align="center" valign="top" class="inbg">
                                        <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr align="center" valign="top">
                                                <td colspan="3">
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <td rowspan="2" align="center" valign="top" class="inbg">
                                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                                <tr>

                                                                    <td valign="top" align="center">
                                                                        <table width="100%" border="0" cellspacing="0"
                                                                               cellpadding="0">
                                                                            <tr>
                                                                                <td colspan="2" align="center" valign="top">
                                                                                    <form name="form1" method="post"
                                                                                          action="MacroOperations">
                                                                                        <security:csrfInput/>
                                                                                        <table width="100%" height="100%"
                                                                                               border="0" cellpadding="0"
                                                                                               cellspacing="0">
                                                                                            <tr>
                                                                                                <td align="left">

                                                                                                    <table width="100%"
                                                                                                           border="0"
                                                                                                           cellspacing="0"
                                                                                                           cellpadding="0">
                                                                                                        <tr>
                                                                                                            <td colspan="3">
                                                                                                                <table width="100%"
                                                                                                                       border="0"
                                                                                                                       cellspacing="0"
                                                                                                                       cellpadding="0">
                                                                                                                    <tr>

                                                                                                                        <td>


                                                                                                                            <div style="width:99.5%">
                                                                                                                                <table width="100%"
                                                                                                                                       border="0"
                                                                                                                                       cellspacing="0"
                                                                                                                                       cellpadding="0"
                                                                                                                                       id="subTabNavigation">
                                                                                                                                    <tr>
                                                                                                                                        <td height="24"
                                                                                                                                            valign="bottom">

                                                                                                                                            <table width="100%"
                                                                                                                                                   border="0"
                                                                                                                                                   cellspacing="0"
                                                                                                                                                   cellpadding="0">
                                                                                                                                                <tr>
                                                                                                                                                    <td width="100%">
                                                                                                                                                        <ul>
                                                                                                                                                            <li class="selected">
                                                                                                                                                                <a href="#"><%= i18n.tr("Email Template Designer")%>
                                                                                                                                                                </a><span></span>
                                                                                                                                                            </li>
                                                                                                                                                        </ul>
                                                                                                                                                    </td>


                                                                                                                                                </tr>


                                                                                                                                            </table>

                                                                                                                                        </td>
                                                                                                                                        <td align='right'>
                                                                                                                                            <%=new Sapphire().getPaginationSelectedList(session, "removeJerk()") %>
                                                                                                                                        </td>
                                                                                                                                    </tr>

                                                                                                                                </table>
                                                                                                                        </td>
                                                                                                                    </tr>
                                                                                                                    <tr>

                                                                                                                        <td>
                                                                                                                            <%}%>

                                                                                                                            <div class="contentBlock noMargin">
                                                                                                                                <div class="widgetOuterWrapper">
                                                                                                                                    <div class="widgetInnerWrapper">
                                                                                                                                        <table width="100%"
                                                                                                                                               border="0"
                                                                                                                                               cellspacing="0"
                                                                                                                                               cellpadding="0">
                                                                                                                                            <tr>

                                                                                                                                                <% int count = 0; %>
                                                                                                                                            </tr>


                                                                                                                                            <tr>
                                                                                                                                                <td colspan="6"
                                                                                                                                                    bgcolor="#FFFFFF"
                                                                                                                                                    class="topPadding10px">
                                                                                                                                                    <a href="#"
                                                                                                                                                       ONCLICK="ShowCreatePopup()"
                                                                                                                                                       class='addbuttons greenBtn'><%= i18n.tr("ADD")%>
                                                                                                                                                    </a>
                                                                                                                                                    <a class='addbuttons'
                                                                                                                                                       href="#"
                                                                                                                                                       ONCLICK="deleteShow()"><%= i18n.tr("DELETE")%>
                                                                                                                                                    </a>
                                                                                                                                                    <a class='addbuttons'
                                                                                                                                                       href="#"
                                                                                                                                                       ONCLICK="setDefaultTemplate()"><%= i18n.tr("SET DEFAULT TEMPLATE DESIGN")%>
                                                                                                                                                    </a>
                                                                                                                                                    <input type="hidden" id="mainEmailTemplateDesignerScreen" value="1">
                                                                                                                                                    <input type="hidden" id="defaultEmailTemplateId" value='<%= session.getAttribute("Email_Template_Default_Value")%>'>
                                                                                                                                                    <%if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("yes")) {%>
                                                                                                                                                    <img src="assets/images/auditIco.png"
                                                                                                                                                         title="Audit Log"
                                                                                                                                                         border="0"
                                                                                                                                                         class="newUIAudit"
                                                                                                                                                         onclick="auditLogDetails();"
                                                                                                                                                         style="
    width: 23px;
    float: right;display:block
"><%}%>
                                                                                                                                                    <%if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("no")) {%>
                                                                                                                                                    <%=new Sapphire().getPaginationSelectedList(session, "removeJerk()") %>   <%}%>
                                                                                                                                                </td>
                                                                                                                                            </tr>

                                                                                                                                            <tr width="100%"
                                                                                                                                                bgcolor="#FFFFFF">
                                                                                                                                                <td colspan="7">

                                                                                                                                                    <div id="modelDescription"
                                                                                                                                                         style='width:100%;display:block'>


                                                                                                                                                    </div>
                                                                                                                                                </td>
                                                                                                                                            </tr>


                                                                                                                                        </table>
                                                                                                                                    </div>
                                                                                                                                </div>
                                                                                                                            </div>


                                                                                                                            <input type="hidden"
                                                                                                                                   name="count1"
                                                                                                                                   value="<%= count %>"/>
                                                                                                                            <input type="hidden"
                                                                                                                                   name="chkcount"
                                                                                                                                   value="0"/>


                                                                                                                        </td>

                                                                                                                    </tr>
                                                                                                                </table>
                        </div>
                </td>
            </tr>
        </table>
        </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <img src="spacer.gif" width="1" height="12">

            </td>
        </tr>
        </table>
        </td>
    </form>
    </tr>
    </table>
    <br>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
        <td colspan="3" align="right">
            <img src="spacer.gif" width="1" height="12">

    </tr>
    </td>
    </tr>

    </table> </td>

    </tr>
    </table></td>
    </tr>
    </table>
    </form>
</div>
<%@ include file="Sapphire_Footer.jsp" %>
</body>
<%
    String headerNames = "SlNo_SNo,TemplateName_title,IsDefault_id";
    session.setAttribute("HTMLTEMPLATELIST", headerNames);
%>
<script type="text/javascript">
    function changeProjectInSDSettings(pID){
        window.document.location="emailTemplateDesigner.jsp?fromMainSettings=no&module=designertemplates&project="+pID;
    }
    function removeJerk(){

        document.getElementById("modelDescription").innerHTML="";
        changeFunction();


    }
    function changeFunction() {
        var count = document.getElementById('paginationrowcount').value;
        Ext.tip.QuickTipManager.init();

        Ext.define('modelData' + count, {
            extend: 'Ext.data.Model',
            fields: [
                'SNo', 'domainName', 'title', 'who', 'when', 'id'
            ],
            idProperty: 'threadid'
        });

        // create the Data Store
        var store = Ext.create('Ext.data.Store', {
            pageSize: parseInt(count),
            model: 'modelData' + count,
            remoteSort: true,
            proxy: {
                type: 'ajax',
                url: 'JSONObject.jsp?sessionValue=HTML_TEMPLATE_LISTING_PAGING',
                reader: {
                    root: 'rows',
                    totalProperty: 'total'
                },
                simpleSortMode: true
            },
            sorters: [{
                property: 'SNo',
                direction: 'DESC'
            }]
        });

        // pluggable renders
        function renderCheck(value, p, record) {
            if (record.data.when == 0) {
                return Ext.String.format('&nbsp;&nbsp;&nbsp;&nbsp;');
            } else{
                return Ext.String.format(
                    '{0}<label class="checkCustGrid"></label>',
                    record.data.domainName);
        }
        }

        function renderTemplateName(value, p, record) {
            return Ext.String.format(
                '<span style="cursor:pointer" onclick=\'editTemplate("{0}")\'>{1}</a>',
                record.data.SNo, record.data.title);
        }

        function renderTemplateDownload(value, p, record) {
            var fileName = record.data.who;
            var downloadLink = 'downloadTemplate.do?fileName=' + fileName;

            return Ext.String.format(
                '<a href="{0}" target="_blank"><img src="assets/images/downloadIco.png" style="width: 15px;height: 15px;margin-left: 2px;"></a>',
                downloadLink
            );
        }

        function renderDefault(value, p, record) {
            if (record.data.id == 1) {
                return Ext.String.format(
                    '<img width="12" height="12" border="0" src="check_image.gif" title="checked">',
                    record.data.title, record.data.domainName);
            } else {
                return Ext.String.format(
                    '',
                    record.data.title, record.data.domainName);
            }
        }

        function renderTemplatePreview(value, p, record) {
            var templateId = record.data.SNo;
            return Ext.String.format(
                '<img src="assets/images/preview_20.png" class="previewColumnIco" id="{0}" style="filter: brightness(0.8);width: 15px;height: 15px;position: relative;top: 1px;left:1px" title="Preview">',
                templateId, record.data.title
            );
        }

        var pluginExpanded = true;
        var grid = Ext.create('Ext.grid.Panel', {
            id: 'paginationgrid',
            width: screen.width - 310,
            autoHeight: true,
            align: 'center',
            title: '',
            store: store,
            baseCls:'commonGridWid x-panel',
            disableSelection: false,
            loadMask: true,
            columnLines: true,
            noCache: true,
            stateId: 'htmlTemplatesGridStateID',
            stateful: true,
            stateEvents: ["columnmove", "columnresize", "sortchange", "show", "hide"],
            columnLines: true,
            viewConfig: {
                id: 'htmlTemplatesGV',
                trackOver: true,
                stripeRows: true

            },

            columns: [{
                id: 'htmlTemp-check',
                header: "<input type='checkbox' name='headerChk' id='headerChk' onClick='chk2()' /><label class='checkCustGrid' for='headerChk'></label>",
                dataIndex: '',
                renderer: renderCheck,
                width: 50,
                align: 'center',
                hideable: false,
                sortable: false
            }, {
                id: 'htmlTemp-download',
                header: "",
                dataIndex: 'default',
                renderer: renderTemplateDownload,
                width: 30,
                align: 'left',
                hideable: false,
                sortable: true
            }, {
                id: 'htmlTemp-preview',
                header: "",
                dataIndex: 'default',
                renderer: renderTemplatePreview,
                width: 30,
                align: 'left',
                hideable: false,
                sortable: true
            }, {
                id: 'htmlTemp-name',
                header: "Template Name",
                dataIndex: 'domainName',
                renderer: renderTemplateName,
                <%if(request.getParameter("fromMainSettings")!=null && request.getParameter("fromMainSettings").equals("no")){%>
                width: 900,
                <%}%>
                <%if(request.getParameter("fromMainSettings")!=null && request.getParameter("fromMainSettings").equals("yes")){%>
                width: 1000,
                <%}%>
                align: 'left',
                hideable: false,
                sortable: true
            }, {
                id: 'htmlTemp-isDefault',
                header: "Default Template",
                dataIndex: 'default',
                renderer: renderDefault,
                width: 200,
                align: 'left',
                hideable: false,
                sortable: true
            }],
            // paging bar on the bottom
            bbar: Ext.create('Ext.PagingToolbar', {
                store: store,
                items: [
                    Ext.create('Ext.Button', {
                        text: 'Excel',
                        handler: function () {
                            var ExcelFileName =  '<%= session.getAttribute("Excel_File_Name")%>';
                            exportToExcel("HTML_TEMPLATE_LISTING_PAGING", ExcelFileName, "HTMLTEMPLATELIST");
                        }
                    })
                ],
                displayInfo: true,
                displayMsg: 'Displaying email template design {0} - {1} of {2}',
                emptyMsg: "No email template design to display"

            }),
            renderTo: 'modelDescription'
        });

        // trigger the data store load
        store.loadPage(1);
        grid.setWidth(screen.width - 80);
        <%if(request.getParameter("fromMainSettings")!=null && request.getParameter("fromMainSettings").equals("yes")){%>
        grid.setWidth(screen.width - 120);
        <%}%>
    }

    function auditLogDetails() {
        <%if(request.getParameter("fromMainSettings")!=null && request.getParameter("fromMainSettings").equals("yes")){%>
        var url="EmailTemplateHistroy.jsp?fromMainSettings=yes";
        <%}%>
        <%if(request.getParameter("fromMainSettings")!=null && request.getParameter("fromMainSettings").equals("no")){%>
        var url="EmailTemplateHistroy.jsp?&fromMainSettings=no";
        <%}%>
        $.ajax({
            url: "getAuditLogDetails.do",
            method: "POST",
            dataType: "json",
            success: function (data) {
                popUpPage(url,1192,300,'&nbsp;');
            },
            error: function (xhr, status, error) {
                alert("Error occurred while fetching Email template design history");
            }
        });
    }
    function dis()
    {

        var aa=document.form1.check;
        if(aa.value==undefined)
        {
            cc=0;
            for(i=0;i<aa.length;i++){
                if(aa[i].checked==true)
                {
                    cc++;
                }
            }

        }
        document.form1.chkcount.value=cc;
    }
</script>
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script>
    function deleteShow() {
        var countChk = 0;
        var check = $('form[name="form1"] [name="check"]');
        var selectedTemplates = [];
        for (var i = 0; i < check.length; i++) {
            if (check[i].checked) {
                countChk += 1;
                selectedTemplates.push(check[i].value);
            }
        }

        if (selectedTemplates.length === 0) {
            alert("Please select Email template design(s) to delete");
            return;
        }

        var confirmDelete = confirm("Are you sure you want to delete the Email template design(s)?");
        if (confirmDelete == false) {
            for (var i = 0; i < check.length; i++) {
                if (check[i].checked) {
                    check[i].checked = false;
                }
            }
            return;
        }

        $.ajax({
            url: "deleteHtmlTemplate.do",
            method: "POST",
            data: {selectedTemplates: JSON.stringify(selectedTemplates)},
            dataType: "json",
            success: function (response) {
                if (response.success) {
                    alert("Email template design deleted successfully");
                    location.reload();
                } else {
                    alert("Error occurred while deleting Email template design(s)");
                }
            },
            error: function (xhr, status, error) {
                alert("Error occurred while deleting Email template design(s)");
            }
        });
    }
</script>
<%
    String rawFromMain = request.getParameter("fromMainSettings");
    String rawProject = request.getParameter("project");
%>
<script>
    $(document).ready(function() {
        var isFromMainSettings = '<%= Encode.forJavaScript(rawFromMain) %>';
        var projectId = '<%= Encode.forJavaScript(rawProject) %>';
        listHtmlTemplatesFunc(isFromMainSettings,projectId);
    });

</script>
<%if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("yes")) {%>
<jsp:include page="emailTemplateDesignerComponets.jsp">
    <jsp:param name="fromMainSettings" value="yes"/>
</jsp:include>
<%}%>
<%if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("no")) {%>
<jsp:include page="emailTemplateDesignerComponets.jsp">
    <jsp:param name="fromMainSettings" value="no"/>
</jsp:include>
<%}%>
<script type="text/javascript">
    var cc=0;
    function chk2()
    {
        var field1=document.form1.headerChk;
        var aa=document.form1.check;
        var i=0;
        if(field1.checked==true)
        {
            for(i=0;i<aa.length;i++)
            {
                if(aa[i].checked==false)
                {
                    aa[i].checked=true;
                    cc++;
                }
            }
            document.form1.chkcount.value=cc;
            return;
        }
        if(field1.checked==false)
        {
            for(i=0;i<aa.length;i++)
            {
                aa[i].checked=false;

                cc--;
            }
            document.form1.chkcount.value=cc;
            return;
        }
    }
</script>
<%
    if (request.getParameter("fromMainSettings") != null && request.getParameter("fromMainSettings").equals("yes") && session.getAttribute("SERVICEDESK_NEWUI_PAGE")!= null){%>
    <link rel="stylesheet" type="text/css" href="css/headerTop.css">
    <link rel="stylesheet" type="text/css" href="css/settings_newUI.css">
    <link rel="stylesheet" type="text/css" href="assets/css/multiple-select.min.css">
    <style>
        .x-grid-cell img[src="check_image.gif"]{
            background: transparent url(assets/images/check.png) no-repeat !important;
            background-size:18px !important;
            padding-left:23px;
            width:23px;
            display:block;
            position:relative;
            height:23px;
            margin:0;
        }
        td.topPadding10px {
            width: 100%;
            display: block;
            padding-top: 0;
            margin-top: -10px;
        }
        .newUIAudit{
            margin-right: 8px;
        }
        .x-grid-row .x-grid-cell .x-grid-cell-inner span[style*=pointer]{
            color: #333;
        }
    </style>
    <script type="text/javascript" src="js/jquery-ui.js"></script>    
    <script type="text/javascript" src="assets/js/i18n/i18n.js"></script>
    <script type="text/javascript" src="assets/js/i18n/messages_${LANGUAGE_UNICODE}.js"></script>
    <script type="text/javascript" src="assets/js/multiple-select.min.js"></script>
    <script type="text/javascript">
        $(function(){
        var isGridloaded=setInterval(function() {
                if($(".x-mask-msg-default").is(":visible")===false) {
                    var gridID = $(".commonGridWid").attr("id");
                   if (gridID !== null && gridID !== undefined) {
                        var paginationGridControl = Ext.getCmp('' + gridID);
                        paginationGridControl.setWidth(screen.width - 125);
                    }
                    paginationGridControl.setHeight(undefined);
                    paginationGridControl.maxHeight = 350;
                    paginationGridControl.body.setStyle({
                        'max-height': '350px'
                    });                        
                    paginationGridControl.updateLayout();                      
                    clearInterval(isGridloaded);
                }
            },100);
    });
        $("select#paginationrowcount").multipleSelect({
        single:true,
        onClick:function(){
            var isGridloaded=setInterval(function() {
                if($(".x-mask-msg-default").is(":visible")===false) {
                    var gridID = $(".commonGridWid").attr("id");
                   if (gridID !== null && gridID !== undefined) {
                        var paginationGridControl = Ext.getCmp('' + gridID);
                        paginationGridControl.setWidth(screen.width - 125);
                    }
                    paginationGridControl.setHeight(undefined);
                    paginationGridControl.maxHeight = 350;
                    paginationGridControl.body.setStyle({
                        'max-height': '350px'
                    });                        
                    paginationGridControl.updateLayout();                      
                    clearInterval(isGridloaded);
                }
            },100);
        }
    });
    </script>
<%}%>