<script type='text/javascript'>
function ShowPollTable()
{
	if ($("#poll_id").is(":checked"))
	{
		$("#poll_table").fadeIn();
	}
	else
	{
		$("#poll_table").fadeOut();
	}
}
function AddMoreAnswers(x)
{

	x += 1;
	var answers_max = 100;
	$("#poll_answers_count_id").val(x);
	$(".more_tr").hide();
	$("#poll_question_answers").append('<tr align="center"><td class="row1 rows_space">{$lang['answers_number']}' + x + '</td><td class="row1 rows_space"><input name="answer[]" type="text" id="answer' + x + '" /></td></tr>');
	$("#poll_question_answers").append('<tr align="center" class="more_tr"><td class="row1 rows_space" colspan="2"><input type="button" name="more_answers" class="more_answers_class" value="{$lang['more_answers']}" /></td></tr>');

     $("#answer" + x).focus();

 	       $(".more_answers_class").click(function() { AddMoreAnswers(x) });

        if (function() { AddMoreAnswers(x) })
		{
		$(".more_tr").stopPropagation();

		}

}
function ShowTagsTable()
{
	if ($("#tag_id").is(":checked"))
	{
		$("#tags_table").fadeIn();
	}
	else
	{
		$("#tags_table").fadeOut();
	}
}
function AddMoreTags(x)
{
	x += 1;

	$(".more_tag_tr").hide();
	$("#add_tags_table").append('<tr align="center"><td class="row1 rows_space">{$lang['tag']}' + x + '</td><td class="row1 rows_space"><input name="tags[]" type="text" id="tag' + x + '" size="40" /></td></tr>');
	$("#add_tags_table").append('<tr align="center" class="more_tag_tr"><td class="row1 rows_space" colspan="2"><input type="button" name="more_tags" class="more_tags_class" value="{$lang['add_more_tag']}" /></td></tr>');

	$("#tag" + x).focus();

	$(".more_tags_class").click(function() { AddMoreTags(x) });

	        if (function() { AddMoreTags(x) })
		{
		$(".more_tag_tr").stopPropagation();

		}
}
function Ready()
{
	$("#poll_table").hide();
	$("#poll_id").click(ShowPollTable);
	$(".more_answers_class").click(function() { AddMoreAnswers(2) });

	$("#tags_table").hide();
	$("#tag_id").click(ShowTagsTable);
	$(".more_tags_class").click(function() { AddMoreTags(1) });

}
function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename;
var limit_text='<font class="smallfont">{$lang['number_of_characters_remaining']} <span style="font-weight:900;" id="'+theform.toString()+'">'+thelimit+'</span></font>';
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
}
}

$(document).ready(Ready);
</script>

{template}address_bar_part1{/template}
<a href="index.php?page=forum&amp;show=1&amp;id={$id}{$password}">
	{$section_info['title']}
</a>
{$_CONF['info_row']['adress_bar_separate']}
{$lang['add_new_topic']}
{template}address_bar_part2{/template}
{template}preview{/template}

<form name="topic" method="post" enctype="multipart/form-data" action="index.php?page=new_topic&amp;start=1&amp;id={$id}{$password}">

<input name="poll_answers_count" id="poll_answers_count_id" type="hidden" value="2">
<table border="0" width="98%" class="border" cellspacing="1" align="center">
	<tr>
		<td class="tcat" colspan="2">
		{$lang['text_Topic']}
		</td>
	</tr>
	<tr align="center">
		<td class="row1 rows_space" align="right">
		<!-- action_find_addons_1 -->
				{if {$section_info['active_prefix_subject']}}
				{$lang['prefix_subject']}
		               <?php
		    			$excludedWords = array();
						$doubleAr = $PowerBB->_CONF['template']['section_info']['prefix_subject'];
						$doubleAr = str_replace($PowerBB->_CONF['template']['prefix_subject_prev'],'',$doubleAr);
						$prefix_subject = preg_split("#[\n]+#", $doubleAr, -1, PREG_SPLIT_NO_EMPTY);
						$excludedWords = array_merge($excludedWords, $prefix_subject);
						?>
						<select name="prefix_subject" style="font-weight: bold">
						<option value="">{$lang['no_prefix_subject']}</option>
						{if {$prefix_subject_prev} !=''}
						<option value="{$prefix_subject_prev}" selected='selected'>{$prefix_subject_prev}</option>
						{/if}
						<?php
						for ($x = 0; $x < @count($excludedWords); $x++)
						{
						$excludedWords[$x] = @trim($excludedWords[$x]);
						$excludedWords[$x] = "<option value=".$excludedWords[$x].">".$excludedWords[$x]."</option>";

						echo $excludedWords[$x];
						}
						 echo '</select>';
						?>
				{/if}
			{$lang['subject_title']} :
			<input name="title" id="title" type="text" value="{$title_prev}" size="40"
			onKeyDown="textCounter(this,'progressbar1',{$_CONF['info_row']['post_title_max']})"
