<% jagg.template("page/base", function(inputs, outputs, jagg) { %>
<!DOCTYPE html>
<html lang="en">
<%
var i18n = require("i18n");
var localeResourcesBasePath="/site/conf/locales/jaggery/";

var encode = require('encode');
encode = new encode.Encode();

var tenantDomain = encode.forUriComponent(request.getParameter("tenant"));
var urlPrefix;
var urlPostfix;
if(tenantDomain != null && tenantDomain != 'null'){
   urlPrefix="?tenant="+tenantDomain;
   urlPostfix="&tenant="+tenantDomain;
}else{
   urlPrefix='';
   urlPostfix='';
}
i18n.init(request,localeResourcesBasePath);
%>
<head>
    <%
    var partWithContext = request.getRequestURL().split(
                                request.getRequestURI()
                              )[0]+request.getContextPath();

    %>
    <script>
        var requestURL = '<%=partWithContext%>';
        var ssoEnabled = '<%=site.ssoConfiguration.enabled%>';
        var tenantDomain = '<%=tenantDomain%>';
    </script>
    <title><%=outputs.title%></title>
    <meta charset="UTF-8">
    <meta name="description" content=""/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <link href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/css/bootstrap.css"))%>" rel="stylesheet">
    <link href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/css/bootstrap-responsive.css"))%>" rel="stylesheet">

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("images/favicon.png"))%>">
    <link rel="apple-touch-icon" href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("images/apple-touch-icon.png"))%>">
    <link rel="apple-touch-icon" sizes="72x72" href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("images/apple-touch-icon-72x72.png"))%>">
    <link rel="apple-touch-icon" sizes="114x114" href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("images/apple-touch-icon-114x114.png"))%>">

    <!--Loca styles-->
    <link href="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("css/localstyles.css"))%>" rel="stylesheet">
    <!--[if IE 8]><link rel="stylesheet" type="text/css" href="<%=jagg.getAbsoluteUrl("/site/themes/default/css/style-ie8.css")%>" media="all"/><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" type="text/css" href="<%=jagg.getAbsoluteUrl("/site/themes/default/css/style-ie7.css")%>" media="all"/><![endif]-->

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]><script src="<%=jagg.getAbsoluteUrl("/site/themes/default/lib/html5/html5.js")%>"></script><![endif]-->
    <script src="<%=jagg.getAbsoluteUrl("/site/themes/default/lib/i18n/i18next-1.5.9.js")%>"></script>

    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/jquery-1.7.1.min.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/modernizr.custom.js"))%>"></script>
    <script type="text/javascript">
    if(!Modernizr.mq('only all')){
        var resize_middle = function(){
            var doc_w  = $( document ).width();
            var left_w = $('#left').width();
            var middle_w = doc_w - left_w - 100;
            $('#middle').width(middle_w);
        };
        $(document).ready(function(){
            resize_middle();
            $(window).resize(function(){
                resize_middle();
            });
        });

    }
    </script>
    <%
    var data = jagg.data();
    if(data.header) {
        jagg.printData(data.header.js);
        jagg.printData(data.header.css);
        jagg.printData(data.header.code);
    }
    %>
</head>
<%var reqUrl = request.getRequestURI();
var provider = encode.forJavaScript(request.getParameter("provider"));
var name = encode.forJavaScript(request.getParameter("apiName"));
var version = encode.forJavaScript(request.getParameter("version"))
var docName = encode.forJavaScript(request.getParameter("docName"));
var inlineUrl="inline";
var jsonUrl="json";
var addUrl="add";
var editUrl="info";
%>
<body <% if(reqUrl.indexOf(inlineUrl)>=0 || reqUrl.indexOf(jsonUrl)>=0){%> onload="loadDefaultTinyMCEContent('<%=provider%>','<%=name%>','<%=version%>','<%=docName%>')"<%}%>
<% if(reqUrl.indexOf(addUrl)>=0 || reqUrl.indexOf(editUrl)>=0){%> onload="loadTiers()"<%}%>
>
    <div id="wrap">
        <div class="container-fluid header">
          <div class="row-fluid">
              <div class="span6"></div>
              <div class="span6 top-menu"></div>
          </div>
        </div>

        <div class="clearfix"></div>
        <div id="header"><% jagg.includeBlocks(outputs.header); %></div>
        <div id="body"><% jagg.includeBlocks(outputs.body); %></div>
        <div id="push"></div>
    </div>
    <div id="footer"><% jagg.includeBlocks(outputs.footer); %></div>
    <% jagg.includeBlock("dialogs", null); %>
    <%
    if(data.footer) {
        jagg.printData(data.footer.js);
        jagg.printData(data.footer.css);
        jagg.printData(data.footer.code);
    }
    %>
    <script>
        var siteRoot = '<%=jagg.getAbsoluteUrl("/site/themes/"+jagg.getUserTheme().base)%>';
    </script>


    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/jquery.cookie.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/jquery.validate.min.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/jquery.form.js"))%>"></script>

    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-transition.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-transition.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-alert.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-modal.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-dropdown.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-scrollspy.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-tab.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-tooltip.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-popover.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-button.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-collapse.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-carousel.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-typeahead.js"))%>"></script>
    <script type="text/javascript" src="<%=jagg.getAbsoluteUrl(jagg.getThemeFile("lib/bootstrap/js/bootstrap-affix.js"))%>"></script>
</body>
</html>
<% }); %>