<?php echo Wo_LoadPage('forum/headers/header'); ?>
<div class="row" id="threadreply">
	<label class="col-md-2"></label>
	<div class="col-md-8">
		<div class="wow_content mt-0">
			<div class="wo_page_hdng pag_neg_padd pag_alone">
				<div class="wo_page_hdng_innr">
					<span><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" d="M10,9V5L3,12L10,19V14.9C15,14.9 18.5,16.5 21,20C20,15 17,10 10,9Z"></path></svg></span> <?php echo $wo['lang']['reply'];?> > <?php echo $wo['thread']['headline']; ?>
				</div>
			</div>
		</div>

		<div class="page-margin wow_content wow_sett_content">
			<form action="#" class="form" id="newtopicreply" method="post">
				<div id="newtopicreply-alert"></div>
				<div class="wow_form_fields">
					<label for="subject"><?php echo $wo['lang']['subject']; ?></label>
					<input type="text" name="subject" id="subject" value="<?php echo($wo['thread']['headline']); ?>">
				</div>
				<div class="wow_form_fields">
					<label for="replythread"><?php echo $wo['lang']['your_reply']; ?></label>
					<textarea id="replythread" name="content"></textarea>
				</div>
				<div class="text-center">
					<button class="btn btn-main btn-mat btn-mat-raised add_wow_loader" id="forum-search-btn" type="submit"><?php echo $wo['lang']['reply']; ?></button>
				</div>
			</form>
		</div>
		<div class="clear"></div>
	</div>
	<label class="col-md-2"></label>
</div>


<?php if (isset($wo['bbcodeditor']) && $wo['bbcodeditor']): ?>

<script>
	jQuery(document).ready(function($) {

		$('#newtopicreply').ajaxForm({

	      url: Wo_Ajax_Requests_File()  +  '?f=threadreply&tid=<?php echo $wo['thread']['id']; ?>&fid=<?php echo $wo['thread']['forum']; ?>&q=0&hash=' + $('.main_session').val(),
	      dataType:'json',
	      beforeSend: function() {
	        Wo_progressIconLoader($('#newtopicreply').find('button'));
	      },
	      success: function(data) {
	        scrollToTop();
	        if (data['status'] == 200) {
	        	
	         	$("#newtopicreply-alert").html('<div class="alert alert-success">'+ data['message'] +'</div>');
	         	window.location = data.url;
	          
	        } else {
	        	
	         	$("#newtopicreply-alert").html('<div class="alert alert-danger">' + data['message'] + '</div>');
	        } 
	        Wo_progressIconLoader($('#newtopicreply').find('button'));
	      }
		});
		
		$('#replythread').bbcode();
		$("#replythread").autogrow({vertical: true, horizontal: false});
	});
</script>
	
<?php endif ?>

<?php echo Wo_LoadPage('forum/headers/footer'); ?>