onKeyUp="textCounter(this,'progressbar1',{$_CONF['info_row']['post_title_max']})"
onFocus="textCounter(this,'progressbar1',{$_CONF['info_row']['post_title_max']})" />
<script>
zextCounter(document.getElementById("title"),"progressbar1",{$_CONF['info_row']['post_title_max']})</script>
<script type='text/javascript'>
displaylimit("title","title",{$_CONF['info_row']['post_title_max']})
</script>
	</td>
		{if {$_CONF['info_row']['subject_describe_show']} == 1}
		<td class="row1 rows_space" align="right">
			{$lang['subject_describe']}:
			<input name="describe" type="text" value="{$describe_prev}" size="40" />
			<font class="smallfont">{$lang['Optional']}</font>
		</td>
		{/if}
	</tr>
	<!-- action_find_addons_2 -->
{if !{$_CONF['member_permission']}}
<tr align="center">
		<td class="row1 rows_space" colspan="2">
		{$lang['Image_Verification']}:&nbsp;&nbsp;
<font size="1">{$lang['Verification']}</font>
<br />
<input name="code" id="code_confirm" type="text" size="7"/>

	&nbsp;&nbsp;<img id="turing" src="includes/captcha.php" width="87" height="17"/>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="updateImg();">{$lang['Image_replacement']}</a>
	<script type='text/javascript'>
//<![CDATA[
     var clicks = 0;

     function updateImg()
     {
      clicks++
     var doc = document.getElementById("turing");
     doc.src = "includes/captcha.php" + "?act=" + clicks;
     }
//]]>
</script>
		</td>
	</tr>
	</tr>
<tr align="center">
		<td class="row1 rows_space" colspan="2">
{$lang['Your_name']} <input name="guest_name" id="guest_name" type="text" size="35"/>
		</td>
	</tr>
	{/if}
	<tr>
		<td class="row1 rows_space" colspan="2">

<div id="none">
	<div align="center">
	<table border="0" cellspacing="0" class="border" width="100%">
	<tr>
		<td class="editortoolbar" valign="top" >
		{template}editor_js{/template}
       <!-- action_find_addons_3 -->
<textarea name="text" id="box_text" style="display:block;" class="editoriframe" tabindex="3" >{$text}
{$prev}</textarea>
<script type='text/javascript'>
//<![CDATA[
    comm._toggle();
    var smiley_wysiwyg = true;
//]]>
</script>

		</td>
		<div style="border-style: solid; border-width: 0px; width:70px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px ; ">
		<td class="editortoolbar" valign="top" align="center">
		<br />
		<br />
		<br />
		<br />
		<br />
		<br />
		<br />

		<table align="center" border="0" cellspacing="1" cellpadding="4" cellspacing="0" >
	<!-- action_find_addons_4 -->
			<tr valign="bottom" align="center">
				<td class="editortoolbar" align="center">
           {template}smilebox{/template}</td>
			</tr>
		</table>
</div></td>
	</tr>
	<tr>
		<td class="editoricon" valign="top" colspan="2">
{template}iconbox{/template}
</td>
	</tr>
	<!-- action_find_addons_5 -->
</table></div>
</div>
		</td>
	</tr>
	<?php if ($PowerBB->_CONF['template']['upload_attach'] and $PowerBB->_CONF['template']['_CONF']['group_info']['upload_attach'] == '1') {  ?>
	<tr>
		<td class="row1" colspan="2" align="center">
		<INPUT name="attach" type="button" value="{$lang['Add_attachments']}"
 onClick="window.open('index.php?page=attachments&amp;add_attach=1&amp;nocheck=1&amp;section={$section_info['id']}','mywindow','scrollbars=yes,width=500,height=600')">
 <br />
		</td>
	</tr>
	{/if}
	<?php if ($PowerBB->_CONF['template']['SectionGroup']['write_poll'] == '1' and $PowerBB->_CONF['template']['_CONF']['group_info']['write_poll'] == '1') {  ?>
		<tr>
		<td class="row1" colspan="2">
			<input name="poll" id="poll_id" type="checkbox" /> <label for="poll_id">{$lang['add_polls']}</a>
		</td>
	</tr>
	{/if}
			<tr>
		<td class="row1" colspan="2">
			<input name="tag" id="tag_id" type="checkbox" /> <label for="tag_id">{$lang['ADD_tags']}</a>
		</td>
	</tr>
	{if {$_CONF['info_row']['allowed_emailed']} == '1' AND {$_CONF['member_permission']}}
	<tr>
		<td class="row1" colspan="2">
			<input name="emailed" id="emailed_id" type="checkbox" /> <label for="emailed_id">{$lang['Enabled_to_be_notified_by_the_existence_of_new_replies']}</a>
		</td>
	</tr>
	{/if}
		<tr>
		<td class="row1" colspan="2" align="center" valign="top">
			                   <input class="button" name="insert" type="submit" value="{$lang['Count']}" onClick="comm._submit();" />
			                   <input class="button" type="submit" value="{$lang['Preview']}" name="preview" onclick="comm._submit();" />
</td>
	</tr>
</table>

<br />

{if {$Admin}}
<table border="0" cellspacing="1" width="98%" class="border" align="center">
	<tr>
		<td class="tcat" colspan="2">
		{$lang['Management_options_subject']}
		</td>
	</tr>
<!-- action_find_addons_6 -->
	<tr>
		<td class="row1" colspan="2">
			<input name="stick" id="stick_id" type="checkbox" /> <label for="stick_id">{$lang['Sticky_Topic']}</label>
			<br />
			<input name="close" id="close_id" type="checkbox" /> <label for="close_id">{$lang['locked_Topic']}</label>
		</td>
	</tr>
</table>
<br />
{/if}

<div id="poll_table">
{template}add_poll_table{/template}
</div>
<div id="tags_table">
{template}add_tags_table{/template}
</div>
<br />
</form>
<br />
<br />
<!-- action_find_addons_7 -->
