<!DOCTYPE html >
<html lang="en">
<head>
  <title><%site_title%>: <%cat_full_name%>: <%forum_name%>: <%if this_do eq post_reply_write%>Reply to post<%elsif this_do eq post_edit%>Edit post<%else%>Post a new message<%endif%></title>
<%include include_common_head.html%>
</head>

<%~if this_do eq post_reply_write%>
  <%~set content_header_title = 'Reply to post'%>
  <%~set content_header_subtitle = "Replying to <a href=\"#p${parent.post_id}\">${parent.post_subject}</a>"%>
<%~elsif this_do eq post_edit%>
  <%~set content_header_title = 'Edit post'%>
  <%~set content_header_subtitle = "Editing <a href=\"#p$post_id\">${orig.post_subject}</a>"%>
<%~else%>
  <%~set content_header_title = 'Post a New Message'%>
<%~endif%>

<body class="page-<%page_id%>">
  <iframe id="spellcheck_frame" src="<%GForum::SEO::url(params => "do=spellcheck_inline_post;just_load=1")%>" class="hidden"></iframe>
  <div class="container-b">
    <%include include_header.html%>

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

        <%~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 = $content_header_title%>

        <%include include_breadcrumb.html%>

        <div class="content"><%-- start content--%>
          <%include include_content_header.html%>

          <div id="content" class="compose post-compose">

            <%preview || ''%>

            <%~set url_anchor = ""%>
            <%~if current.user_do_after_post eq post_view%>
            <%~set url_anchor = "last"%>
            <%~if $post_id%><%set url_anchor = "p$post_id"%><%endif%>
            <%~endif%>
            <form id="<%set compose_form_id = 'post_write_form'%><%compose_form_id%>" name="post" action="<%GForum::SEO::url(anchor => $url_anchor)%>" method="post" enctype="multipart/form-data" class="form">
              <%hidden_form%>
              <%~if this_do eq post_reply_write%>
              <input type="hidden" id="parent_post_id" name="parent_post_id" value="<%parent_post_id%>" />
              <%~elsif this_do eq post_edit%>
              <input type="hidden" id="post_id" name="post" value="<%post_id%>" />
              <%~else%>
              <input type="hidden" id="forum_id" name="forum" value="<%forum_id%>" />
              <%~endif%>

              <%include include_post_write.html%>

              <div class="btn-wrapper post-actions clearfix">
                <%~if this_do eq post_reply_write%>
                <input type="submit" id="button_post" name="do=post_reply_post" value="Post Reply" class="btn default" tabindex="15" />
                <%~elsif this_do eq post_edit%>
                <input type="submit" id="button_post" name="do=post_edit_post" value="Post Changes" class="btn default" tabindex="15" />
                <%~else%>
                <input type="submit" id="button_post" name="do=post_post" value="Post Message" class="btn default" tabindex="15" />
                <%~endif%>
              </div>
            </form>

            <div class="clearall"></div>
            <%~if this_do eq post_reply_write%>
            <%~parent%><%-- Loads the parents post tags --%>
            <%~set preview = 0%><%set reply_view = 1%><%set hide_post_menu = 1%>
            <%include include_post_display.html%>
            <%~elsif this_do eq post_edit%>
            <%~orig%><%-- Loads the original post tags --%>
            <%~set preview = 0%><%set orig_view = 1%><%set hide_post_menu = 1%>
            <%include include_post_display.html%>
            <%~endif%>

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

        </div>

      </div>
    </div>

    <%include include_footer.html%>
  </div>
</body>
<%~include include_global_js.html%>

<%include include_global_js.html%>
<script type="text/javascript">
    $(document).ready(function() {
        GForum.init_tags();
    });
</script>
</html>
