<if condition="$show['openclose']">
<fieldset class="fieldset" style="margin:$stylevar[formspacer]px 0px 0px 0px">
<legend>$vbphrase[viper_opencloseqr_thread_management]</legend>
<div style="padding:3px">
<div>
<label for="cb_openclose"><input type="checkbox" name="openclose" value="1" id="cb_openclose" tabindex="1" /><span id="qr_openclosestatus"><if condition="$show['closethread']">$vbphrase[viper_opencloseqr_close_thread]<else />$vbphrase[viper_opencloseqr_open_thread]</if></span></label>
</div>
</div>
</fieldset>
<script type="text/javascript">
/* <![CDATA[ */
// Current thread status recorder
var viperThreadOpen = <if condition="$show['closethread']">true<else />false</if>;
// Run the custom function when the quick reply form is submitted
YAHOO.util.Event.addListener(document.getElementById("qrform"), "submit", viperQuikyReply);
// Do some stuff when the form is submitted
function viperQuikyReply() {
var viperOpenCloseCheckbox = document.getElementById("cb_openclose");
var viperQRTextareaChars = document.getElementById("vB_Editor_QR_textarea").value.length;
var viperReplyButtonIMG;
// If the checkbox wasn't checked or the message was too short (simple check), abort
if ( viperOpenCloseCheckbox.checked == false || viperQRTextareaChars == 0 || viperQRTextareaChars < $vboptions[postminchars] ) return;
// Uncheck the checkbox
viperOpenCloseCheckbox.checked = false;
// Change the text and set the reply button image filename
if ( viperThreadOpen == true ) {
document.getElementById("qr_openclosestatus").innerHTML = "$vbphrase[viper_opencloseqr_open_thread]";
viperReplyButtonIMG = "threadclosed.gif";
viperThreadOpen = false;
} else {
document.getElementById("qr_openclosestatus").innerHTML = "$vbphrase[viper_opencloseqr_close_thread]";
viperReplyButtonIMG = "reply.gif";
viperThreadOpen = true;
}
// Get all reply buttons via the new class
var replybuttons = YAHOO.util.Dom.getElementsByClassName("replybutton", "img");
// Loop through each reply button and change it's image URL
var i;
for (i in replybuttons) {
replybuttons[i].src = "$stylevar[imgdir_button]/" + viperReplyButtonIMG;
}
}
/* ]]> */
</script>
</if>