/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: Apache Tomcat/8.5.24
 * Generated at: 2018-10-16 20:33:12 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.List;
import java.util.ArrayList;
import org.baraza.DB.BQuery;
import org.baraza.web.*;
import org.baraza.xml.BElement;

public final class subscription_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent,
                 org.apache.jasper.runtime.JspSourceImports {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  static {
    _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(6);
    _jspx_dependants.put("/./assets/include/calendar.jsp", Long.valueOf(1529480060000L));
    _jspx_dependants.put("/WEB-INF/lib/standard.jar", Long.valueOf(1529480060000L));
    _jspx_dependants.put("jar:file:/opt/baraza/build/webapps/baraza/WEB-INF/lib/standard.jar!/META-INF/c.tld", Long.valueOf(1064323020000L));
    _jspx_dependants.put("/./assets/include/subscription_guide.jsp", Long.valueOf(1529480060000L));
    _jspx_dependants.put("/./assets/include/billing_expired.jsp", Long.valueOf(1529480060000L));
    _jspx_dependants.put("/./assets/include/password_change.jsp", Long.valueOf(1529480060000L));
  }

  private static final java.util.Set<java.lang.String> _jspx_imports_packages;

  private static final java.util.Set<java.lang.String> _jspx_imports_classes;

  static {
    _jspx_imports_packages = new java.util.HashSet<>();
    _jspx_imports_packages.add("javax.servlet");
    _jspx_imports_packages.add("javax.servlet.http");
    _jspx_imports_packages.add("org.baraza.web");
    _jspx_imports_packages.add("javax.servlet.jsp");
    _jspx_imports_classes = new java.util.HashSet<>();
    _jspx_imports_classes.add("java.util.List");
    _jspx_imports_classes.add("org.baraza.xml.BElement");
    _jspx_imports_classes.add("org.baraza.DB.BQuery");
    _jspx_imports_classes.add("java.util.ArrayList");
  }

  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody;
  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fscope_005fnobody;

  private volatile javax.el.ExpressionFactory _el_expressionfactory;
  private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public java.util.Set<java.lang.String> getPackageImports() {
    return _jspx_imports_packages;
  }

  public java.util.Set<java.lang.String> getClassImports() {
    return _jspx_imports_classes;
  }

  public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
    if (_el_expressionfactory == null) {
      synchronized (this) {
        if (_el_expressionfactory == null) {
          _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
        }
      }
    }
    return _el_expressionfactory;
  }

  public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
    if (_jsp_instancemanager == null) {
      synchronized (this) {
        if (_jsp_instancemanager == null) {
          _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
        }
      }
    }
    return _jsp_instancemanager;
  }

  public void _jspInit() {
    _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fscope_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
  }

  public void _jspDestroy() {
    _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.release();
    _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fscope_005fnobody.release();
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    final java.lang.String _jspx_method = request.getMethod();
    if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
      response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
      return;
    }

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("<!DOCTYPE html>\r\n");
      out.write("\r\n");
      if (_jspx_meth_c_005fset_005f0(_jspx_page_context))
        return;
      out.write('\r');
      out.write('\n');
      if (_jspx_meth_c_005fset_005f1(_jspx_page_context))
        return;
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

	ServletContext context = getServletContext();
	String dbconfig = "java:/comp/env/jdbc/database";
	String xmlcnf = "subscription.xml";
	if(request.getParameter("logoff") == null) {
		session.setAttribute("xmlcnf", xmlcnf);
	} else {
		session.removeAttribute("xmlcnf");
		session.invalidate();
  	}
	String ps = System.getProperty("file.separator");
	String xmlfile = context.getRealPath("WEB-INF") + ps + "configs" + ps + xmlcnf;
	String reportPath = context.getRealPath("reports") + ps;
	String projectDir = context.getInitParameter("projectDir");
	if(projectDir != null) {
		xmlfile = projectDir + ps + "configs" + ps + xmlcnf;
		reportPath = projectDir + ps + "reports" + ps;
	}

	BWeb web = new BWeb(dbconfig, xmlfile, context);
	web.init(request);
	web.setMainPage(String.valueOf(pageContext.getAttribute("mainPage")));

	String entryformid = null;
	String action = request.getParameter("action");
	String value = request.getParameter("value");
	String post = request.getParameter("post");
	String process = request.getParameter("process");
	String actionprocess = request.getParameter("actionprocess");
	if(actionprocess != null) process = "actionProcess";
	String reportexport = request.getParameter("reportexport");
	String excelexport = request.getParameter("excelexport");
	String actionOp = null;

	String auditTable = null;

	String contentType = request.getContentType();
	if(contentType != null) {
		if ((contentType.indexOf("multipart/form-data") >= 0)) {
			web.updateMultiPart(request, context, context.getRealPath("WEB-INF" + ps + "tmp"));
		}
	}

	String opResult = null;
	if(process != null) {
		if(process.equals("actionProcess")) {
			opResult = web.setOperation(actionprocess, request);
		} else if(process.equals("FormAction")) {
			String actionKey = request.getParameter("actionkey");
			opResult = web.setOperation(actionKey, request);
		} else if(process.equals("Update")) {
			web.updateForm(request);
		} else if(process.equals("Delete")) {
			web.deleteForm(request);
		} else if(process.equals("Submit")) {
			web.submitGrid(request);
		} else if(process.equals("Check All")) {
			web.setSelectAll();
		} else if(process.equals("Audit")) {
			auditTable = web.getAudit();
		}
	}

	String fieldTitles = web.getFieldTitles();

	if(excelexport != null) reportexport = excelexport;
	if(reportexport != null) {
		out.println("	<script>");
		out.println("		window.open('show_report?report=" + reportexport + "');");
		out.println("	</script>");
	}

      out.write("\r\n");
      out.write("\r\n");
      out.write("<!--[if IE 8]> <html lang=\"en\" class=\"ie8 no-js\"> <![endif]-->\r\n");
      out.write("<!--[if IE 9]> <html lang=\"en\" class=\"ie9 no-js\"> <![endif]-->\r\n");
      out.write("<!--[if !IE]><!-->\r\n");
      out.write("<html lang=\"en\" class=\"no-js\">\r\n");
      out.write("<!--<![endif]-->\r\n");
      out.write("<!-- BEGIN HEAD -->\r\n");
      out.write("<head>\r\n");
      out.write("\t<meta charset=\"utf-8\"/>\r\n");
      out.write("\t<title>");
      out.print( pageContext.getServletContext().getInitParameter("web_title") );
      out.write("</title>\r\n");
      out.write("\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n");
      out.write("\t<meta content=\"width=device-width, initial-scale=1\" name=\"viewport\"/>\r\n");
      out.write("\t<meta content=\"Open Baraza Framework\" name=\"description\"/>\r\n");
      out.write("\t<meta content=\"Open Baraza\" name=\"author\"/>\r\n");
      out.write("\r\n");
      out.write("\t<!-- BEGIN GLOBAL MANDATORY STYLES -->\r\n");
      out.write("\t<link href=\"http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/font-awesome/css/font-awesome.min.css\"  rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/simple-line-icons/simple-line-icons.min.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap/css/bootstrap.min.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/uniform/css/uniform.default.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<!-- END GLOBAL MANDATORY STYLES -->\r\n");
      out.write("\t<!-- BEGIN PAGE LEVEL PLUGIN STYLES -->\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/fullcalendar/fullcalendar.min.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/jqvmap/jqvmap/jqvmap.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/morris/morris.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("\t<!-- END PAGE LEVEL PLUGIN STYLES -->\r\n");
      out.write("\t<!-- BEGIN PAGE STYLES -->\r\n");
      out.write("\t<link href=\"./assets/admin/pages/css/tasks.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/global/plugins/clockface/css/clockface.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-colorpicker/css/colorpicker.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\t<link href=\"./assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("\t<link href=\"./assets/global/plugins/jquery-tags-input/jquery.tagsinput.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("    <link href=\"./assets/global/plugins/select2/select2.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("    <link href=\"./assets/global/plugins/jquery-multi-select/css/multi-select.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
      out.write("    <link href=\"./assets/global/plugins/fullcalendar/fullcalendar.min.css\" rel=\"stylesheet\"/>\r\n");
      out.write("    <link href=\"./assets/global/plugins/bootstrap-toastr/toastr.min.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("    <link href=\"./assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("    <link href=\"./assets/admin/pages/css/profile.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\r\n");
      out.write("\t<link href=\"./assets/global/plugins/jstree/dist/themes/default/style.min.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\r\n");
      out.write("    <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->\r\n");
      out.write("    <link href=\"./assets/global/plugins/jquery-file-upload/css/jquery.fileupload.css\" rel=\"stylesheet\">\r\n");
      out.write("\r\n");
      out.write("\t<!-- END PAGE STYLES -->\r\n");
      out.write("\t<!-- BEGIN THEME STYLES -->\r\n");
      out.write("\t<!-- DOC: To use 'rounded corners' style just load 'components-rounded.css' stylesheet instead of 'components.css' in the below style tag -->\r\n");
      out.write("\r\n");
      out.write("    ");
 if(web.isMaterial()) { 
      out.write("\r\n");
      out.write("        <script >console.info(\"Material Design\") </script>\r\n");
      out.write("        <link href=\"./assets/global/css/components-md.css\" id=\"style_components\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("        <link href=\"./assets/global/css/plugins-md.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\r\n");
      out.write("    ");
 } else { 
      out.write("\r\n");
      out.write("        <script >console.info(\"Default Design\") </script>\r\n");
      out.write("        <link href=\"./assets/global/css/components-rounded.css\" id=\"style_components\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t    <link href=\"./assets/global/css/plugins.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("    ");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t<link href=\"./assets/admin/layout4/css/layout.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\t<link href=\"./assets/admin/layout4/css/themes/light.css\" rel=\"stylesheet\" type=\"text/css\" id=\"style_color\"/>\r\n");
      out.write("\r\n");
      out.write("\t<!-- END THEME STYLES -->\r\n");
      out.write("\t<link rel=\"shortcut icon\" href=\"./assets/logos/favicon.png\"/>\r\n");
      out.write("\r\n");
      out.write("\t<link href=\"./assets/global/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\r\n");
      out.write("    <link href=\"./assets/jqgrid/css/ui.jqgrid.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\r\n");
      out.write("\r\n");
      out.write("\t<!-- jsgrid css -->\r\n");
      out.write("    <link type=\"text/css\" rel=\"stylesheet\" href=\"./assets/jsgrid/jsgrid.min.css\" />\r\n");
      out.write("    <link type=\"text/css\" rel=\"stylesheet\" href=\"./assets/jsgrid/jsgrid-theme.min.css\" />\r\n");
      out.write("\r\n");
      out.write("    <link href=\"./assets/admin/layout4/css/custom.css\" rel=\"stylesheet\" type=\"text/css\"/>\r\n");
      out.write("\r\n");
      out.write("</head>\r\n");
      out.write("<!-- END HEAD -->\r\n");
      out.write("<!-- BEGIN BODY -->\r\n");
      out.write("<!-- DOC: Apply \"page-header-fixed-mobile\" and \"page-footer-fixed-mobile\" class to body element to force fixed header or footer in mobile devices -->\r\n");
      out.write("<!-- DOC: Apply \"page-sidebar-closed\" class to the body and \"page-sidebar-menu-closed\" class to the sidebar menu element to hide the sidebar by default -->\r\n");
      out.write("<!-- DOC: Apply \"page-sidebar-hide\" class to the body to make the sidebar completely hidden on toggle -->\r\n");
      out.write("<!-- DOC: Apply \"page-sidebar-closed-hide-logo\" class to the body element to make the logo hidden on sidebar toggle -->\r\n");
      out.write("<!-- DOC: Apply \"page-sidebar-hide\" class to body element to completely hide the sidebar on sidebar toggle -->\r\n");
      out.write("<!-- DOC: Apply \"page-sidebar-fixed\" class to have fixed sidebar -->\r\n");
      out.write("<!-- DOC: Apply \"page-footer-fixed\" class to the body element to have fixed footer -->\r\n");
      out.write("<!-- DOC: Apply \"page-sidebar-reversed\" class to put the sidebar on the right side -->\r\n");
      out.write("<!-- DOC: Apply \"page-full-width\" class to the body element to have full width page without the sidebar menu -->\r\n");
      out.write("<body class=\"page-header-fixed page-sidebar-closed-hide-logo page-sidebar-closed-hide-logo page-footer-fixed\">\r\n");
      out.write("\r\n");
      out.write("<!-- BEGIN HEADER -->\r\n");
      out.write("<div class=\"page-header navbar navbar-fixed-top\">\r\n");
      out.write("\t<!-- BEGIN HEADER INNER -->\r\n");
      out.write("\t<div class=\"page-header-inner\">\r\n");
      out.write("\t\t<!-- BEGIN LOGO -->\r\n");
      out.write("\t\t<div class=\"page-logo\">\r\n");
      out.write("\t\t\t<a href=\"index.jsp\">\r\n");
      out.write("\t\t\t<img src=\"./assets/logos/logo_header.png\" alt=\"logo\" style=\"margin: 20px 10px 0 10px; width: 107px;\" class=\"logo-default\"/>\r\n");
      out.write("\t\t\t</a>\r\n");
      out.write("\t\t\t<div class=\"menu-toggler sidebar-toggler\">\r\n");
      out.write("\t\t\t\t<!-- DOC: Remove the above \"hide\" to enable the sidebar toggler button on header -->\r\n");
      out.write("\t\t\t</div>\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t\t<!-- END LOGO -->\r\n");
      out.write("\t\t<!-- BEGIN RESPONSIVE MENU TOGGLER -->\r\n");
      out.write("\t\t<a href=\"javascript:;\" class=\"menu-toggler responsive-toggler\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\r\n");
      out.write("\t\t</a>\r\n");
      out.write("\t\t<!-- END RESPONSIVE MENU TOGGLER -->\r\n");
      out.write("\r\n");
      out.write("\t\t<!-- BEGIN PAGE TOP -->\r\n");
      out.write("\t\t<div class=\"page-top\">\r\n");
      out.write("\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t\t<!-- END PAGE TOP -->\r\n");
      out.write("\t</div>\r\n");
      out.write("\t<!-- END HEADER INNER -->\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("<!-- END HEADER -->\r\n");
      out.write("\r\n");
      out.write("<div class=\"clearfix\"></div>\r\n");
      out.write("\r\n");
      out.write("<!-- BEGIN CONTAINER -->\r\n");
      out.write("<div class=\"page-container\">\r\n");
      out.write("    <div class=\"page-sidebar-wrapper\">\r\n");
      out.write("\t\t<!-- DOC: Set data-auto-scroll=\"false\" to disable the sidebar from auto scrolling/focusing -->\r\n");
      out.write("\t\t<!-- DOC: Change data-auto-speed=\"200\" to adjust the sub menu slide up/down speed -->\r\n");
      out.write("\t\t<div class=\"page-sidebar navbar-collapse collapse\">\r\n");
      out.write("            ");
      out.write("<div class=\"row\">\n");
      out.write("    <div class=\"col-md-12\">\n");
      out.write("        <!-- BEGIN Portlet PORTLET-->\n");
      out.write("        <div class=\"portlet light bordered\">\n");
      out.write("            <div class=\"portlet-title\">\n");
      out.write("                <div class=\"caption font-green-sharp\">\n");
      out.write("                    <i class=\"icon-info font-green-sharp\"></i>\n");
      out.write("                    <!--<span class=\"caption-subject bold uppercase\"> Portlet</span>-->\n");
      out.write("                    <span class=\"caption-helper\">Guidelines</span>\n");
      out.write("                </div>\n");
      out.write("                <div class=\"actions\">\n");
      out.write("                    <a href=\"javascript:;\" class=\"btn btn-circle btn-default btn-icon-only fullscreen\"></a>\n");
      out.write("                </div>\n");
      out.write("            </div>\n");
      out.write("            <div class=\"portlet-body\">\n");
      out.write("                <div class=\"scroller\" style=\"height:460px\" data-rail-visible=\"1\" data-rail-color=\"yellow\" data-handle-color=\"#a1b2bd\">\n");
      out.write("                    <h4></h4>\n");
      out.write("                    <ol>\n");
      out.write("                        <li>Fill in all the required fields, correctly. Ensure you provide a valid email address.All fields with * are mandatory</li>\n");
      out.write("                        <li>Click on Apply. This sends login credentials to the email provided.</li>\n");
      out.write("                        <li>Check your email for the login credentials</li>\n");
      out.write("                        <li>Click <a href=\"index.jsp?xml=hr.xml\"> HERE </a> to login and complete your profile</li>\n");
      out.write("                    </ol>\n");
      out.write("                </div>\n");
      out.write("            </div>\n");
      out.write("        </div>\n");
      out.write("        <!-- END Portlet PORTLET-->\n");
      out.write("    </div>\n");
      out.write("</div>\n");
      out.write("\r\n");
      out.write("\t\t\t<!-- END SIDEBAR MENU -->\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t</div>\r\n");
      out.write("\r\n");
      out.write("\t<!-- BEGIN CONTENT -->\r\n");
      out.write("\t<div class=\"page-content-wrapper\">\r\n");
      out.write("\t\t<div class=\"page-content\">\r\n");
      out.write("\r\n");
      out.write("\t\t\t<!-- BEGIN PAGE CONTENT-->\r\n");
      out.write("\t\t\t<form id=\"baraza\" name=\"baraza\" method=\"post\" action=\"");
      out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${mainPage}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
      out.write("\" data-confirm-send=\"false\" data-ajax=\"false\" ");
      out.print( web.getEncType() );
      out.write(" >\r\n");
      out.write("\t\t\t\t");
      out.print( web.getHiddenValues() );
      out.write("\r\n");
      out.write("\t\t\t<div class=\"row\">\r\n");
      out.write("\t\t\t\t<div class=\"col-md-12\" >\r\n");
      out.write("\t\t\t\t\t<div class=\"tabbable tabbable-tabdrop\">");
      out.print( web.getTabs() );
      out.write("</div>\r\n");
      out.write("\t\t\t\t\t");
 if(opResult != null) out.println("<div style='color:#FF0000'>" + opResult + "</div>"); 
      out.write("\r\n");
      out.write("\t\t\t\t\t");
      out.print( web.getSaveMsg() );
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t\t\t\t\t<div class=\"portlet box ");
      out.print( web.getViewColour() );
      out.write("\">\r\n");
      out.write("\t\t\t\t\t\t<div class=\"portlet-title\">\r\n");
      out.write("\t\t\t\t\t\t\t<div class=\"caption\">\r\n");
      out.write("\t\t\t\t\t\t\t\t<i class=\"");
      out.print( web.getViewIcon() );
      out.write("\"></i>");
      out.print( web.getViewName() );
      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t</div>\r\n");
      out.write("\t\t\t\t\t\t\t<div class=\"tools\">\r\n");
      out.write("\t\t\t\t\t\t\t\t<!--<a href=\"javascript:;\" class=\"collapse\">\r\n");
      out.write("\t\t\t\t\t\t\t\t</a>\r\n");
      out.write("\t\t\t\t\t\t\t\t<a href=\"javascript:;\" class=\"reload\">\r\n");
      out.write("\t\t\t\t\t\t\t\t</a>\r\n");
      out.write("\t\t\t\t\t\t\t\t<a href=\"javascript:;\" class=\"remove\">\r\n");
      out.write("\t\t\t\t\t\t\t\t</a>-->\r\n");
      out.write("\t\t\t\t\t\t\t</div>\r\n");
      out.write("\t\t\t\t\t\t\t");
      out.print( web.getButtons() );
      out.write("\r\n");
      out.write("\t\t\t\t\t\t</div>\r\n");
      out.write("\r\n");
      out.write("\t\t\t\t\t\t<div class=\"portlet-body\" id=\"portletBody\" style=\"min-height:360px;\">\r\n");
      out.write("\t\t\t\t\t\t\t");
 if(web.hasExpired()) {
      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t\t");
      out.write('\n');
 

	String rSql = "SELECT a.product_id, a.product_name, a.details, a.annual_cost, a.expiry_date, a.sum_quantity, "
		+ "(a.sum_quantity * a.annual_cost) as renewal_fee "
		+ "FROM vws_productions a "
		+ "WHERE (a.is_renewed = false) AND (a.org_id = " + web.getUserOrg() + ")";

	BQuery rRs = new BQuery(web.getDB(), rSql);
	rRs.moveFirst();


      out.write("\n");
      out.write("\n");
      out.write("<div class='form-body'>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-9 control-label\"><b>Your need to renew the billing</b></label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Product ID</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("product_id") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Product Name</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("product_name") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Annual unit cost</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("annual_cost") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Expiry Date</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("expiry_date") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Quantity</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("sum_quantity") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Expiry Date</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("renewal_fee") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<label class=\"col-md-3 control-label\">Details</label>\n");
      out.write("\t\t<label class=\"col-md-6 control-label\">");
      out.print( rRs.getString("details") );
      out.write("</label>\n");
      out.write("\t</div>\n");
      out.write("\t<div class=\"row\">\n");
      out.write("\t\t<div class='col-md-3'>\n");
      out.write("\t\t\t<button class='btn btn-success i_tick icon small' id=\"renewalApply\" name='renewalApply' type='button' value='Apply'><i class='fa  fa-save'></i> &nbsp; Apply</button>\n");
      out.write("\t\t</div>\n");
      out.write("\t</div>\n");
      out.write("</div>\n");
      out.write("\n");
      out.write("\n");
 rRs.close(); 
      out.write('\n');
      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t");
} else {
      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t\t");
      out.print( web.getBody(request, reportPath) );
      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t");
 } 
      out.write("\r\n");
      out.write("\t\t\t\t\t\t</div>\r\n");
      out.write("\r\n");
      out.write("\t\t\t\t\t\t");
 actionOp = web.getOperations();
						if(actionOp != null) {	
      out.write("\r\n");
      out.write("                            <div class=\"row\" style=\"\">\r\n");
      out.write("                                <div class=\"col-md-2\" >\r\n");
      out.write("                                    ");
      out.print( actionOp );
      out.write("\r\n");
      out.write("                                </div>\r\n");
      out.write("\r\n");
      out.write("                                <div class=\"col-md-1\" >\r\n");
      out.write("                                    <button type=\"button\" id=\"btnAction\" name=\"process\" value=\"Action\" class=\"btn btn-sm green\">Action</button>\r\n");
      out.write("                                </div>\r\n");
      out.write("                            </div>\r\n");
      out.write("\t\t\t\t\t\t");
	} 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t\t\t\t\t\t");
 if(fieldTitles != null) { 
      out.write("\r\n");
      out.write("\t\t\t\t\t\t\t<table class=\"table\" style=\"margin-bottom:0px;\"><tr>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td>");
      out.print( fieldTitles );
      out.write("</td>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t<select class='fnctcombobox form-control' name='filtertype' id='filtertype'>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='ilike'>Contains (case insensitive)</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='like'>Contains (case sensitive)</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='='>Equal to</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='>'>Greater than</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='<'>Less than</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='<='>Less or Equal</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<option value='>='>Greater or Equal</option>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t</select>\r\n");
      out.write("\t\t\t\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td><input class=\"form-control\" name=\"filtervalue\" type=\"text\" id=\"filtervalue\" /></td>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td><input class=\"form-control\" name='filterand' id='filterand' type='checkbox'/> And</td>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td><input class=\"form-control\" name='filteror' id='filteror' type='checkbox' /> Or</td>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td><button type=\"button\" class=\"form-control\" name=\"btSearch\" id=\"btSearch\" value=\"Search\">Search</button></td>\r\n");
      out.write("\t\t\t\t\t\t\t\t<td><font color=\"blue\">");
      out.print(web.getFilterStatus());
      out.write("</font></td>\r\n");
      out.write("\t\t\t\t\t\t\t</tr></table>\r\n");
      out.write("\t\t\t\t\t\t");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t\t\t\t\t\t<div class=\"note note-info note-bordered\">\r\n");
      out.write("\t\t\t\t\t\t\t<div class=\"row\">");
      out.print( web.showFooter() );
      out.write("</div>\r\n");
      out.write("\t\t\t\t\t\t\t<div class=\"row\">");
      out.print( web.getMenuMsg(xmlcnf) );
      out.write("</div>\r\n");
      out.write("\t\t\t\t\t\t</div>\r\n");
      out.write("\t\t\t\t\t</div>\r\n");
      out.write("\r\n");
      out.write("                    ");
 if(web.isFileImport()) { 
      out.write("\r\n");
      out.write("                        <div class=\"row\"> <!-- file upload row -->\r\n");
      out.write("                            <div class=\"col-md-12\">\r\n");
      out.write("                                <span class=\"btn green fileinput-button\">\r\n");
      out.write("                                    <i class=\"glyphicon glyphicon-plus\"></i>\r\n");
      out.write("                                <span>Add files...</span>\r\n");
      out.write("                                <!-- The file input field used as target for the file upload widget -->\r\n");
      out.write("                                    <input id=\"fileupload\" type=\"file\" name=\"files[]\" multiple>\r\n");
      out.write("                                </span>\r\n");
      out.write("                                <br>\r\n");
      out.write("                                <br>\r\n");
      out.write("                                <div id=\"progress\" class=\"progress progress-striped active\" role=\"progressbar\" aria-valuemin=\"0\" aria-valuemax=\"100\">\r\n");
      out.write("                                    <div class=\"progress-bar progress-bar-success\" style=\"width:0%;\">\r\n");
      out.write("                                    </div>\r\n");
      out.write("                                </div>\r\n");
      out.write("                                <!-- The container for the uploaded files -->\r\n");
      out.write("                                <div id=\"files\" class=\"files\"></div>\r\n");
      out.write("                                <br>\r\n");
      out.write("                            </div>\r\n");
      out.write("                        </div><!-- end file upload row -->\r\n");
      out.write("                    ");
 } 
      out.write("\r\n");
      out.write("                </div>\r\n");
      out.write("            </form>\r\n");
      out.write("\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t</div>\r\n");
      out.write("\t<!-- END CONTENT -->\r\n");
      out.write("</div>\r\n");
      out.write("<!-- END CONTAINER -->\r\n");
      out.write("<!-- BEGIN FOOTER -->\r\n");
      out.write("<div class=\"page-footer\">\r\n");
      out.write("\t<div class=\"page-footer-inner\">\r\n");
      out.write("\t\t2017 &copy; Open Baraza. <a href=\"http://dewcis.com\">Dew Cis Solutions Ltd.</a> All Rights Reserved\r\n");
      out.write("\t</div>\r\n");
      out.write("\t<div class=\"scroll-to-top\">\r\n");
      out.write("\t\t<i class=\"icon-arrow-up\"></i>\r\n");
      out.write("\t</div>\r\n");
      out.write("</div>\r\n");
      out.write("\r\n");
      out.write("<!-- END FOOTER -->\r\n");
      out.write("<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->\r\n");
      out.write("<!-- BEGIN CORE PLUGINS -->\r\n");
      out.write("<!--[if lt IE 9]>\r\n");
      out.write("<script src=\"./assets/global/plugins/respond.min.js\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/excanvas.min.js\"></script>\r\n");
      out.write("<![endif]-->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-migrate.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-ui/jquery-ui.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<!--<script src=\"./jquery-ui-1.11.4.custom/jquery-ui.min.js\"  type=\"text/javascript\"></script>-->\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap/js/bootstrap.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery.blockui.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery.cokie.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/uniform/jquery.uniform.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<!-- END CORE PLUGINS -->\r\n");
      out.write("<!-- BEGIN PAGE LEVEL PLUGINS -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/jquery.vmap.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/maps/jquery.vmap.russia.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/maps/jquery.vmap.world.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/maps/jquery.vmap.europe.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/maps/jquery.vmap.germany.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/maps/jquery.vmap.usa.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jqvmap/jqvmap/data/jquery.vmap.sampledata.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js\" type=\"text/javascript\" ></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/ckeditor/ckeditor.js\" type=\"text/javascript\" ></script>\r\n");
      out.write("\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/select2/select2.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!-- IMPORTANT! fullcalendar depends on jquery-ui.min.js for drag & drop support -->\r\n");
      out.write("<script src=\"./assets/global/plugins/morris/morris.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/morris/raphael-min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery.sparkline.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<!-- END PAGE LEVEL PLUGINS -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js\"></script>\r\n");
      out.write("<!-- The Load Image plugin is included for the preview images and image resizing functionality -->\r\n");
      out.write("<!--<script src=\"//blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js\"></script>-->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/vendor/load-image.min.js\"></script>\r\n");
      out.write("<!-- The Canvas to Blob plugin is included for image resizing functionality -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/vendor/canvas-to-blob.min.js\"></script>\r\n");
      out.write("<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.iframe-transport.js\"></script>\r\n");
      out.write("<!-- The basic File Upload plugin -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.fileupload.js\"></script>\r\n");
      out.write("<!-- The File Upload processing plugin -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.fileupload-process.js\"></script>\r\n");
      out.write("<!-- The File Upload image preview & resize plugin -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.fileupload-image.js\"></script>\r\n");
      out.write("<!-- The File Upload audio preview plugin -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.fileupload-audio.js\"></script>\r\n");
      out.write("<!-- The File Upload video preview plugin -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.fileupload-video.js\"></script>\r\n");
      out.write("<!-- The File Upload validation plugin -->\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-file-upload/js/jquery.fileupload-validate.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<!-- BEGIN PAGE LEVEL SCRIPTS -->\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/scripts/metronic.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/admin/layout4/scripts/layout.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/admin/layout4/scripts/demo.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/admin/pages/scripts/index3.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/admin/pages/scripts/tasks.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/admin/pages/scripts/components-pickers.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-multi-select/js/jquery.multi-select.js\" type=\"text/javascript\" ></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jquery-multi-select/js/jquery.quicksearch.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/clockface/js/clockface.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/jstree/dist/jstree.min.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/admin/pages/scripts/ui-tree.js\" type=\"text/javascript\"></script>\r\n");
      out.write("<script src=\"./assets/global/plugins/bootstrap-toastr/toastr.min.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<!-- END PAGE LEVEL SCRIPTS -->\r\n");
      out.write("\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/jqgrid/js/i18n/grid.locale-en.js\"></script>\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/jqgrid/js/jquery.jqGrid.min.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<!-- jsgrid for sub form editing-->\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/jsgrid/jsgrid.min.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<!-- calendar-->\r\n");
      out.write("<!-- IMPORTANT! fullcalendar depends on jquery-ui.min.js for drag & drop support -->\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/global/plugins/moment.min.js\"></script>\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/global/plugins/fullcalendar/fullcalendar.min.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<!-- openbaraza js-->\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/js/attendance-task.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/js/grid_date.js\"></script>\r\n");
      out.write("<script type=\"text/javascript\" src=\"./assets/js/grid_time.js\"></script>\r\n");
      out.write("\r\n");
      out.write("<script>\r\n");
      out.write("    jQuery(document).ready(function() {\r\n");
      out.write("        Metronic.init(); // init metronic core componets\r\n");
      out.write("        Layout.init(); // init layout\r\n");
      out.write("        Calendar.init();\r\n");
      out.write("        $('.date-picker').datepicker({\r\n");
      out.write("            autoclose: true\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("\t\tvar date = new Date();\r\n");
      out.write("\t\t$('.date-picker2').datepicker({\r\n");
      out.write("            autoclose: true,\r\n");
      out.write("\t\t\tstartDate:date\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("\t\tUITree.init();\r\n");
      out.write("\r\n");
      out.write("\t\t$('.clockface').clockface({\r\n");
      out.write("            format: 'hh:mm a',\r\n");
      out.write("            trigger: 'manual'\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("        $('.clockface-toggle').click(function (e) {\r\n");
      out.write("            e.stopPropagation();\r\n");
      out.write("            var target = $(this).attr('data-target');\r\n");
      out.write("            $('#' + target ).clockface('toggle');\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("        $('.timepicker-no-seconds').timepicker({\r\n");
      out.write("            autoclose: true,\r\n");
      out.write("            minuteStep: 5\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("        $('.timepicker-24').timepicker({\r\n");
      out.write("            autoclose: true,\r\n");
      out.write("            minuteStep: 5,\r\n");
      out.write("            showSeconds: false,\r\n");
      out.write("            showMeridian: false\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("        // handle input group button click\r\n");
      out.write("        $('.timepicker').parent('.input-group').on('click', '.input-group-btn', function(e){\r\n");
      out.write("            e.preventDefault();\r\n");
      out.write("            $(this).parent('.input-group').find('.timepicker').timepicker('showWidget');\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("        $('#filtervalue').keypress(function(event){\r\n");
      out.write("            var keycode = (event.keyCode ? event.keyCode : event.which);\r\n");
      out.write("            if(keycode == '13'){\r\n");
      out.write("                $('#btSearch').click();\r\n");
      out.write("            }\r\n");
      out.write("        });\r\n");
      out.write("    });\r\n");
      out.write("</script>\r\n");
      out.write("\r\n");
      out.write("<script>\r\n");
      out.write("\r\n");
      out.write("\t");
      out.print( web.getAccordionJs() );
      out.write("\r\n");
      out.write("\r\n");
      out.write("</script>\r\n");
      out.write("\r\n");
      out.write("<script>\r\n");
      out.write("\t\r\n");
      out.write("\tvar jsonFieldUpdates = [];\r\n");
      out.write("\t$('#btProcess').click(function(){\r\n");
      out.write("        $.post(\"ajax?fnct=tableviewupdate\", {jsonfield: JSON.stringify(jsonFieldUpdates)}, function(data) {\r\n");
      out.write("            if(data.error == true){\r\n");
      out.write("                toastr['error'](data.message, \"Error\");\r\n");
      out.write("            }else if(data.error == false){\r\n");
      out.write("\t\t\t\tlocation.reload();\r\n");
      out.write("                toastr['success'](data.message, \"Ok\");\r\n");
      out.write("            }\r\n");
      out.write("        }, \"JSON\");\r\n");
      out.write("\t});\r\n");
      out.write("\r\n");
      out.write("\tfunction readComboValue(fieldName, keyid, selectObj) {\r\n");
      out.write("\t\tvar selectIndex = selectObj.selectedIndex;\r\n");
      out.write("\t\tvar selectValue = selectObj.options[selectIndex].value;\r\n");
      out.write("\t\tvar jsonField = {\"field_name\" : fieldName, \"key_id\" : keyid, \"field_value\" : selectValue};\r\n");
      out.write("\t\tjsonFieldUpdates.push(jsonField);\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("   \tfunction updateField(valueid, valuename) {\r\n");
      out.write("\t\tdocument.getElementsByName(valueid)[0].value = valuename;\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("\tfunction resizeJqGridWidth(grid_id, div_id, width){\r\n");
      out.write("\t    $(window).bind('resize', function() {\r\n");
      out.write("\t        $('#' + grid_id).setGridWidth(width, true); //Back to original width\r\n");
      out.write("\t        $('#' + grid_id).setGridWidth($('#' + div_id).width(), true); //Resized to new width as per window\r\n");
      out.write("\t     }).trigger('resize');\r\n");
      out.write("\t}\r\n");
      out.write("\r\n");
      out.write("    ");
 if(web.isGrid()) { 
      out.write("\r\n");
      out.write("\tvar lastsel2;\r\n");
      out.write("\r\n");
      out.write("    var jqcf = ");
      out.print( web.getJSONHeader() );
      out.write(";\r\n");
      out.write("\r\n");
      out.write("    jqcf.rowNum = 30;\r\n");
      out.write("    jqcf.height = 300;\r\n");
      out.write("    jqcf.rowList=[10,20,30,40,50];\r\n");
      out.write("    jqcf.datatype = \"json\";\r\n");
      out.write("    jqcf.pgbuttons = true;\r\n");
      out.write("\tjqcf.autoencode = false;\r\n");
      out.write("\tjqcf.editurl = \"ajaxupdate\";\r\n");
      out.write("\r\n");
      out.write("    jqcf.jsonReader = {\r\n");
      out.write("        repeatitems: false,\r\n");
      out.write("        root: function (obj) { return obj; },\r\n");
      out.write("        page: function (obj) { return jQuery(\"#jqlist\").jqGrid('getGridParam', 'page'); },\r\n");
      out.write("        total: function (obj) { return Math.ceil(obj.length / jQuery(\"#jqlist\").jqGrid('getGridParam', 'rowNum')); },\r\n");
      out.write("        records: function (obj) { return obj.length; }\r\n");
      out.write("    }\r\n");
      out.write("\r\n");
      out.write("    ");
 if(actionOp != null) {	
      out.write("\r\n");
      out.write("      jqcf.multiselect = true;\r\n");
      out.write("    ");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t/* check if user is using mobile*/\r\n");
      out.write("    var isMobile = false; //initiate as false\r\n");
      out.write("    // device detection\r\n");
      out.write("    if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)\r\n");
      out.write("        || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(navigator.userAgent.substr(0,4))) isMobile = true;\r\n");
      out.write("\r\n");
 if(web.hasChildren()) { 
      out.write("\r\n");
      out.write("    if(isMobile){\r\n");
      out.write("        jqcf.onSelectRow = function(rowid) {\r\n");
      out.write("            console.log(rowid);\r\n");
      out.write("            var data = jQuery(\"#jqlist\").jqGrid('getRowData',rowid);\r\n");
      out.write("            location.replace(data.CL);\r\n");
      out.write("        };\r\n");
      out.write("\r\n");
      out.write("    }else{\r\n");
      out.write("\t\tjqcf.ondblClickRow = function(rowid) {\r\n");
      out.write("\t\t    console.log(rowid);\r\n");
      out.write("\t\t    var data = jQuery(\"#jqlist\").jqGrid('getRowData',rowid);\r\n");
      out.write("\t\t    location.replace(data.CL);\r\n");
      out.write("\t\t};\r\n");
      out.write("    }\r\n");
 } 
      out.write("\r\n");
      out.write("\r\n");
 if(web.isEditField()) { 
      out.write("\r\n");
      out.write("\tjqcf.onSelectRow = function(id){\r\n");
      out.write("\t\t//console.log(\" HAS web.isEditField()  : ");
      out.print(web.isEditField());
      out.write("\")\r\n");
      out.write("\t  \tif(id && id!==lastsel2){\r\n");
      out.write("\t\t\t//console.info('id : ' + id + '\\nlastsel2 : ' + lastsel2);\r\n");
      out.write("\r\n");
      out.write("\t\t\tvar data = jQuery(\"#jqlist\").jqGrid('getRowData', id);\r\n");
      out.write("\t\t\tconsole.info(data);\r\n");
      out.write("\r\n");
      out.write("\t\t\t//jQuery('#jqlist').restoreRow(lastsel2);\r\n");
      out.write("\r\n");
      out.write("\t\t\tvar editparameters = {\r\n");
      out.write("\t\t\t\t\"keys\" : true,\r\n");
      out.write("\t\t\t\t\"oneditfunc\" : null,\r\n");
      out.write("\t\t\t\t\"successfunc\" : null,\r\n");
      out.write("\t\t\t\t\"extraparam\" : {\"KF\":data.KF},\r\n");
      out.write("\t\t\t\t\"aftersavefunc\" :null,\r\n");
      out.write("\t\t\t\t\"errorfunc\":null,\r\n");
      out.write("\t\t\t\t\"afterrestorefunc\" :null,\r\n");
      out.write("\t\t\t\t\"restoreAfterError\" : true,\r\n");
      out.write("\t\t\t\t\"mtype\" : \"POST\"\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\r\n");
      out.write("\t\t\tjQuery(\"#jqlist\").jqGrid('editRow', id, editparameters);\r\n");
      out.write("\r\n");
      out.write("\t\t\tlastsel2=id;\r\n");
      out.write("\t  \t}\r\n");
      out.write("\t};\r\n");
      out.write("\r\n");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("    //console.log(jqcf);\r\n");
      out.write("\r\n");
      out.write("    jQuery(\"#jqlist\").jqGrid(jqcf);\r\n");
      out.write("    jQuery(\"#jqlist\").jqGrid(\"navGrid\", \"#jqpager\", {edit:false, add:false, del:false, search:false});\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t/*navButton*/\r\n");
      out.write("\t");
 if(web.getButtonNav() != null) { 
      out.write("\r\n");
      out.write("\t\tconsole.log('has getButtonNav : ");
      out.print( web.getButtonNav() );
      out.write("' );\r\n");
      out.write("\t\tjQuery(\"#jqlist\").jqGrid('navButtonAdd', '#jqpager', {\r\n");
      out.write("\t\t\tcaption: \"");
      out.print( web.getButtonNav() );
      out.write(" Test\",\r\n");
      out.write("\t\t\tbuttonicon: \"ui-icon-bookmark\",\r\n");
      out.write("\t\t\tonClickButton: navButtonAction,\r\n");
      out.write("\t\t\tposition: \"last\"\r\n");
      out.write("\t\t});\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\tfunction navButtonAction(){\r\n");
      out.write("\t\tconsole.info(\"Reached navButtonAction()\");\r\n");
      out.write("\t}//navButtonAction\r\n");
      out.write("\r\n");
      out.write("\tresizeJqGridWidth('jqlist', 'portletBody', $('.portlet-body').width());\r\n");
      out.write("\r\n");
      out.write("    $('.reload').click(function(){\r\n");
      out.write("        $('#jqlist').trigger('reloadGrid');\r\n");
      out.write("    });\r\n");
      out.write("\r\n");
      out.write("    $('#btSearch').click(function(){\r\n");
      out.write("        var filtername = $(\"#filtername\").val();\r\n");
      out.write("        var filtertype = $(\"#filtertype\").val();\r\n");
      out.write("        var filtervalue = $(\"#filtervalue\").val();\r\n");
      out.write("        var filterand = $(\"#filterand\").is(':checked');\r\n");
      out.write("        var filteror = $(\"#filteror\").is(':checked');\r\n");
      out.write("\r\n");
      out.write("        $.post(\"ajax?fnct=filter\", {filtername: filtername, filtertype: filtertype, filtervalue: filtervalue, filterand: filterand, filteror: filteror}, function(data){\r\n");
      out.write("            $('#jqlist').setGridParam({datatype:'json', page:1}).trigger('reloadGrid');\r\n");
      out.write("        });\r\n");
      out.write("    });\r\n");
      out.write("\r\n");
      out.write("\t$('#btnAction').click(function(){\r\n");
      out.write("\t    var operation = $(\"#operation\").val();\r\n");
      out.write("\r\n");
      out.write("\t    var $grid = $(\"#jqlist\"), selIds = $grid.jqGrid(\"getGridParam\", \"selarrrow\"), i, n, cellValues = [];\r\n");
      out.write("\t    for (i = 0, n = selIds.length; i < n; i++) {\r\n");
      out.write("\t        var coldata = $grid.jqGrid(\"getCell\", selIds[i], \"KF\");\r\n");
      out.write("\t        cellValues.push(coldata);\r\n");
      out.write("\t    }\r\n");
      out.write("        toastr.options = {\r\n");
      out.write("            \"closeButton\": true,\r\n");
      out.write("            \"debug\": false,\r\n");
      out.write("            \"positionClass\": \"toast-top-right\",\r\n");
      out.write("            \"onclick\": null,\r\n");
      out.write("            \"showDuration\": \"1000\",\r\n");
      out.write("            \"hideDuration\": \"1000\",\r\n");
      out.write("            \"timeOut\": \"5000\",\r\n");
      out.write("            \"extendedTimeOut\": \"1000\",\r\n");
      out.write("            \"showEasing\": \"swing\",\r\n");
      out.write("            \"hideEasing\": \"linear\",\r\n");
      out.write("            \"showMethod\": \"fadeIn\",\r\n");
      out.write("            \"hideMethod\": \"fadeOut\"\r\n");
      out.write("        }\r\n");
      out.write("\t    if(cellValues.join(\",\") == \"\"){\r\n");
      out.write("\t        toastr['info']('No row Selected', \"\");\r\n");
      out.write("\t    } else {\r\n");
      out.write("\t        $.post(\"ajax?fnct=operation&id=\" + operation, {ids: cellValues.join(\",\")}, function(data) {\r\n");
      out.write("\r\n");
      out.write("                if(data.error == true){\r\n");
      out.write("                    toastr['error'](data.msg, \"Error\");\r\n");
      out.write("                }else if(data.error == false){\r\n");
      out.write("                    toastr['success'](data.msg, \"Ok\");\r\n");
      out.write("\r\n");
      out.write("                    if(data.jump != undefined && data.jump == true){\r\n");
      out.write("                        location.replace(\"");
      out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${mainPage}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
      out.write("\");\r\n");
      out.write("                    }else{\r\n");
      out.write("                        $('#jqlist').setGridParam({datatype:'json', page:1}).trigger('reloadGrid');\r\n");
      out.write("                    }\r\n");
      out.write("                }\r\n");
      out.write("\t        }, \"JSON\");\r\n");
      out.write("\t    }\r\n");
      out.write("\t});\r\n");
      out.write("\r\n");
      out.write("    ");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("    $('.detailed-select').change(function(){\r\n");
      out.write("        var $this = $(this);\r\n");
      out.write("        var name = $this.attr('name');\r\n");
      out.write("        $this.attr('id', name);\r\n");
      out.write("        var detail = $('#' + name).find(\":selected\").attr('data-detail');\r\n");
      out.write("\r\n");
      out.write("        if( $('#help_' + name).length == 0){\r\n");
      out.write("            $this.parent().append('<div style=\"color:#4486D8;\" id=\"help_' + name + '\" class=\"help-block has-info\">' + detail + '</div>');\r\n");
      out.write("        }else{\r\n");
      out.write("            $('#help_' + name).html(detail);\r\n");
      out.write("        }\r\n");
      out.write("    });\r\n");
      out.write("\r\n");
      out.write("    // MULTISELECT INITIALIZE\r\n");
      out.write("    $('.multi-select').multiSelect({\r\n");
      out.write("        selectableHeader: \"<input type='text' class='search-input form-control' autocomplete='off' placeholder='Search Address'>\",\r\n");
      out.write("        selectionHeader: \"<input type='text' class='search-input form-control' autocomplete='off' placeholder='Search Address'>\",\r\n");
      out.write("        selectableFooter: \"<div style='text-align: center;padding: 3px;color: #fff;' class='list-group-item bg-blue'>Selectable Items</div>\",\r\n");
      out.write("        selectionFooter: \"<div style='text-align: center;padding: 3px;color: #fff;' class='list-group-item bg-green'>Selected</div>\",\r\n");
      out.write("        afterInit: function(ms){\r\n");
      out.write("        var that = this,\r\n");
      out.write("            $selectableSearch = that.$selectableUl.prev(),\r\n");
      out.write("            $selectionSearch = that.$selectionUl.prev(),\r\n");
      out.write("            selectableSearchString = '#'+that.$container.attr('id')+' .ms-elem-selectable:not(.ms-selected)',\r\n");
      out.write("            selectionSearchString = '#'+that.$container.attr('id')+' .ms-elem-selection.ms-selected';\r\n");
      out.write("\r\n");
      out.write("        that.qs1 = $selectableSearch.quicksearch(selectableSearchString).on('keydown', function(e){\r\n");
      out.write("          if (e.which === 40){\r\n");
      out.write("            that.$selectableUl.focus();\r\n");
      out.write("            return false;\r\n");
      out.write("          }\r\n");
      out.write("        });\r\n");
      out.write("\r\n");
      out.write("        that.qs2 = $selectionSearch.quicksearch(selectionSearchString).on('keydown', function(e){\r\n");
      out.write("          if (e.which == 40){\r\n");
      out.write("            that.$selectionUl.focus();\r\n");
      out.write("            return false;\r\n");
      out.write("          }\r\n");
      out.write("        });\r\n");
      out.write("        },\r\n");
      out.write("        afterSelect: function(){\r\n");
      out.write("            this.qs1.cache();\r\n");
      out.write("            this.qs2.cache();\r\n");
      out.write("        },\r\n");
      out.write("        afterDeselect: function(){\r\n");
      out.write("            this.qs1.cache();\r\n");
      out.write("            this.qs2.cache();\r\n");
      out.write("        }\r\n");
      out.write("    });\r\n");
      out.write("\r\n");
      out.write("    CKEDITOR.config.toolbar = [\r\n");
      out.write("       ['Styles','Format','Font','FontSize'],\r\n");
      out.write("       '/',\r\n");
      out.write("       ['Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'],\r\n");
      out.write("       '/',\r\n");
      out.write("       ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],\r\n");
      out.write("       ['Image','Table','-','Link','Flash','Smiley','TextColor','BGColor','Source']\r\n");
      out.write("    ] ;\r\n");
      out.write("\r\n");
      out.write("</script>\r\n");
      out.write("<script>\r\n");
      out.write("/*jslint unparam: true, regexp: true */\r\n");
      out.write("/*global window, $ */\r\n");
      out.write("$(function () {\r\n");
      out.write("    'use strict';\r\n");
      out.write("\r\n");
      out.write("    $('#fileupload').fileupload({\r\n");
      out.write("        url: 'putbarazafiles',\r\n");
      out.write("        dataType: 'json',\r\n");
      out.write("        autoUpload: true,\r\n");
      out.write("        acceptFileTypes: /(\\.|\\/)(gif|jpeg|jpg|png|doc|docx|rtf|odt|pdf|csv|txt|xls|xlsx)$/i,\r\n");
      out.write("        maxFileSize: 4194304,\r\n");
      out.write("        // Enable image resizing, except for Android and Opera,\r\n");
      out.write("        // which actually support image resizing, but fail to\r\n");
      out.write("        // send Blob objects via XHR requests:\r\n");
      out.write("        disableImageResize: /Android(?!.*Chrome)|Opera/.test(window.navigator.userAgent),\r\n");
      out.write("        previewMaxWidth: 100,\r\n");
      out.write("        previewMaxHeight: 100,\r\n");
      out.write("        previewCrop: true\r\n");
      out.write("    }).on('fileuploadadd', function (e, data) {\r\n");
      out.write("        data.context = $('<div/>').appendTo('#files');\r\n");
      out.write("        $.each(data.files, function (index, file) {\r\n");
      out.write("            var node = $('<p/>').append($('<span/>').text(file.name));\r\n");
      out.write("            if (!index) {\r\n");
      out.write("                node.append('<br>')\r\n");
      out.write("                   // .append(uploadButton.clone(true).data(data));\r\n");
      out.write("            }\r\n");
      out.write("            node.appendTo(data.context);\r\n");
      out.write("        });\r\n");
      out.write("    }).on('fileuploadprocessalways', function (e, data) {\r\n");
      out.write("        var index = data.index,\r\n");
      out.write("            file = data.files[index],\r\n");
      out.write("            node = $(data.context.children()[index]);\r\n");
      out.write("        if (file.preview) {\r\n");
      out.write("            node.prepend('<br>').prepend(file.preview);\r\n");
      out.write("        }\r\n");
      out.write("        if (file.error) {\r\n");
      out.write("            node.append('<br>').append($('<span class=\"text-danger\"/>').text(file.error));\r\n");
      out.write("        }\r\n");
      out.write("        if (index + 1 === data.files.length) {\r\n");
      out.write("            data.context.find('button').text('Upload').prop('disabled', !!data.files.error);\r\n");
      out.write("        }\r\n");
      out.write("    }).on('fileuploadprogressall', function (e, data) {\r\n");
      out.write("        var progress = parseInt(data.loaded / data.total * 100, 10);\r\n");
      out.write("        $('#progress').addClass('active').addClass('progress-striped');\r\n");
      out.write("        $('#progress .progress-bar').css('width', progress + '%');\r\n");
      out.write("    }).on('fileuploaddone', function (e, data) {\r\n");
      out.write("        console.log('BASE 5');\r\n");
      out.write("        console.log(data);\r\n");
      out.write("        console.log(data.result);\r\n");
      out.write("        console.log(data.result.message);\r\n");
      out.write("\r\n");
      out.write("        $('#progress').removeClass('active').removeClass('progress-striped');\r\n");
      out.write("\t\t$('#jqlist').setGridParam({datatype:'json', page:1}).trigger('reloadGrid');\r\n");
      out.write("\t\tvar fileDone = $('<button>').text(data.result.message);\r\n");
      out.write("        $(data.context.children()[0]).append(fileDone).click(function(){\r\n");
      out.write("\t\t\t$.post(\"ajax?fnct=importprocess\", {ids: \"0\"}, function(adata) {\r\n");
      out.write("\r\n");
      out.write("\t\t\t\tif(adata.error == false){\r\n");
      out.write("                    toastr['success'](adata.msg, \"Ok\");\r\n");
      out.write("                     $('#jqlist').setGridParam({datatype:'json', page:1}).trigger('reloadGrid');\r\n");
      out.write("                }\r\n");
      out.write("\t        }, \"JSON\");\r\n");
      out.write("        }).append('<br>');\r\n");
      out.write("\r\n");
      out.write("        $.each(data.result.files, function (index, file) {\r\n");
      out.write("            if (file.url) {\r\n");
      out.write("                var link = $('<a>').attr('target', '_blank').prop('href', file.url);\r\n");
      out.write("                $(data.context.children()[index]).wrap(link);\r\n");
      out.write("            } else if (file.error) {\r\n");
      out.write("                var error = $('<span class=\"text-danger\"/>').text(file.error);\r\n");
      out.write("                $(data.context.children()[index])\r\n");
      out.write("                    .append('<br>')\r\n");
      out.write("                    .append(error);\r\n");
      out.write("            }\r\n");
      out.write("            $('#jqlist').trigger('reloadGrid');\r\n");
      out.write("        });\r\n");
      out.write("    }).on('fileuploadfail', function (e, data) {\r\n");
      out.write("        $.each(data.files, function (index) {\r\n");
      out.write("            var error = $('<span class=\"text-danger\"/>').text('File upload failed.');\r\n");
      out.write("            $(data.context.children()[index])\r\n");
      out.write("                .append('<br>')\r\n");
      out.write("                .append(error);\r\n");
      out.write("        });\r\n");
      out.write("    }).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');\r\n");
      out.write("});\r\n");
      out.write("\r\n");
if(!web.getLicense()) {
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t$('#licenseApply').click(function(){\r\n");
      out.write("\t\tconsole.log('BASE 5 : ');\r\n");
      out.write("\r\n");
      out.write("        var orgName = $(\"#org_name\").val();\r\n");
      out.write("        var sysKey = $(\"#sys_key\").val();\r\n");
      out.write("\r\n");
      out.write("        $.post(\"registerlicense\", {org_name: orgName, sys_key: sysKey}, function(data) {\r\n");
      out.write("            if(data.error == true) {\r\n");
      out.write("                toastr['error'](data.msg, \"Error\");\r\n");
      out.write("            } else if(data.error == false) {\r\n");
      out.write("                toastr['success'](data.msg, \"Ok\");\r\n");
      out.write("            }\r\n");
      out.write("        }, \"JSON\");\r\n");
      out.write("\t});\r\n");
      out.write("\r\n");
 } 
      out.write("\r\n");
      out.write("\r\n");
if(web.hasExpired()) {
      out.write("\r\n");
      out.write("\r\n");
      out.write("\t$('#renewalApply').click(function() {\r\n");
      out.write("\t\t$.post(\"ajax?fnct=renew_product\", function(data) {\r\n");
      out.write("\t\t\tif(data.success == 0) {\r\n");
      out.write("\t\t\t\t$('#ajax').modal('hide');\r\n");
      out.write("\t\t\t} else if(data.success == 1){\r\n");
      out.write("\t\t\t\talert(data.message);\r\n");
      out.write("\t\t\t}\r\n");
      out.write("\r\n");
      out.write("\t\t}, \"JSON\");\r\n");
      out.write("\t});\r\n");
      out.write("\r\n");
 } 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("</script>\r\n");
      out.write("<!-- END JAVASCRIPTS -->\r\n");

	String diaryJSON = "";
	if(web.getViewType().equals("DIARY")) diaryJSON = web.getCalendar();

      out.write('\r');
      out.write('\n');
      out.write("\n");
      out.write("<script>\n");
      out.write("\tvar Calendar = function() {\n");
      out.write("\n");
      out.write("\n");
      out.write("    return {\n");
      out.write("        //main function to initiate the module\n");
      out.write("        init: function() {\n");
      out.write("            Calendar.initCalendar();\n");
      out.write("        },\n");
      out.write("\n");
      out.write("        initCalendar: function() {\n");
      out.write("\n");
      out.write("            if (!jQuery().fullCalendar) {\n");
      out.write("                return;\n");
      out.write("            }\n");
      out.write("\n");
      out.write("            var date = new Date();\n");
      out.write("            var d = date.getDate();\n");
      out.write("            var m = date.getMonth();\n");
      out.write("            var y = date.getFullYear();\n");
      out.write("\n");
      out.write("            var h = {};\n");
      out.write("\n");
      out.write("            if (Metronic.isRTL()) {\n");
      out.write("                if ($('#calendar').parents(\".portlet\").width() <= 720) {\n");
      out.write("                    $('#calendar').addClass(\"mobile\");\n");
      out.write("                    h = {\n");
      out.write("                        right: 'title, prev, next',\n");
      out.write("                        center: '',\n");
      out.write("                        left: 'agendaDay, agendaWeek, month, today'\n");
      out.write("                    };\n");
      out.write("                } else {\n");
      out.write("                    $('#calendar').removeClass(\"mobile\");\n");
      out.write("                    h = {\n");
      out.write("                        right: 'title',\n");
      out.write("                        center: '',\n");
      out.write("                        left: 'agendaDay, agendaWeek, month, today, prev,next'\n");
      out.write("                    };\n");
      out.write("                }\n");
      out.write("            } else {\n");
      out.write("                if ($('#calendar').parents(\".portlet\").width() <= 720) {\n");
      out.write("                    $('#calendar').addClass(\"mobile\");\n");
      out.write("                    h = {\n");
      out.write("                        left: 'title, prev, next',\n");
      out.write("                        center: '',\n");
      out.write("                        right: 'today,month,agendaWeek,agendaDay'\n");
      out.write("                    };\n");
      out.write("                } else {\n");
      out.write("                    $('#calendar').removeClass(\"mobile\");\n");
      out.write("                    h = {\n");
      out.write("                        left: 'title',\n");
      out.write("                        center: '',\n");
      out.write("                        right: 'prev,next,today,month,agendaWeek,agendaDay'\n");
      out.write("                    };\n");
      out.write("                }\n");
      out.write("            }\n");
      out.write("\n");
      out.write("            var initDrag = function(el) {\n");
      out.write("                // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)\n");
      out.write("                // it doesn't need to have a start or end\n");
      out.write("                var eventObject = {\n");
      out.write("                    title: $.trim(el.text()) // use the element's text as the event title\n");
      out.write("                };\n");
      out.write("                // store the Event Object in the DOM element so we can get to it later\n");
      out.write("                el.data('eventObject', eventObject);\n");
      out.write("                // make the event draggable using jQuery UI\n");
      out.write("                el.draggable({\n");
      out.write("                    zIndex: 999,\n");
      out.write("                    revert: true, // will cause the event to go back to its\n");
      out.write("                    revertDuration: 0 //  original position after the drag\n");
      out.write("                });\n");
      out.write("            };\n");
      out.write("\n");
      out.write("            var addEvent = function(title) {\n");
      out.write("                title = title.length === 0 ? \"Untitled Event\" : title;\n");
      out.write("                var html = $('<div class=\"external-event label label-default\">' + title + '</div>');\n");
      out.write("                jQuery('#event_box').append(html);\n");
      out.write("                initDrag(html);\n");
      out.write("            };\n");
      out.write("\n");
      out.write("\n");
      out.write("            $('#calendar').fullCalendar('destroy'); // destroy the calendar\n");
      out.write("            $('#calendar').fullCalendar({ //re-initialize the calendar\n");
      out.write("                header: h,\n");
      out.write("                defaultView: 'month', // change default view with available options from http://arshaw.com/fullcalendar/docs/views/Available_Views/ \n");
      out.write("                slotMinutes: 15,\n");
      out.write("                editable: false,\n");
      out.write("                droppable: false, // this allows things to be dropped onto the calendar !!!\n");
      out.write("                drop: function(date, allDay) { // this function is called when something is dropped\n");
      out.write("\n");
      out.write("                    // retrieve the dropped element's stored Event Object\n");
      out.write("                    var originalEventObject = $(this).data('eventObject');\n");
      out.write("                    // we need to copy it, so that multiple events don't have a reference to the same object\n");
      out.write("                    var copiedEventObject = $.extend({}, originalEventObject);\n");
      out.write("\n");
      out.write("                    // assign it the date that was reported\n");
      out.write("                    copiedEventObject.start = date;\n");
      out.write("                    copiedEventObject.allDay = allDay;\n");
      out.write("                    copiedEventObject.className = $(this).attr(\"data-class\");\n");
      out.write("\n");
      out.write("                    // render the event on the calendar\n");
      out.write("                    // the last `true` argument determines if the event \"sticks\" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)\n");
      out.write("                    $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);\n");
      out.write("\n");
      out.write("                    // is the \"remove after drop\" checkbox checked?\n");
      out.write("                    if ($('#drop-remove').is(':checked')) {\n");
      out.write("                        // if so, remove the element from the \"Draggable Events\" list\n");
      out.write("                        $(this).remove();\n");
      out.write("                    }\n");
      out.write("                },\n");
      out.write("\t\t\t\t\n");
      out.write("\t\t\t\t");
      out.print(diaryJSON );
      out.write("\n");
      out.write("\n");
      out.write("            });\n");
      out.write("\n");
      out.write("        }\n");
      out.write("\n");
      out.write("    };\n");
      out.write("\n");
      out.write("}();\n");
      out.write("</script>\n");
      out.write("\r\n");
      out.write("\r\n");
 if(web.hasPasswordChange()) { 
      out.write('\r');
      out.write('\n');
      out.write('	');
      out.write("\n");
      out.write("    <div class=\"modal fade\" id=\"basic\" tabindex=\"-1\" role=\"basic\" aria-hidden=\"true\">\n");
      out.write("        <div class=\"modal-dialog\">\n");
      out.write("            <div class=\"modal-content\">\n");
      out.write("                <div class=\"modal-header\">\n");
      out.write("                    <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\"></button>\n");
      out.write("                    <h4 class=\"modal-title\"><i class=\"fa fa-unlock-alt\" style=\"color:#3598dc; font-size:24px\"></i> Change Password</h4>\n");
      out.write("                </div>\n");
      out.write("                <form class=\"form-horizontal\" action=\"#\">\n");
      out.write("                <div class=\"modal-body\">\n");
      out.write("                    <div id=\"pass_alert_div\"></div>\n");
      out.write("                   \n");
      out.write("                    <div class=\"form-group\">\n");
      out.write("                        <label class=\" col-md-3 control-label\" for=\"txtOldPassword\">Current Password</label>\n");
      out.write("                        <div class=\"col-md-7\">\n");
      out.write("                            <input type=\"password\" class=\"form-control\" id=\"txtOldPassword\" name=\"txtOldPassword\" required/>\n");
      out.write("                        </div>\n");
      out.write("                    </div>\n");
      out.write("                    \n");
      out.write("                    <div class=\"form-group\">\n");
      out.write("                        <label class=\" col-md-3 control-label\" for=\"txtNewPassword\">New Password</label>\n");
      out.write("                        <div class=\"col-md-7\">\n");
      out.write("                            <input type=\"password\" class=\"form-control\" id=\"txtNewPassword\" name=\"txtNewPassword\" required/>\n");
      out.write("                        </div>\n");
      out.write("                    </div>\n");
      out.write("                    \n");
      out.write("                    <div class=\"form-group\">\n");
      out.write("                        <label class=\" col-md-3 control-label\" for=\"txtConfirmNew\">Confirm Password</label>\n");
      out.write("                        <div class=\"col-md-7\">\n");
      out.write("                            <input type=\"password\" class=\"form-control\" id=\"txtConfirmNew\" name=\"txtConfirmNew\" required/>\n");
      out.write("                        </div>\n");
      out.write("                    </div>\n");
      out.write("                    \n");
      out.write("                </div>\n");
      out.write("                <div class=\"modal-footer\">\n");
      out.write("                    <button type=\"button\" class=\"btn default\" data-dismiss=\"modal\">Close</button>\n");
      out.write("                    <button type=\"button\" class=\"btn green-haze\" id=\"btnChangePass\">Change Password</button>\n");
      out.write("                </div>\n");
      out.write("                </form>\n");
      out.write("            </div>\n");
      out.write("            <!-- /.modal-content -->\n");
      out.write("        </div>\n");
      out.write("        <!-- /.modal-dialog -->\n");
      out.write("    </div>\n");
      out.write("\n");
      out.write("\n");
      out.write("<script type=\"text/javascript\">\n");
      out.write("$('#btnChangePass').click(function(){\n");
      out.write("    var oldpass = $.trim($('#txtOldPassword').val());\n");
      out.write("    var newpass = $.trim($('#txtNewPassword').val());\n");
      out.write("    var confirm = $.trim($('#txtConfirmNew').val());\n");
      out.write("    var ok = true;\n");
      out.write("    \n");
      out.write("    if(oldpass === '' || oldpass == null){\n");
      out.write("        runAlert('Enter Current password', 'danger', 'warning'); ok = false;  $('#txtOldPassword').focus(); return false;\n");
      out.write("    }\n");
      out.write("    \n");
      out.write("    if(newpass === '' || newpass == null){\n");
      out.write("        runAlert('Enter New password', 'danger', 'warning'); ok = false; $('#txtNewPassword').focus(); return false;\n");
      out.write("    }\n");
      out.write("    \n");
      out.write("    if(newpass.length < 5){\n");
      out.write("        runAlert('New Password is too short (Min 5)', 'danger', 'warning'); ok = false; $('#txtNewPassword').focus(); return false;\n");
      out.write("    }\n");
      out.write("    \n");
      out.write("    if(newpass != confirm){\n");
      out.write("        runAlert('Your New Passwords Don\\'t Match', 'danger', 'warning'); ok = false; $('#txtConfirmNew').focus(); return false;\n");
      out.write("    }\n");
      out.write("    \n");
      out.write("    if(ok){\n");
      out.write("        runAlert('Please Wait', 'info', 'info');\n");
      out.write("        $.post('ajax', {fnct:'password', oldpass:oldpass, newpass:newpass}, function(data){\n");
      out.write("            if(data.success == 1){\n");
      out.write("                runAlert(data.message, 'success', 'info');\n");
      out.write("            }else if(data.success == 0){\n");
      out.write("                runAlert(data.message, 'danger', 'warning');   \n");
      out.write("            }\n");
      out.write("            $('#txtOldPassword,#txtNewPassword, #txtConfirmNew').val('');\n");
      out.write("        },'JSON');\n");
      out.write("    }else{\n");
      out.write("        runAlert('Your Request Could not be completed', 'danger', 'warning'); ok = false; $('#txtConfirmNew').focus(); return false;\n");
      out.write("        \n");
      out.write("    }\n");
      out.write("});\n");
      out.write("    \n");
      out.write("\n");
      out.write("function runAlert(msg, type, icon){\n");
      out.write("    Metronic.alert({\n");
      out.write("                container: '#pass_alert_div', // alerts parent container(by default placed after the page breadcrumbs)\n");
      out.write("                place: 'append', // append or prepent in container \n");
      out.write("                type: type,  // alert's type\n");
      out.write("                message: msg,  // alert's message\n");
      out.write("                close: true, // make alert closable\n");
      out.write("                reset: true, // close all previouse alerts first\n");
      out.write("                focus: false, // auto scroll to the alert after shown\n");
      out.write("                closeInSeconds: 0, // auto close after defined seconds\n");
      out.write("                icon: icon // put icon before the message\n");
      out.write("            });\n");
      out.write("}\n");
      out.write("\n");
      out.write("</script>\n");
      out.write("\n");
      out.write("\n");
      out.write('\r');
      out.write('\n');
 } 
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("<!-- END BODY -->\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
 	web.close(); 
      out.write('\r');
      out.write('\n');
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }

  private boolean _jspx_meth_c_005fset_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  c:set
    org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_005fset_005f0 = (org.apache.taglibs.standard.tag.rt.core.SetTag) _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
    boolean _jspx_th_c_005fset_005f0_reused = false;
    try {
      _jspx_th_c_005fset_005f0.setPageContext(_jspx_page_context);
      _jspx_th_c_005fset_005f0.setParent(null);
      // /subscription.jsp(3,0) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
      _jspx_th_c_005fset_005f0.setVar("contextPath");
      // /subscription.jsp(3,0) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
      _jspx_th_c_005fset_005f0.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
      int _jspx_eval_c_005fset_005f0 = _jspx_th_c_005fset_005f0.doStartTag();
      if (_jspx_th_c_005fset_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
      _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fnobody.reuse(_jspx_th_c_005fset_005f0);
      _jspx_th_c_005fset_005f0_reused = true;
    } finally {
      org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_c_005fset_005f0, _jsp_getInstanceManager(), _jspx_th_c_005fset_005f0_reused);
    }
    return false;
  }

  private boolean _jspx_meth_c_005fset_005f1(javax.servlet.jsp.PageContext _jspx_page_context)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  c:set
    org.apache.taglibs.standard.tag.rt.core.SetTag _jspx_th_c_005fset_005f1 = (org.apache.taglibs.standard.tag.rt.core.SetTag) _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fscope_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.SetTag.class);
    boolean _jspx_th_c_005fset_005f1_reused = false;
    try {
      _jspx_th_c_005fset_005f1.setPageContext(_jspx_page_context);
      _jspx_th_c_005fset_005f1.setParent(null);
      // /subscription.jsp(4,0) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
      _jspx_th_c_005fset_005f1.setVar("mainPage");
      // /subscription.jsp(4,0) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
      _jspx_th_c_005fset_005f1.setValue("subscription.jsp");
      // /subscription.jsp(4,0) name = scope type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
      _jspx_th_c_005fset_005f1.setScope("page");
      int _jspx_eval_c_005fset_005f1 = _jspx_th_c_005fset_005f1.doStartTag();
      if (_jspx_th_c_005fset_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
      _005fjspx_005ftagPool_005fc_005fset_0026_005fvar_005fvalue_005fscope_005fnobody.reuse(_jspx_th_c_005fset_005f1);
      _jspx_th_c_005fset_005f1_reused = true;
    } finally {
      org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_c_005fset_005f1, _jsp_getInstanceManager(), _jspx_th_c_005fset_005f1_reused);
    }
    return false;
  }
}
