<?php

/**
 *
 * @copyright  2010-2013 izend.org
 * @version    6
 * @link       http://www.izend.org
 */
?>
<div class="bbcodebar">
<span class="btn_edit btn_p" title="p" onclick="tagcomment('[p]','[/p]')">[p]</span>
<span class="btn_edit btn_b" title="b" onclick="tagcomment('[b]','[/b]')">[b]</span>
<span class="btn_edit btn_i" title="i" onclick="tagcomment('[i]','[/i]')">[i]</span>
<span class="btn_edit btn_u" title="u" onclick="tagcomment('[u]','[/u]')">[u]</span>
<span class="btn_edit btn_s" title="s" onclick="tagcomment('[s]','[/s]')">[s]</span>
<span class="btn_edit btn_quote" title="quote" onclick="tagcomment('[quote]','[/quote]')">[quote]</span>
<span class="btn_edit btn_pre" title="pre" onclick="tagcomment('[pre]','[/pre]')">[pre]</span>
<span class="btn_edit btn_br" title="br" onclick="tagcomment('','[br]')">[br]</span>
<span class="btn_edit btn_php" title="code" onclick="tagcomment('[code]','[/code]')">[code]</span>
<span class="btn_edit btn_url" title="url" onclick="tagcomment('[url]','[/url]')">[url]</span>
<span class="btn_edit btn_email" title="email" onclick="tagcomment('[email]','[/email]')">[email]</span>
<span class="btn_edit btn_stripbbcodes" title="Texte brut" onclick="stripcomment()">strip</span>
<span class="btn_edit btn_help" title="Aide" onclick="togglehelp()">aide</span>
<span id="comment_limiter" class="bbcodebar_limiter"><?php echo $message_maxlen; ?></span>
</div>
<textarea id="comment_message" name="comment_message" cols="80" rows="10" title="Texte" onkeyup="return inputlimit('comment_message', 'comment_limiter', <?php echo $message_maxlen; ?>)"><?php echo htmlspecialchars($message, ENT_COMPAT, 'UTF-8'); ?></textarea>
<br/><span class="grippie btn_edit btn_grippie">===</span>
<p id="comment_help" class="bbcodehelp">
Entrez un maximum de <b><?php echo $message_maxlen; ?></b> caractères.<br />
Améliorez la présentation de votre texte avec les balises de formatage suivantes&nbsp;:<br />
[<b>p</b>]paragraphe[/p], [<b>b</b>]<b>gras</b>[/b], [<b>i</b>]<i>italique</i>[/i], [<b>u</b>]<u>souligné</u>[/u], [<b>s</b>]<s>barré</s>[/s],
[<b>quote</b>]citation[/quote], [<b>pre</b>]tel quel[/pre], [<b>br</b>]à la ligne,<br />
[<b>url</b>]http://www.izend.org[/url], [<b>url</b>=http://www.izend.org]site[/url],
[<b>email</b>]izend@izend.org[/email], [<b>email</b>=izend@izend.org]izend[/email],<br />
[<b>code</b>]commande[/code], [<b>code</b>=langage]code source en c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].
</p>
<script type="text/javascript">
function tagcomment(open, close) {
	addtag('comment_message', open, close);
	inputlimit('comment_message', 'comment_limiter', <?php echo $message_maxlen; ?>);
}
function stripcomment() {
	stripbbcodes('comment_message');
	inputlimit('comment_message', 'comment_limiter', <?php echo $message_maxlen; ?>);
}
inputlimit('comment_message', 'comment_limiter', <?php echo $message_maxlen; ?>);
</script>
<?php head('javascript', 'jquery.cookie'); ?>
<script type="text/javascript">
function togglehelp() {
	$('#comment_help').toggle();
	$.cookie('nocommenthelp', $('#comment_help').is(':hidden') ? '1' : '0', { path: '/' });
}
if ($.cookie('nocommenthelp') == '1') {
	$('#comment_help').hide();
}
</script>
<script type="text/javascript">
$(document).ready(function() {
	$('.grippie').each(function() {
		var grippie = $(this);
		var textarea = grippie.prev().prev();
		var offset;

		grippie.mousedown(startDrag);

	    function startDrag(e) {
	      offset = textarea.height() - e.pageY;
	      textarea.css('opacity', 0.25);
	      $(document).mousemove(performDrag).mouseup(endDrag);
	      return false;
	    }

	    function performDrag(e) {
	      textarea.height(Math.max(32, offset + e.pageY) + 'px');
	      return false;
	    }

	    function endDrag(e) {
	      $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag);
	      textarea.css('opacity', 1);
	    }
	});
});
</script>
