<!DOCTYPE html >
<%~set search_widget = 1%>
<%~set poll_widget = 1%>
<html lang="en">
<head>
  <title><%root_post_subject%><%if this_page > 1%> (Page <%this_page%>)<%endif%>: <%forum_name%>: <%cat_full_name%></title>
  <%include include_common_head.html%>
  <%~if this_do eq post_view_printable%>
  <link type="text/css" rel="stylesheet" href="<%static_url%>/css/print.css" />
  <%~endif%>
  <script type="text/javascript">
  //<![CDATA[
  <%if is_ie and ie_version >= 4%>
  <%~-- JavaScript for "Copy Shortcut" (which only works in IE) --~%>
  // IE-specific code to copy a post URL to the clipboard - takes the post_id.
  // This works only in IE because other browsers (quite correctly) treat copy
  // buffer manipulation as a security access violation.
  function postShortcut(post_id) {
    var url = document.createElement('input');
    url.type = 'hidden';
    url.value = '<%set url = GForum::SEO::url(params => "?post=__POST_ID__", anchor => "p__POST_ID__")%><%escape_js url%>';
    url.value = url.value.replace(/__POST_ID__/g, post_id);
    document.body.appendChild(url);
    url.createTextRange().execCommand("Copy");
    alert("Post URL copied to clipboard");
  }
  <%endif%>

  function winopen(url, target) {
    var win;
    try {
      win = window.open(url, target, 'resizable=yes,menubar=yes,scrollbars=yes,width=700,height=500');
      win.focus();
    }
    catch (e) {
      return true;
    }
    return win ? false : true;
  }

  <%~if forum_image_max_x or config.post_image_max_x%>
    GForum.image_max_width = '<%forum_image_max_x || $config.post_image_max_x%>';
  <%~endif%>
  <%~if forum_image_max_y or config.post_image_max_y%>
    GForum.image_max_height = '<%forum_image_max_y || $config.post_image_max_y%>';
  <%~endif%>

  //]]>
  </script>
</head>

<%~set hidden_sort = ''%><%set hidden_page = ''%>
<%~if in.sb%><%set hidden_sort .= ";sb=$sb"%><%endif%>
<%~if in.so%><%set hidden_sort .= ";so=$so"%><%endif%>
<%~if in.mh%><%set hidden_page .= ";mh=$mh"%><%endif%>
<%~if in.page%><%set hidden_page .= ";page=$this_page"%><%endif%>

<body class="page-<%page_id%>">
  <div class="container-b">
    <%include include_header.html%>

    <div class="main">
      <div class="contentwrapper clearfix">
        <div class="sidebar">
          <%include include_sidebar.html%>
        </div>

        <%~set content_header_title = $forum_name%>
        <%~set post_toolbar = 1%>
        <%~init array breadcrumbs%><%init hash breadcrumbs.0%><%init hash breadcrumbs.1%>
        <%~set breadcrumbs.0.name = $forum_name%>
        <%~set breadcrumbs.0.url  = GForum::SEO::url(params => "forum=$forum_id")%>
        <%~set breadcrumbs.1.name = $root_post_subject%>

        <%include include_breadcrumb.html%>
        <div class="content"><%-- start content--%>
          <%include include_content_header.html%>
          
<%~set root_post_id ||= $post_root_id || $post_id%>
<%~set do = ''%>
<%~if in.do%>
  <%~set do = "do=$this_do"%>
<%~endif%>
<%~set pagination_options.type = 'post'%>
<%~set pagination_options.id = $root_post_id%>
<%~set pagination_options.params = "$do$hidden_sort$hidden_page"%>
<%~set pagination_options.page_items = $num_posts%>
<%~set pagination_options.show_view_all = 1%>

          <div class="toolbar-b clearfix">
              <%include include_paging.html%>
              <%include include_quicklaunch.html%>
          </div>

          <%loop post_loop%>
            <%~if is_moderator and post_reports_count%><%set admin_show_post = 1%><%else%><%set admin_show_post = 0%><%endif%>
            <%~if blocked and not admin_show_post and in.post != $post_id%><%set hide_post = 1%><%else%><%set hide_post = 0%><%endif%>

            <%-- Serve ad on mobile --%>
            <%~if row_num == 1%>
              <%~set serve_ad = 1%>
            <%~else%>
              <%~set count += 1%><%set odd = $count % 30%>
              <%-- disabled additional ads - ticket #31747 --%>
              <%~if not $odd%><%set serve_ad = 0%><%endif%>
            <%~endif%>

            <%include include_post_display.html%>
            
          <%endloop%>

          <%include include_post_toolbar.html%>

          <%-- ad for tablet --%> 
          <%~if num_posts > 3%>
          <%include include_ad_tablet.html%>
          <%~endif%>

        </div><%-- end content --%>
      </div><%-- end contentwrapper --%>
    </div><%-- end main --%>

    <%include include_footer.html%>
  </div>
</body>
<%if spellcheck%><%spellcheck_head%><%endif%>
<%include include_global_js.html%>
<script type="text/javascript">
$(document).ready(function () {
    GForum.init_post_only();
    GForum.init_hidden_posts();
    <%~if is_moderator and post_reports_open.length%>
    GForum.openPostReport();
    <%~endif%>

    <%~if this_do eq post_view_printable%>window.print();<%endif%>
});
</script>
</html>
