var b=2;var i=2;var u=2;var q=2;var c=2;var url=2;var img=2;function mozWrap(h,e,l){var d=h.textLength;var a=h.selectionStart;var f=h.selectionEnd;if(f==1||f==2){f=d}var k=(h.value).substring(0,a);var j=(h.value).substring(a,f);var g=(h.value).substring(f,d);h.value=k+e+j+l+g;return}function insertTag(formID,tagValue){txtarea=eval("document.getElementById('"+formID+"')");if(document.selection){txtarea.focus();sel=document.selection.createRange();sel.text=tagValue}else{if(txtarea.selectionStart||txtarea.selectionStart=="0"){var startPos=txtarea.selectionStart;var endPos=txtarea.selectionEnd;txtarea.value=txtarea.value.substring(0,startPos)+tagValue+txtarea.value.substring(endPos,txtarea.value.length)}else{txtarea.value+=tagValue}}}function tag(d,a,h,f,g,e){txtarea=window.document.getElementById("postArea");if(window.getSelection){sel=(txtarea.value).substring(txtarea.selectionStart,txtarea.selectionEnd);if(sel==null||sel==""){tagNoSel(d,a,h,f,g,e)}else{if(txtarea.selectionEnd&&(txtarea.selectionEnd-txtarea.selectionStart>0)){mozWrap(txtarea,a,f);return}}}else{if(document.selection){select=document.selection.createRange().text;if(select==null||select==""){tagNoSel(d,a,h,f,g,e)}else{document.selection.createRange().text=a+select+f;txtarea.focus();select="";return}}}}function tagNoSel(v,tagadd,newbut,tagclose,oldbut,name){if(eval(v)%2==0){eval("window.document.getElementById('"+name+"').value = '"+newbut+"';");insertTag("postArea",tagadd);txtarea.focus()}else{eval("window.document.getElementById('"+name+"').value = '"+oldbut+"';");insertTag("postArea",tagclose);txtarea.focus()}eval(v+"++;")}function font(a,d){txtarea=document.getElementById("postArea");if(window.getSelection){sel=(txtarea.value).substring(txtarea.selectionStart,txtarea.selectionEnd);if(sel==null||sel==""){txtarea.value+=a+d;txtarea.focus();return}else{if(txtarea.selectionEnd&&(txtarea.selectionEnd-txtarea.selectionStart>0)){mozWrap(txtarea,a,d);return}}}else{if(document.selection){sel=(txtarea.value).substring(txtarea.selectionStart,txtarea.selectionEnd);if(sel==null||sel==""){txtarea.value+=a+d;txtarea.focus();return}else{document.selection.createRange().text=tagadd+select+tagclose;window.document.getElementById("postArea").focus();select="";return}}}}function smilie(a){var f=document.getElementById("postArea");if(document.selection){f.focus();sel=document.selection.createRange();sel.text=a}else{if(f.selectionStart||f.selectionStart=="0"){var e=f.selectionStart;var d=f.selectionEnd;f.value=f.value.substring(0,e)+a+f.value.substring(d,f.value.length)}else{f.value+=a}}f.focus();return}var bold_help="Bold text: [b]text[/b]";var italic_help="Italic text: [i]text[/i]";var underline_help="Underline text: [u]text[/u]";var quote_help="Quote text: [quote]text[/quote] or [quote=name]text[/quote]";var code_help="Code display: [code]code[/code]";var img_help="Insert image: [img]http://image_url[/img]";var url_help="Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]";var fontcolor_help="Font color: [color=red]text[/color]  Tip: you can also use color=#FF0000";var fontsize_help="Font size: [size=50%]small text[/size]";function helpline(a){var d=document.getElementById("helpbox");if(a.match("bold")=="bold"){d.innerHTML="Bold text: [b]text[/b]"}if(a.match("italic")=="italic"){d.innerHTML="Italic text: [i]text[/i]"}if(a.match("underline")=="underline"){d.innerHTML="Underline text: [u]text[/u]"}if(a.match("quote")=="quote"){d.innerHTML="Quote text: [quote]text[/quote] or [quote=name]text[/quote]"}if(a.match("code")=="code"){d.innerHTML="Code display: [code]code[/code]"}if(a.match("img")=="img"){d.innerHTML="Insert image: [img]http://image_url[/img]"}if(a.match("url")=="url"){d.innerHTML="Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]"}if(a.match("fontcolor")=="fontcolor"){d.innerHTML="Font color: [color=red]text[/color]  Tip: you can also use color=#FF0000"}if(a.match("fontsize")=="fontsize"){d.innerHTML="Font size: [size=50%]small text[/size]"}}function confirm_reset(){if(confirm("If you continue you will loose everything you have entered so far. \n \nClick OK to proceed and start again.  \n \n Alternatively click cancel to continue working on your post.")){return true}else{return false}}function checkForm(){var d=document.getElementById("subject");var a=document.getElementById("postArea");if(d.value.length<2&&a.value.length<2){alert("This is a short post! \n \n We require that each post (and subject) \nbe at least 2 characters long. \n \nGo back and try again.");return false}else{if(d.value.length<2){alert("We require that the subject  \nbe at least 2 characters long. \n \nGo back and try again.");return false}else{if(a.value.length<2){alert("We require that each post  \nbe at least 2 characters long. \n \nGo back and try again.");return false}else{return true}}}};