function confirmClick(messsage)
{var agree=confirm(messsage);if(agree)
return true;else
return false;}
function getStyleObject(objectId)
{if(document.getElementById&&document.getElementById(objectId))
{return document.getElementById(objectId).style;}
else if(document.all&&document.all(objectId))
{return document.all(objectId).style;}
else if(document.layers&&document.layers[objectId])
{return document.layers[objectId];}
else
{return false;}}
function getObject(objectId)
{if(document.getElementById)
{return document.getElementById(objectId);}
else if(document.all)
{return document.all[objectId];}
else if(document.layers)
{return document.layers[objectId];}
else
{return false;}}
function changeObjectVisibility(objectId,newVisibility)
{var styleObject=getStyleObject(objectId);if(styleObject)
{styleObject.display=newVisibility;return true;}
else
{return false;}}
function changediv(text,id)
{if(document.getElementById)
{x=document.getElementById(id);x.innerHTML='';x.innerHTML=text;}
else if(document.all)
{x=document.all[id];x.innerHTML=text;}
else if(document.layers)
{x=document.layers[id];text2='<P CLASS="testclass">'+text+'<'+'/P>';x.document.open();x.document.write(text2);x.document.close();}}
var imageTag=false;var theSelection=false;var clientPC=navigator.userAgent.toLowerCase();var clientVer=parseInt(navigator.appVersion);var is_ie=((clientPC.indexOf("msie")!=-1)&&(clientPC.indexOf("opera")==-1));var is_nav=((clientPC.indexOf('mozilla')!=-1)&&(clientPC.indexOf('spoofer')==-1)&&(clientPC.indexOf('compatible')==-1)&&(clientPC.indexOf('opera')==-1)&&(clientPC.indexOf('webtv')==-1)&&(clientPC.indexOf('hotjava')==-1));var is_moz=0;var is_win=((clientPC.indexOf("win")!=-1)||(clientPC.indexOf("16bit")!=-1));var is_mac=(clientPC.indexOf("mac")!=-1);if(is_mac)
{b_help="Bold text: [b]text[/b]  (ctrl+b)";i_help="Italic text: [i]text[/i]  (ctrl+i)";u_help="Underline text: [u]text[/u]  (ctrl+u)";q_help="Quote text: [quote]text[/quote]  (ctrl+q)";c_help="Code display: [code]code[/code]  (ctrl+c)";l_help="List: [list]text[/list] (ctrl+l)";o_help="Ordered list: [list=]text[/list]  (ctrl+o)";p_help="Insert image: [img]http://image_url[/img]  (ctrl+p)";w_help="Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]  (ctrl+w)";a_help="Close all open bbCode tags";s_help="Font color: [color=red]text[/color]  Tip: you can also use color=#FF0000";f_help="Font size: [size=x-small]small text[/size]";}
else
{b_help="Bold text: [b]text[/b]  (alt+b)";i_help="Italic text: [i]text[/i]  (alt+i)";u_help="Underline text: [u]text[/u]  (alt+u)";q_help="Quote text: [quote]text[/quote]  (alt+q)";c_help="Code display: [code]code[/code]  (alt+c)";l_help="List: [list]text[/list] (alt+l)";o_help="Ordered list: [list=]text[/list]  (alt+o)";p_help="Insert image: [img]http://image_url[/img]  (alt+p)";w_help="Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]  (alt+w)";a_help="Close all open bbCode tags";s_help="Font color: [color=red]text[/color]  Tip: you can also use color=#FF0000";f_help="Font size: [size=x-small]small text[/size]";}
bbcode=new Array();bbtags=new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[card]','[/card]','[design]','[/design]','[center]','[/center]','[left]','[/left]','[right]','[/right]');imageTag=false;function helpline(help)
{var helpbox=false;helpbox=getObject('helpbox');if(helpbox!=false)
{try
{helpbox.value=eval(help+"_help");}
catch(err)
{}}}
function getarraysize(thearray){for(i=0;i<thearray.length;i++){if((thearray[i]=="undefined")||(thearray[i]=="")||(thearray[i]==null))
return i;}
return thearray.length;}
function arraypush(thearray,value){thearray[getarraysize(thearray)]=value;}
function arraypop(thearray){thearraysize=getarraysize(thearray);retval=thearray[thearraysize-1];delete thearray[thearraysize-1];return retval;}
function checkForm(){formErrors=false;if(getMessage().value.length<2){formErrors="You must enter a message when posting.";}
if(formErrors){alert(formErrors);return false;}else{bbstyle(-1);return true;}}
function emoticon(text){var txtarea=getMessage();text=' '+text+' ';if(txtarea.createTextRange&&txtarea.caretPos){var caretPos=txtarea.caretPos;caretPos.text=caretPos.text.charAt(caretPos.text.length-1)==' '?caretPos.text+text+' ':caretPos.text+text;txtarea.focus();}else{txtarea.value+=text;txtarea.focus();}}
function bbfontstyle(bbopen,bbclose){var txtarea=getMessage();if((clientVer>=4)&&is_ie&&is_win){theSelection=document.selection.createRange().text;if(!theSelection){txtarea.value+=bbopen+bbclose;txtarea.focus();return;}
document.selection.createRange().text=bbopen+theSelection+bbclose;txtarea.focus();return;}
else if(txtarea.selectionEnd&&(txtarea.selectionEnd-txtarea.selectionStart>0))
{mozWrap(txtarea,bbopen,bbclose);return;}
else
{txtarea.value+=bbopen+bbclose;txtarea.focus();}
storeCaret(txtarea);}
function bbstyle(bbnumber){var txtarea=getMessage();txtarea.focus();donotinsert=false;theSelection=false;bblast=0;if(bbnumber==-1){while(bbcode[0]){butnumber=arraypop(bbcode)-1;txtarea.value+=bbtags[butnumber+1];buttext=eval('document.post.addbbcode'+butnumber+'.value');eval('document.post.addbbcode'+butnumber+'.value ="'+buttext.substr(0,(buttext.length-1))+'"');}
imageTag=false;txtarea.focus();return;}
if((clientVer>=4)&&is_ie&&is_win)
{theSelection=document.selection.createRange().text;if(theSelection){document.selection.createRange().text=bbtags[bbnumber]+theSelection+bbtags[bbnumber+1];txtarea.focus();theSelection='';return;}}
else if(txtarea.selectionEnd&&(txtarea.selectionEnd-txtarea.selectionStart>0))
{mozWrap(txtarea,bbtags[bbnumber],bbtags[bbnumber+1]);return;}
for(i=0;i<bbcode.length;i++){if(bbcode[i]==bbnumber+1){bblast=i;donotinsert=true;}}
if(donotinsert){while(bbcode[bblast]){butnumber=arraypop(bbcode)-1;txtarea.value+=bbtags[butnumber+1];buttext=eval('document.post.addbbcode'+butnumber+'.value');eval('document.post.addbbcode'+butnumber+'.value ="'+buttext.substr(0,(buttext.length-1))+'"');imageTag=false;}
txtarea.focus();return;}else{if(imageTag&&(bbnumber!=14)){txtarea.value+=bbtags[15];lastValue=arraypop(bbcode)-1;document.post.addbbcode14.value="Img";imageTag=false;}
txtarea.value+=bbtags[bbnumber];if((bbnumber==14)&&(imageTag==false))imageTag=1;arraypush(bbcode,bbnumber+1);eval('document.post.addbbcode'+bbnumber+'.value += "*"');txtarea.focus();return;}
storeCaret(txtarea);}
function mozWrap(txtarea,open,close)
{var selLength=txtarea.textLength;var selStart=txtarea.selectionStart;var selEnd=txtarea.selectionEnd;if(selEnd==1||selEnd==2)
selEnd=selLength;var s1=(txtarea.value).substring(0,selStart);var s2=(txtarea.value).substring(selStart,selEnd)
var s3=(txtarea.value).substring(selEnd,selLength);txtarea.value=s1+open+s2+close+s3;return;}
function storeCaret(textEl){if(textEl.createTextRange)textEl.caretPos=document.selection.createRange().duplicate();}
