//
//All code below is Copyright (c) 2007 Xooit.com, All right reserved
//
emptyMsg="You must enter a message when posting.";lang_img_address="Please enter the Image URL";lang_link_address="Please enter the link destination address";lang_link_text="Please enter the link text";lang_media_address="Please enter the address of the video or Flash animation";lang_resize_tip="Tip: You can resize the text area by clicking and passing your mouse over this text.";lang_spellchecker="ßeta Spell Checker";var XOOITSpellChecker={};XOOITSpellChecker.init=function(areaid)
{var e;try{if(this.running)return;this.running=true;this.elt=$(areaid);this.spells=[];this.i=0;this.o=0;this.wordChars='';var data=this.elt.innerHTML;data=data.split("<!-- XOOITSPELL_START\n");if(data[1])
{var spells=data[1].split("\n-->")[0].split("\n");this.wordChars=spells[0];for(var a=1;spells[a];a++)
{var spell=spells[a].split('=');var suggestions=spell[1];var word=spell[0];this.spells.push({'word':word,'suggestions':suggestions});}}
if(this.next())
{this.run(this.elt);if(this.o)
{var div=document.createElement('div');div.innerHTML='('+lang_spellchecker+')';div.style.color='red';div.style.textAlign='right';div.style.fontSize='11px';div.style.fontStyle='italic';this.elt.appendChild(div);}}
this.running=false;}catch(e){};}
XOOITSpellChecker.next=function()
{if(typeof this.spells[this.i]=='undefined')return false;this.spell=this.spells[this.i];this.i++;return true;}
XOOITSpellChecker.run=function(elt)
{var rulesToUply=[['[’]','\''],['[,\.\r\n\t\-]',' '],[' (['+this.wordChars+']{0,2})[\'](['+this.wordChars+']+) ',' $1 $2 '],[' (['+this.wordChars+']{0,2})[\'](['+this.wordChars+']+) ',' $1 $2 '],['[^0-9'+this.wordChars+'\']',' ']];for(var a=0;elt.childNodes[a];a++)
{var node=elt.childNodes[a];if(node.nodeType==3)
{var txt=' '+node.nodeValue+' ';for(var r=0;rulesToUply[r];r++)
{var reg=new RegExp(rulesToUply[r][0],'ig');txt=txt.replace(reg,rulesToUply[r][1],txt);}
var i=-1;if((i=txt.indexOf(' '+this.spell.word+' '))!=-1)
{var add=document.createElement('span');add.appendChild(document.createTextNode(this.spell.word));add.style.borderBottom='2px dotted red';add.style.cursor = 'help';var att=document.createAttribute('alt');att.value=this.spell.suggestions;add.setAttributeNode(att);var att=document.createAttribute('title');att.value=this.spell.suggestions;add.setAttributeNode(att);var av=document.createTextNode(node.nodeValue.substr(0,i)+'');var ap=document.createTextNode(node.nodeValue.substr(i+this.spell.word.length));node.parentNode.insertBefore(av,node);node.parentNode.insertBefore(add,node);node.parentNode.insertBefore(ap,node);node.parentNode.removeChild(node);this.o++;if(!this.next())return;a+=1;}}
else if(!(node.nodeName=='A')&&!(node.nodeName=='DL'&&node.className=='code'))
this.run(node);}}
if(typeof XOOITSpellCheckerToDo!='undefined')
{setTimeout("XOOITSpellChecker.init('"+XOOITSpellCheckerToDo+"');");}
//
//End of Xooit.com copyrighted code
//
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);bbcode=new Array();bbtags=new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[hide=Spoiler]','[/hide]','[hide3]','[/hide3]','[flash]','[/flash]','[center]','[/center]','[right]','[/right]','[media]','[/media]','[del]','[/del]','[justify]','[/justify]','[scroll]','[/scroll]','[sup]','[/sup]','[sub]','[/sub]','[hr]','','[tex]','[/tex]','[dice]','','[left]','[/left]','[wow]','[/wow]');imageTag=false;global_bbstyle=function(bbcodearea_id,event){event=event||window.event;element=event.target||event.srcElement;var nodeName='';do{if(element.id&&(match=element.id.match(/^addbbcode[0-9]+_([0-9]+)$/))){element.blur();bbstyle(bbcodearea_id,parseInt(match[1]));break;}
if((nodeName=element.nodeName.toLowerCase())=='div')break;}while(element=element.parentNode);Event.stop(event);return false;};function helpline(areaid,help){document.getElementById('helpbox'+areaid).innerHTML=window[help+"_help"];}
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(areaid){formErrors=false;if(typeof(window[areaid])=="undefined"){var areaid='1';}
var txtarea=$(document.getElementById('bbcodearea'+areaid));var valuelength=$(document.getElementById('bbcodearea'+areaid)).getValue().strip().length;if(valuelength<2){formErrors=emptyMsg;}
if(formErrors){alert(formErrors);return false;}else{bbstyle(areaid,-1);return true;}}
function emoticon(areaid,text){var txtarea=document.getElementById('bbcodearea'+areaid);text=' '+text+' ';if(!isNaN(txtarea.selectionStart)){mozWrap(txtarea,text,'');}else 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(areaid,bbopen,bbclose){var txtarea=document.getElementById('bbcodearea'+areaid);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(areaid,bbnumber){var txtarea=document.getElementById('bbcodearea'+areaid);txtarea.focus();donotinsert=false;theSelection=false;bblast=0;if(bbnumber==-1){while(bbcode[0]){butnumber=arraypop(bbcode)-1;txtarea.value+=bbtags[butnumber+1];if(document.getElementById('addbbcode'+areaid+'_'+butnumber)){buttext=document.getElementById('addbbcode'+areaid+'_'+butnumber).value;document.getElementById('addbbcode'+areaid+'_'+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(!isNaN(txtarea.selectionStart))
{selectLen=txtarea.selectionEnd-txtarea.selectionStart;mozWrap(txtarea,bbtags[bbnumber],bbtags[bbnumber+1]);if(selectLen==0){txtarea.selectionEnd=txtarea.selectionEnd-bbtags[bbnumber+1].length;txtarea.selectionStart=txtarea.selectionEnd;}
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.getElementById(\'addbbcode'+areaid+'_'+butnumber+'\').value');eval('document.getElementById(\'addbbcode'+areaid+'_'+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.getElementById('addbbcode'+areaid+'_14').value="Img";imageTag=false;}
txtarea.value+=bbtags[bbnumber];if((bbnumber==14)&&(imageTag==false))imageTag=1;arraypush(bbcode,bbnumber+1);eval('document.getElementById(\'addbbcode'+areaid+'_'+bbnumber+'\').value += "*"');txtarea.focus();return;}
storeCaret(txtarea);}
function mozWrap(txtarea,open,close)
{var selLength=txtarea.textLength;var selStart=txtarea.selectionStart;var selEnd=txtarea.selectionEnd;var scrollTop=txtarea.scrollTop;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;txtarea.selectionEnd=selEnd+open.length+close.length;txtarea.selectionStart=txtarea.selectionEnd;if(Prototype.Browser.KHTML&&!Prototype.Browser.WebKit){setTimeout(function(txtarea,pos){try{txtarea.setSelectionRange(pos,pos);}catch(e){}}.bind(window,txtarea,selEnd+open.length+close.length),500);}
txtarea.focus();txtarea.scrollTop=scrollTop;return;}
function storeCaret(textEl){if(textEl.createTextRange)textEl.caretPos=document.selection.createRange().duplicate();}
function BBCodeAjaxPreview(event,areaid){if(!checkForm(areaid))return false;var form=$('bbcodearea'+areaid).form;if(!form||Form.serialize(form)==''){return true;}
var params=Form.serialize(form,true);var blacklist=['post','poll_length','poll_title','add_poll_option','add_poll_option_text','usersubmit'];while(key=blacklist.pop()){params[key]=null;}
params.ajax=1;$('previewBoxContent').hide();$('previewBoxReload').hide();document.location.hash='previewBox';$('previewBoxLoading').show().scrollTo();var fallback=function(){var e=form.elements.namedItem('preview');e.parentNode.removeChild(e);var n=document.createElement('input');n.type='hidden';n.name='preview';n.value='preview';form.appendChild(n);form.submit();}
new Ajax.Updater($('previewBoxContent'),form.action,{method:'post',onSuccess:function(a){if(!a.getResponseHeader('X-Success')){fallback();$('previewBoxContent').hide();return;}
$('previewBoxLoading').hide();$('previewBoxContent').show().scrollTo();$('previewBoxReload').show();setTimeout("XOOITSpellChecker.init('forXooitSpellChecker');");},onException:function(){fallback();},parameters:params});var event=(event||window.event);Event.stop(event);return false;}
function BBCodeAjaxEmbedPreview(areaid,event){var params={};params.message=$('bbcodearea'+areaid).getValue();params.rci=window.rci;if(typeof BBCodeAjaxEmbedPreview_pageParams=='function'){params=BBCodeAjaxEmbedPreview_pageParams(areaid,params);}
$('previewLoading'+areaid).show();$('previewContent'+areaid).hide();$('previewContainer'+areaid).show().scrollTo();new Ajax.Updater($('previewContent'+areaid),'/preview.php?ajax=1&v=2'+(/[&\?]theme=test(&|$)/.test(document.location.search)?'&theme=test':''),{method:'post',onSuccess:function(){$('previewLoading'+areaid).hide();$('previewContent'+areaid).show();if($('bbcodearea'+areaid).visible()){$('bbcodearea'+areaid).hide();$('bbcodearea'+areaid).show();}
$('previewContainer'+areaid).scrollTo();setTimeout("XOOITSpellChecker.init('previewContent"+areaid+"');");},parameters:params});try{var event=(event||window.event);Event.stop(event);}catch(e){};return false;}
openColorPicker=function(bbcodearea_id,event){event=(event||window.event);var self=arguments.callee;if(!self.frame){self.frame=$cE('iframe');document.body.appendChild(self.frame);self.frame.scrolling="no";self.frame.src='/ColorPickerFrame.php?bbcodearea_id='+bbcodearea_id+'&4';self.frame.setStyle({overflow:'hidden',border:'1px solid gray',position:'absolute',left:Event.pointerX(event)+'px',top:(Event.pointerY(event))+'px',zIndex:32767});}else{self.frame.style['top']=(Event.pointerY(event)-self.frame.getHeight())+'px';}
self.frame.style['display']='block';};addquote=function(post_id,username)
{var message_name='message_'+post_id;var theSelection='';var divarea=false;if(document.all)
{divarea=document.all[message_name];}
else
{divarea=document.getElementById(message_name);}
if(window.getSelection)
{theSelection=window.getSelection().toString();}
else if(document.getSelection)
{theSelection=document.getSelection();}
else if(document.selection)
{theSelection=document.selection.createRange().text;}
if(theSelection==''||typeof theSelection=='undefined'||theSelection==null)
{if(divarea.innerHTML)
{theSelection=divarea.innerHTML.replace(/<br>/ig,'\n');theSelection=theSelection.replace(/<br\/>/ig,'\n');theSelection=theSelection.replace(/&lt\;/ig,'<');theSelection=theSelection.replace(/&gt\;/ig,'>');theSelection=theSelection.replace(/&amp\;/ig,'&');theSelection=theSelection.replace(/&nbsp\;/ig,' ');}
else if(document.all)
{theSelection=divarea.innerText;}
else if(divarea.textContent)
{theSelection=divarea.textContent;}
else if(divarea.firstChild.nodeValue)
{theSelection=divarea.firstChild.nodeValue;}}
if(theSelection)
{emoticon(1,'[quote="'+username+'"]'+theSelection+'[/quote]');}
return;};BBW=Class.create();BBW.buttonElem=0;BBW.origFunction=1;BBW.wysiwygFunction=2;BBW.TEXT=3;BBW.WYSIWYG=4;BBW.patterns={bbcodeOpen:['\\[([a-z]+)((."[^"\n\r]+")|[^\\]]+)?\\]','i'],bbcodeOpenOrClose:['\\[/?([a-z]+)((."[^"\n\r]+")|[^\\]]+)?\\]','i'],bbcodeFullTag:['\\[([a-z]+)([^\\]]+)?\\](.*)\\[\\/\\1\\]','i'],uLeftSquare:['&#x5B;','gi'],uRightSquare:['&#x5D;','gi'],leftSquare:['\\[','g'],rightSquare:['\\]','g'],uEscaped:['&amp;#','gi'],htmlAmp:['&','g'],htmlLt:['<','g'],htmlGt:['>','g'],htmlQuot:['"','g'],htmlScriptSchemes:['(([a-z0-9]*script[a-z0-9]*|about|applet|chrome?|data|firefox\.?url|firefoxhtml|wysiwyg)\\s*):','gi'],lineBreak:["(\r\n|\n|\r)",'g'],junkChars:[String.fromCharCode(10),'g'],exceptAlnum:['[^a-zA-Z0-9]+','g'],argCleanup:['[^a-zA-Z0-9%]+','g'],bbcodeLi:["\\[\\*\\]",'g'],typeFlash:['flash','ig'],styleCenter:['center','ig'],styleLeft:['left','ig'],styleRight:['right','ig'],styleJustify:['justify','ig'],styleLineThrough:['line-trough','ig'],styleBold:['bold','ig'],styleItalic:['italic','ig'],styleUnderline:['underline','ig'],styleBold:['bold','ig'],styleBold:['bold','ig'],URL:['((http|ftp)s?://|(www|ftp)\\.)[\\w#$%&~/.\\-;:=,?@\\*\\[\\]+]+',''],ColorBBCode:['\\[color=(#[A-Fa-f0-9]+)\\]',''],FontBBCode:['\\[font=([^\\]]*)\\]',''],SizeBBCode:['\\[size=([^\\]]*)\\]',''],EmptyLineBreakTag:['<(div|p)></\\1>','ig'],StylesToApply:['width|margin|padding|text|font|color|border|background','i'],BrowserVersionIE:['MSIE ([0-9\.]+)',''],BrowserVersionGecko:['Gecko/([0-9]+)',''],BrowserVersionOpera:['Opera[ /]([0-9\.]+)',''],BrowserVersionWebKit:['WebKit/([0-9\.]+)','']};BBW.pattern=function(pattern){if(BBW.patterns[pattern]instanceof Array){BBW.patterns[pattern]=new RegExp(BBW.patterns[pattern][0],BBW.patterns[pattern][1]);}
return BBW.patterns[pattern];};BBW.fontSize={px:{1:10,2:12,3:16,4:18,5:24,6:32,7:48},pt:{1:7,2:10,3:12,4:16,5:18,6:24,7:37},em:{1:0.6,2:0.8,3:1,4:1.2,5:1.5,6:2,7:3},css:{1:'xx-small',2:'x-small',3:'small',4:'medium',5:'large',6:'x-large',7:'xx-large'}};BBW.aligns=['justify','center','left','right'];BBW.tableArgs=['cellpadding','cellspacing','colspan','rowspan','border','align','valign','width','bgcolor'];BBW.tableCells=['td','th'];BBW.lineBreakElements=['p','div'];if(Prototype.Browser.IE){BBW.TAGS={LINE_BREAK:'</P><P>',BOLD_OPEN:'<STRONG>',BOLD_CLOSE:'</STRONG>',ITALIC_OPEN:'<EM>',ITALIC_CLOSE:'</EM>',UNDERLINE_OPEN:'<U>',UNDERLINE_CLOSE:'</U>',STRIKE_OPEN:'<STRIKE>',STRIKE_CLOSE:'</STRIKE>',ALIGN_OPEN:'</P><P align="%s">',ALIGN_CLOSE:'</P><P>',SUP_OPEN:'<SUP>',SUP_CLOSE:'</SUP>',SUB_OPEN:'<SUB>',SUB_CLOSE:'</SUB>',BLOCK_OPEN:'',BLOCK_CLOSE:''};}else if(Prototype.Browser.Gecko){BBW.TAGS={LINE_BREAK:'<br>',BOLD_OPEN:'<b>',BOLD_CLOSE:'</b>',ITALIC_OPEN:'<i>',ITALIC_CLOSE:'</i>',UNDERLINE_OPEN:'<u>',UNDERLINE_CLOSE:'</u>',STRIKE_OPEN:'<strike>',STRIKE_CLOSE:'</strike>',ALIGN_OPEN:'<div align="%s">',ALIGN_CLOSE:'</div>',SUP_OPEN:'<sup>',SUP_CLOSE:'</sup>',SUB_OPEN:'<sub>',SUB_CLOSE:'</sub>',BLOCK_OPEN:'',BLOCK_CLOSE:''};}else if(Prototype.Browser.Opera){BBW.TAGS={LINE_BREAK:'<BR>',BOLD_OPEN:'<STRONG>',BOLD_CLOSE:'</STRONG>',ITALIC_OPEN:'<I>',ITALIC_CLOSE:'</I>',UNDERLINE_OPEN:'<U>',UNDERLINE_CLOSE:'</U>',STRIKE_OPEN:'<STRIKE>',STRIKE_CLOSE:'</STRIKE>',ALIGN_OPEN:'<DIV align="%s">',ALIGN_CLOSE:'</DIV>',SUP_OPEN:'<SUP>',SUP_CLOSE:'</SUP>',SUB_OPEN:'<SUB>',SUB_CLOSE:'</SUB>',BLOCK_OPEN:'',BLOCK_CLOSE:''};}else if(Prototype.Browser.WebKit){BBW.TAGS={LINE_BREAK:'</div><div>',BOLD_OPEN:'<b>',BOLD_CLOSE:'</b>',ITALIC_OPEN:'<i>',ITALIC_CLOSE:'</i>',UNDERLINE_OPEN:'<span class="Apple-style-span" style="text-decoration:underline;">',UNDERLINE_CLOSE:'</span>',STRIKE_OPEN:'<span style="Apple-style-span" style="text-decoration:line-through;">',STRIKE_CLOSE:'</span>',ALIGN_OPEN:'</div><div style="text-align: %s;">',ALIGN_CLOSE:'</div><div>',SUP_OPEN:'<span style="vertical-align: super;">',SUP_CLOSE:'</span>',SUB_OPEN:'<span style="vertical-align: sub;">',SUB_CLOSE:'</span>',BLOCK_OPEN:'<div class="block-open">',BLOCK_CLOSE:'</div>'};}
BBW.TRANSLATED_BBCODES={citer:'quote',couleur:'color',colour:'color',taille:'size',strike:'del',fixed:'code',marquee:'scroll',quick:'media',wmp:'media',qt:'media',video:'media',liste:'list',spoiler:'hide'};BBW.buttons={'0':'bold','2':'italic','4':'underline','30':'strikethrough','38':'subscript','36':'superscript','24':'JustifyCenter','26':'JustifyRight','32':'JustifyFull','46':'JustifyLeft','10':'InsertUnorderedList','12':'InsertOrderedList','40':'InsertHorizontalRule','16':'CreateLink','14':'InsertImage','6':'quote','22':'flash','28':'media','44':'dice','18':'hide','20':'hide3','42':'tex','8':'code','48':'wow','34':'scroll'};BBW.firstWysiwygLoad=true;BBW.prototype={firstLoad:true,mode:BBW.TEXT,prototypeSrc:null,initialize:function(bbcodearea_id,mode,prototypeSrc){this.bbcodearea_id=parseInt(bbcodearea_id)||'1';this.prototypeSrc=prototypeSrc;this.modeSwitch_text=document.getElementById('wysiwyg_switch_text');this.helpbox_text=$(this.modeSwitch_text.parentNode);Event.observe(this.modeSwitch_text,'mousedown',function(event){Event.stop(event);this.switchToWysiwyg();}.bindAsEventListener(this));if((this.getPref('mode')||mode||'')==BBW.WYSIWYG&&this.checkSupported())this.switchToWysiwyg();if(document.location.href.indexOf('&wysiwygdebug&')>-1){node=document.createElement('a');node.innerHTML='asBBCode';node.onclick=function(){alert(this.nodeToBBCode(this.doc.body));alert(this.doc.body.innerHTML);}.bind(this);document.getElementById('addbbcode1_20').parentNode.appendChild(node);node=document.createElement('a');node.innerHTML='asHTML';node.onclick=function(){alert(this.txtarea.value);alert(this.BBCodeToHTML(this.txtarea.value));}.bind(this);document.getElementById('addbbcode1_20').parentNode.appendChild(node);}},checkSupported:function(){var version=0;if(Prototype.Browser.IE){if(matches=navigator.userAgent.match(BBW.pattern('BrowserVersionIE'))){version=parseFloat(matches[1]);}
if(version>=7||window.XMLHttpRequest)return true;return false;}
if(Prototype.Browser.Gecko){if(matches=navigator.userAgent.match(BBW.pattern('BrowserVersionGecko'))){version=parseFloat(matches[1]);}
if(version>=20060401&&window.postMessage)return true;return false;}
if(Prototype.Browser.Opera){if(matches=navigator.userAgent.match(BBW.pattern('BrowserVersionOpera'))){version=parseFloat(matches[1]);}
if(version>=9)return true;return false;}
if(Prototype.Browser.WebKit){if(matches=navigator.userAgent.match(BBW.pattern('BrowserVersionWebKit'))){version=parseFloat(matches[1]);}
if(version>=522)return true;return false;}
return false;},checkSupportedAndAlert:function(){if(this.checkSupported()){return true;}
this.mode=BBW.TEXT;var notify='';notify+="Vous devez avoir l\u2019un des navigateurs suivants pour utiliser l\u2019\u00e9diteur WYSIWYG:\n\n";notify+=" \u2013 Firefox \u2265 3 (ou Gecko \u2265 1.9)\n";notify+=" \u2013 Internet Explorer \u2265 7\n";notify+=" \u2013 Opera \u2265\u00a09\n";notify+=" \u2013 Safari \u2265 3 (ou WebKit \u2265 522)\n";notify+="\n";notify+="Tous ces navigateurs sont t\u00e9l\u00e9chargeables gratuitement.\n";notify+="\n";notify+="Votre navigateur d\u00e9clare \u00eatre:\n";notify+="\u00ab\u00a0"+navigator.userAgent+"\u00a0\u00bb\n";alert(notify);return false;},switchToText:function(){this.mode=BBW.TEXT;this.setPref('mode',BBW.TEXT);this.updateTextarea();this.showTxtarea();},updateTextarea:function(){var node=this.doc.body;var bbcode=this.nodeToBBCode(node);this.txtarea.value=bbcode;},switchToWysiwyg:function(loaded){this.mode=BBW.WYSIWYG;if(!loaded&&this.firstLoad==true){this.operaAntiScrollTop();if(!this.checkSupportedAndAlert()){return false;}
this.operaAntiScrollTop();this.txtarea=document.getElementById('bbcodearea'+this.bbcodearea_id);this.operaAntiScrollTop();try{if(typeof this.txtarea.form.onsubmit=='function'){this.onsubmit_orig=this.txtarea.form.onsubmit;this.txtarea.form.onsubmit=function(){};}
Event.observe(this.txtarea.form,'submit',this.onsubmitWrapper.bindAsEventListener(this));}catch(e){};this.operaAntiScrollTop();try{this.txtarea.form.submit=function(event,orig_submit_function){var myself=this.txtarea.form.submit;this.txtarea.form.submit=orig_submit_function;try{if((this.txtarea.form.onsubmit||this.onsubmitWrapper.bind(this))(event)!=false)this.txtarea.form.submit();}catch(e){};this.txtarea.form.submit=myself;}.bindAsEventListener(this,this.txtarea.form.submit);}catch(e){};this.operaAntiScrollTop();this.txtarea.getValue=function(){if(this.mode==BBW.WYSIWYG)this.updateTextarea();return this.txtarea.value;}.bind(this);this.operaAntiScrollTop();if(Prototype.Browser.IE){this.txtarea.focus=function(orig_focus){if(this.mode==BBW.WYSIWYG)this.txtarea.show();orig_focus();if(this.mode==BBW.WYSIWYG)this.txtarea.hide();}.bind(this,this.txtarea.focus);}
var select=$('addbbcode'+this.bbcodearea_id+'_table_select');this.operaAntiScrollTop();this.doTableAction=function(select){var cmd=select.getValue();if(cmd=='')return;select.selectedIndex=0;select.blur();this.execCommand(cmd);}.bind(this,select);if(!Prototype.Browser.IE||navigator.userAgent.indexOf('MSIE 7')<0){select.onchange=this.doTableAction;}
$('addbbcode'+this.bbcodearea_id+'_table_ok').onclick=this.doTableAction;this.operaAntiScrollTop();this.iframe=document.getElementById('wysiwyg_frame_'+this.bbcodearea_id);this.iframe.style['display']='';if(Prototype.Browser.IE){Event.observe(this.iframe,'load',this.ieAntiDocWriteToHistory);}
this.operaAntiScrollTop();this.operaAntiScrollTop();this.switchToWysiwyg(true);this.operaAntiScrollTop();return;}else if(loaded&&this.firstLoad==true){this.operaAntiScrollTop();loaded=false;try{this.doc=(this.iframe.contentDocument||this.iframe.contentWindow.document);if((this.doc.designMode||'').toLowerCase()!='on'){this.doc.designMode='on';if(Prototype.Browser.IE)this.doc=this.iframe.contentWindow.document;}
if(check=this.doc.getElementById('check')&&this.doc.body)loaded=true;}catch(e){}
this.operaAntiScrollTop();if(!loaded){setTimeout(this.switchToWysiwyg.bind(this,true),100);return;}
this.operaAntiScrollTop();clearInterval(this.iframe_load_observer);this.operaAntiScrollTop();if(Prototype.Browser.Opera){var scrollTop=document.body.scrollTop;}
this.operaAntiScrollTop();this.operaAntiScrollTop();var html='';html+='<html><head><style type="text/css"> body,img{border:0} table{border:1px outset gray} td,th{border:1px inset gray;font-size:11px;padding:0.3em} th{font-weiht:bold} blockquote,pre{margin-left:3em;padding-top:16px;background-repeat:no-repeat;background-position:0% 0%;border:1px outset gray} blockquote{background-image:url(\'http://img5.xooimage.com/files/b/9/8/citation-1452be.png\')} pre,blockquote.code{background-image:url(\'http://img6.xooimage.com/files/c/f/4/code-14533f.png\');font-family:monospace} p{margin:0} </style></head>';html+='<body><p>Loading...</p></body></html>';this.operaAntiScrollTop();try{var styles=document.defaultView.getComputedStyle(this.txtarea,null);if(Prototype.Browser.WebKit){var styles_orig=styles;var styles={};for(var i=0,l=styles_orig.length;i<l;++i){styles[styles_orig[i]]=styles_orig.getPropertyValue(styles_orig[i]);}}}catch(e){var styles=this.txtarea.currentStyle;}
this.operaAntiScrollTop();for(var key in styles){if(!BBW.pattern('StylesToApply').test(key))continue;var value=styles[key];if(typeof styles[key]=='function')continue;if(key.indexOf('-')>-1)key=key.camelize();if(typeof value!='string')continue;if(key.toLowerCase().indexOf('overflow')>-1)continue;if(key=='cssText')continue;if(key=='maxWidth'&&parseInt(value,10)<0)continue;if(Prototype.Browser.IE&&/^(min)?height$/i.test(key)){continue;}
if(value==''&&styles[key.replace(/([A-Z][a-z]+)$/,'Left$1')])continue;if(value==''&&key=='font')continue;try{this.iframe.style[key]=value;}catch(e){}
if(key.toLowerCase().indexOf('width')>-1)continue;if(key.toLowerCase().indexOf('height')>-1)continue;try{this.doc.body.style[key]=value;}catch(e){}}
this.operaAntiScrollTop();this.doc.body.style['border']='0';this.iframe.setAttribute('border','1px');this.iframe.setAttribute('frameborder','1px');this.iframe.style['padding']='0';this.iframe.style['margin']='0';this.operaAntiScrollTop();if(Prototype.Browser.IE){this.iframe.style['height']='200px';Event.observe(window,'load',(function(){if(parseInt(w=$(this.txtarea).getStyle('width'),10)>0){this.iframe.style['width']=w;}
if(this.iframe.offsetWidth>0){this.iframe.style['width']=this.iframe.offsetWidth+'px';}
return arguments.callee;}.bind(this))());}
if(Prototype.Browser.Opera){this.doc.body.style['width']='97%';this.doc.body.style['height']='100%';}
if(Prototype.Browser.WebKit){this.iframe.style['minWidth']='100%';}
if(Prototype.Browser.Gecko){this.iframe.style['overflow']='auto';}
this.operaAntiScrollTop();window.bbstyle=function(orig_bbstyle,bbcodearea_id,bbcode_id){if(this.mode==BBW.TEXT||bbcodearea_id!=this.bbcodearea_id)return orig_bbstyle(bbcodearea_id,bbcode_id);if(bbcode_id==-1){this.updateTextarea();return true;}
if(BBW.buttons[bbcode_id])this.execCommand(BBW.buttons[bbcode_id]);}.bind(this,window.bbstyle);this.operaAntiScrollTop();if(Prototype.Browser.IE){this.wrapResizing=function(event){var elem=Event.element(event);var nodeName='';if(typeof elem.nodeName!='undefined')nodeName=elem.nodeName.toLowerCase();if(!nodeName)return;if(nodeName!='img'&&nodeName!='table')return;elem.unselectable='on';elem.blur();selection=this.getSelection();range=this.createRange(selection);try{range.collapse(false);}catch(e){selection.empty();}
Event.stop(event);return false;}.bindAsEventListener(this);Event.observe(this.doc,'click',this.wrapResizing);Event.observe(this.doc,'mousedown',this.wrapResizing);Event.observe(this.doc,'mouseup',this.wrapResizing);}
this.operaAntiScrollTop();if(typeof smiliesTable!='undefined'){this.origAddSmiley=smiliesTable.addSmiley;smiliesTable.addSmiley=this.addSmileyWrapper.bind(this);}
window.bbfontstyle=function(orig_bbfontstyle,areaid,openTag,closeTag){if(areaid!=this.bbcodearea_id||this.mode!=BBW.WYSIWYG){orig_bbfontstyle(areaid,openTag,closeTag);return;}
if((matches=openTag.match(BBW.pattern('ColorBBCode')))){this.execCommand('forecolor',false,matches[1]);return;}
if((matches=openTag.match(BBW.pattern('FontBBCode')))){this.execCommand('fontname',false,matches[1]);return;}
if((matches=openTag.match(BBW.pattern('SizeBBCode')))){this.setFontSize(matches[1]);return;}
this.insertBBCode(openTag,closeTag);return;}.bind(this,window.bbfontstyle);window.emoticon=function(orig_emoticon_func,areaid,data){if(areaid!=this.bbcodearea_id||this.mode!=BBW.WYSIWYG){orig_emoticon_func(areaid,data);return;}
var scrollTop=document.body.scrollTop;var scrollLeft=document.body.scrollLeft;var html=this.BBCodeToHTML(data);var span=this.doc.createElement('span');span.innerHTML=html;var range=this.createRange();range.collapse(false);range.applyNode(span);window.scrollTo(scrollLeft,scrollTop);}.bind(this,window.emoticon);this.operaAntiScrollTop();if(!Prototype.Browser.Gecko){try{this.doc.body.contentEditable=true;}catch(e){}}
this.operaAntiScrollTop();var helpbox_span=document.getElementById('wysiwyg_switch_wysiwyg');this.helpbox_wysiwyg=$(helpbox_span.parentNode);Event.observe(helpbox_span,'mousedown',function(event){Event.stop(event);this.switchToText();}.bindAsEventListener(this));this.helpbox_wysiwyg.observe('mousedown',function(event,element,direction,invert,onMouseUp){new resizeClass(event,element,direction,invert,(typeof resizeSmiliesElem=='function'?resizeSmiliesElem:null));}.bindAsEventListener(window,this.iframe,'V',{x:true}));this.operaAntiScrollTop();this.firstLoad=false;}
this.setPref('mode',BBW.WYSIWYG);var bbcode=this.txtarea.value;var html=this.BBCodeToHTML(bbcode);this.doc.body.innerHTML=html;$A(this.getElementsBySelector(this.doc.body,'ul>*:not(li), ol>*:not(li), table>*:not(tbody):not(tr), tbody>*:not(tr), tr>*:not(th):not(td)')).each(function(elem){elem.parentNode.removeChild(elem);});var elem=document.getElementById('addbbcode'+this.bbcodearea_id+'_size');if(typeof elem.onchange=='function'){fontSizeOrigFunc=elem.onchange;elem.onchange=function(){this.setFontSize();}.bind(this);}
this.showIframe();if(Prototype.Browser.Gecko){try{this.execCommand('styleWithCSS',false,false);}catch(e){this.execCommand('useCSS',false,true);}
this.doc.execCommand('enableObjectResizing',false,false);setTimeout(function(){try{this.execCommand('styleWithCSS',false,false);}catch(e){this.execCommand('useCSS',false,true);}
this.doc.execCommand('enableObjectResizing',false,false);this.doc.body.appendChild(this.doc.createTextNode(' '));}.bind(this),1000);}
if(typeof resizeSmiliesElem=='function')resizeSmiliesElem();if(Prototype.Browser.IE&&!BBW.firstWysiwygLoad){var t=this;setTimeout(function(){t.execCommand("dummy");},1);}
BBW.firstWysiwygLoad=false;},showTxtarea:function(){this.helpbox_wysiwyg.childNodes[1].id='';this.helpbox_wysiwyg.style['display']='none';this.helpbox_text.childNodes[1].id='helpbox'+this.bbcodearea_id;this.helpbox_text.style['display']='';this.txtarea.style['height']=parseInt(this.iframe.style['height'])+'px';this.iframe.style['display']='none';this.txtarea.style['display']='';var buttons=$$('.wysiwyg-buttons').each(function(button){button.hide();});},showIframe:function(){this.helpbox_text.childNodes[1].id='';this.helpbox_text.style['display']='none';this.helpbox_wysiwyg.childNodes[1].id='helpbox'+this.bbcodearea_id;this.helpbox_wysiwyg.style['display']='';this.iframe.style['height']=parseInt(this.txtarea.style['height'])+'px';this.iframe.style['display']='';this.txtarea.style['display']='none';var buttons=$$('.wysiwyg-buttons').each(function(button){if(button.hasClassName('wysiwyg-hidden'))return;button.show();});},onsubmitWrapper:function(event){try{if(this.mode==BBW.WYSIWYG){this.updateTextarea();}
if(this.onsubmit_orig){if(this.onsubmit_orig(event)==false){if(event)Event.stop(event);return false;}}}catch(e){try{console.dir(e);return false;}catch(e2){}}
return true;},addSmileyWrapper:function(){args=$A(arguments);if(this.mode!=BBW.WYSIWYG){return this.origAddSmiley(args.shift());}else{smileyId=args.shift();this.focusEditor();this.insertImage('http://img'+smilies[smileyId]['s']+'.xooimage.com/files'+smilies[smileyId]['u']);}},focusEditor:function(focusBody){this.iframe.contentWindow.focus();if(focusBody&&!Prototype.Browser.Gecko){if(Prototype.Browser.Opera){var scrollTop=document.body.scrollTop;}
this.iframe.contentWindow.document.body.focus();if(Prototype.Browser.Opera){document.body.scrollTop=scrollTop;}}},nodeToHTML:function(node){var div=this.doc.createElement('div');div.appendChild(node);return div.innerHTML;},getSelection:function(){this.focusEditor();if(Prototype.Browser.IE){return this.doc.selection;}else{if(typeof this.iframe.contentWindow.getSelection!='undefined'){return this.iframe.contentWindow.getSelection();}else{return this.doc.getSelection();}}},createRange:function(sel){this.focusEditor();sel=(sel||this.getSelection());if(Prototype.Browser.IE){var range=sel.createRange();}else{if(typeof sel!="undefined"){try{var range=sel.getRangeAt(0);}catch(e){try{var range=this.doc.createRange();}catch(E){var range=sel;}}}else{var range=this.doc.createRange();}}
range.sel=sel;range.document=this.doc;range.bbw=this;if(Prototype.Browser.IE){range.getSelectedElement=function(){switch(this.sel.type){case"Text":case"None":return this.parentElement();case"Control":return this.item(0);default:return this.document.body;}};}else{range.getSelectedElement=function(){var p=this.commonAncestorContainer;if(!this.collapsed&&this.startContainer==this.endContainer&&this.startOffset-this.endOffset<=1&&this.startContainer.hasChildNodes()){p=this.startContainer.childNodes[range.startOffset];}
while(p.nodeType==3){p=p.parentNode;}
return p;};}
if(Prototype.Browser.IE){range.collapse_native=range.collapse;range.collapse=function(toStart){return this.sel.type=='Control'?sel.empty():range.collapse_native(toStart);};}
if(Prototype.Browser.IE){range.replaceContents=function(contentNode){this.pasteHTML(this.bbw.nodeToHTML(contentNode));this.select();};}else{range.replaceContents=function(contentNode){this.deleteContents();this.insertNode(contentNode);this.selectNode(contentNode);};}
if(Prototype.Browser.IE){range.getSelectedText=function(){return this.text;};}else{range.getSelectedText=function(){try{return this.cloneContents().textContent;}catch(e){return'';}};}
if(Prototype.Browser.IE){range.applyNode=function(node,appendNode,appendOutside){var scrollTop=this.document.body.scrollTop;appendText='';appendOutsideText='';if(appendNode)appendText=this.bbw.nodeToHTML(appendNode);if(appendOutside)appendOutsideText=this.bbw.nodeToHTML(appendOutside);try{if(range.htmlText)node.innerHTML=node.innerHTML+range.htmlText;if(appendText)node.innerHTML=node.innerHTML+appendText;}catch(e){}
range.pasteHTML(this.bbw.nodeToHTML(node)+appendOutsideText);range.select();this.document.body.scrollTop=scrollTop;};}else{range.applyNode=function(node,appendNode,appendOutside){var contents=null;if(contents=this.cloneContents()){while(contents.firstChild){node.appendChild(contents.firstChild);}}
if(appendNode){node.appendChild(appendNode);}
this.deleteContents();this.insertNode(node);if(appendOutside){this.insertNode(appendOutside);}
this.selectNode(node);};}
return range;},execCommand:function(Command,useGUI,param){if(!Command)return;this.focusEditor();var value=null;var command=Command.toLowerCase();switch(command){case'createlink':value=this.createLink();break;case'insertimage':value=this.insertImage();break;case'quote':case'cite':range=this.createRange();if(range.getSelectedText()==''){var space=this.doc.createTextNode('\u00a0');}else{var space=null;}
var appendOutside=this.doc.createElement('p');appendOutside.appendChild(this.doc.createTextNode('\u00a0'));value=range.applyNode(this.doc.createElement('blockquote'),space,appendOutside);range.collapse(false);break;case'code':range=this.createRange();var space=this.doc.createTextNode('\u00a0');var appendOutside=this.doc.createElement('p');appendOutside.appendChild(this.doc.createTextNode('\u00a0'));var node=this.doc.createElement('blockquote');node.className='code';value=range.applyNode(node,space,appendOutside);range.collapse(false);break;case'flash':case'media':value=this.insertMedia(command);break;case'dice':value=this.insertBBCode('','[dice]');break;case'hide':case'hide3':case'tex':case'wow':case'scroll':value=this.insertBBCode('['+command+']','[/'+command+']');break;case'createtable':var selection=this.getSelection();var range=this.createRange();range.collapse(false);values=multiprompt({'Nombre de colonnes:':2,'Nombre de lignes:':2});if(!(cols=values[0]))return false;if(!(rows=values[1]))return false;var table=this.doc.createElement('table');var tbody=table.appendChild(this.doc.createElement('tbody'));for(var i=0;i<rows;++i){var tr=tbody.appendChild(this.doc.createElement('tr'));for(var j=0;j<cols;++j){tr.appendChild(this.doc.createElement('td')).appendChild(this.doc.createTextNode('\u00a0'));}}
value=range.applyNode(table);break;case'addrowafter':case'addrowbefore':case'addcolafter':case'addcolbefore':case'deleterow':case'deletecol':case'deletetable':case'mergecellright':case'mergecelldown':case'splitcellhorizontal':case'splitcellvertical':case'celltoth':case'celltotd':value=this.tableCommand(command);break;case'dummy':break;default:try{value=this.doc.execCommand(Command,useGUI,param);}catch(e){this.log(command);this.dir(e);value=false;}}
this.forceRedraw();return value;},mapTable:function(table){var rowIndex=0;var colIndex=0;var map=[];for(var i=0,l=table.childNodes.length;i<l;i++){var node=table.childNodes[i];if(node.nodeType!=1)continue;if(node.nodeName.toLowerCase()=='tbody'){i=-1;l=node.childNodes.length;table=node;continue;}
if(node.nodeName.toLowerCase()!='tr')continue;if(typeof map[rowIndex]=='undefined')map[rowIndex]=[];map[rowIndex].element=node;colIndex=-1;while(map[rowIndex][++colIndex]);for(var j=0,jl=node.childNodes.length;j<jl;j++){var cell=node.childNodes[j];if(cell.nodeType!=1)continue;if(!BBW.tableCells.include(cell.nodeName.toLowerCase()))continue;var colspan=(parseInt(cell.getAttribute('colSpan'))||1);var rowspan=(parseInt(cell.getAttribute('rowSpan'))||1);cell.rowIndex=rowIndex;cell.colIndex=colIndex;for(var y=0;y<rowspan;y++){if(typeof map[rowIndex+y]=='undefined')map[rowIndex+y]=[];for(var x=0;x<colspan;x++){map[rowIndex+y][colIndex+x]=cell;}}
while(map[rowIndex][++colIndex]);}
rowIndex++;}
return map;},checkEmptyTable:function(table){var tableMap=this.mapTable(table);if(tableMap.length<1||(tableMap[0]&&tableMap[0].length<1)){table.parentNode.removeChild(table);return true;}},tableCommand:function(command){var selection=this.getSelection();var range=this.createRange();var table=range.getSelectedElement();var cell=null;if(BBW.tableCells.include(table.nodeName.toLowerCase()))cell=table;while((nodeName=table.nodeName.toLowerCase())!='table'){if(nodeName=='body')break;if(BBW.tableCells.include(table.nodeName.toLowerCase()))cell=table;if(!table.parentNode)break;table=table.parentNode;}
if(!table.nodeName||table.nodeName.toLowerCase()!='table'){this.log(table.nodeName+' vs TABLE');return;}
if(!cell){this.log('no cell');return false;}
var tableMap=this.mapTable(table);switch(command){case'addrowafter':case'addrowbefore':var rowIndex=cell.rowIndex;if(command=='addrowafter'){var rowspan=(parseInt(cell.getAttribute('rowSpan'))||1);rowIndex+=(rowspan-1);}
var referenceRow=tableMap[rowIndex].element;var cols=tableMap[rowIndex].length;var newRow=this.doc.createElement('tr');for(var colIndex=0;colIndex<cols;colIndex++){if((command=='addrowafter'&&tableMap[rowIndex+1]&&tableMap[rowIndex][colIndex]==tableMap[rowIndex+1][colIndex])||(command=='addrowbefore'&&tableMap[rowIndex-1]&&tableMap[rowIndex][colIndex]==tableMap[rowIndex-1][colIndex])){var rowspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('rowSpan'))||1);tableMap[rowIndex][colIndex].setAttribute('rowSpan',rowspan+1);var colspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('colSpan'))||1);colIndex+=(colspan-1);continue;}
var cell=this.doc.createElement('td');cell.appendChild(this.doc.createTextNode('\u00a0'));newRow.appendChild(cell);}
if(command=='addrowafter'){if(tableMap[rowIndex+1]&&tableMap[rowIndex+1].element){tableMap[rowIndex+1].element.parentNode.insertBefore(newRow,tableMap[rowIndex+1].element);}else{tableMap[rowIndex].element.parentNode.appendChild(newRow);}}else{tableMap[rowIndex].element.parentNode.insertBefore(newRow,tableMap[rowIndex].element);}
break;case'addcolafter':case'addcolbefore':var colIndex=cell.colIndex;if(command=='addcolafter'){var colspan=(parseInt(cell.getAttribute('colSpan'))||1);colIndex+=(colspan-1);}
var rows=tableMap.length;for(var rowIndex=0;rowIndex<rows;rowIndex++){if((command=='addcolafter'&&tableMap[rowIndex][colIndex+1]&&tableMap[rowIndex][colIndex]==tableMap[rowIndex][colIndex+1])||(command=='addcolbefore'&&tableMap[rowIndex][colIndex-1]&&tableMap[rowIndex][colIndex]==tableMap[rowIndex][colIndex-1]))
{var colspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('colSpan'))||1);tableMap[rowIndex][colIndex].setAttribute('colSpan',colspan+1);var rowspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('rowSpan'))||1);rowIndex+=(rowspan-1);continue;}
var newCell=this.doc.createElement('td');newCell.appendChild(this.doc.createTextNode('\u00a0'));var colIndexI=(command=='addcolafter'?1:0);while(tableMap[rowIndex][colIndex+colIndexI]&&tableMap[rowIndex][colIndex+colIndexI].rowIndex!=rowIndex){colIndexI++;}
if(tableMap[rowIndex][colIndex+colIndexI]&&tableMap[rowIndex][colIndex+colIndexI].rowIndex==rowIndex){tableMap[rowIndex].element.insertBefore(newCell,tableMap[rowIndex][colIndex+colIndexI]);}else{tableMap[rowIndex].element.appendChild(newCell);}}
break;case'deletetable':if(!confirm('\u00cates vous s\u00fbr ?'))return false;table.parentNode.removeChild(table);break;case'deleterow':if(!confirm('\u00cates vous s\u00fbr ?'))return false;var rowIndex=cell.rowIndex;var cols=tableMap[rowIndex].length;for(var colIndex=cols-1,colspan=1;colIndex>=0;colIndex-=colspan){var colspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('colSpan'))||1);var rowspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('rowSpan'))||1);if(rowspan<=1)continue;tableMap[rowIndex][colIndex].setAttribute('rowSpan',(rowspan-1));if(tableMap[rowIndex][colIndex].rowIndex!=rowIndex)continue;if(!tableMap[rowIndex+1]||!tableMap[rowIndex+1].element)continue;if((colIndex-1)==colIndex){tableMap[rowIndex+1].element.appendChild(tableMap[rowIndex][colIndex]);continue;}
tableMap[rowIndex+1].element.insertBefore(tableMap[rowIndex][colIndex],tableMap[rowIndex+1][colIndex+1]);}
tableMap[rowIndex].element.parentNode.removeChild(tableMap[rowIndex].element);this.checkEmptyTable(table);break;case'deletecol':if(!confirm('\u00cates vous s\u00fbr ?'))return false;var colIndex=cell.colIndex;var colSpan=(parseInt(cell.getAttribute('colSpan'))||1);colIndex+=(colSpan-1);var rows=tableMap.length;for(var rowIndex=rows-1,rowspan=1;rowIndex>=0;rowIndex-=rowspan){var colspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('colSpan'))||1);var rowspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('rowSpan'))||1);if(colspan<=1){tableMap[rowIndex][colIndex].parentNode.removeChild(tableMap[rowIndex][colIndex]);}
tableMap[rowIndex][colIndex].setAttribute('colSpan',(colspan-1));}
this.checkEmptyTable(table);break;case'mergecellright':rowIndex=cell.rowIndex;colIndex=cell.colIndex;var colspan=(parseInt(cell.getAttribute('colSpan'))||1);if(!tableMap[rowIndex][colIndex+colspan]){this.log('no right cell');return false;}
cellToMerge=tableMap[rowIndex][colIndex+colspan];cellRowspan=(parseInt(cell.getAttribute('rowSpan'))||1);cellToMergeRowspan=(parseInt(cellToMerge.getAttribute('rowSpan'))||1);cellToMergeColspan=(parseInt(cellToMerge.getAttribute('colSpan'))||1);if(cell.rowIndex!=cellToMerge.rowIndex||cellRowspan!=cellToMergeRowspan){alert("Les cellules \u00e0 fusionner doivent commencer sur\n"+"la m\u00eame ligne et se terminer sur la m\u00eame ligne");return false;}
cell.innerHTML+='<br /><br />'+cellToMerge.innerHTML;cellToMerge.parentNode.removeChild(cellToMerge);cell.setAttribute('colSpan',colspan+cellToMergeColspan);break;case'mergecelldown':rowIndex=cell.rowIndex;colIndex=cell.colIndex;var rowspan=(parseInt(cell.getAttribute('rowSpan'))||1);if(!tableMap[rowIndex+rowspan]||!tableMap[rowIndex+rowspan].element||!tableMap[rowIndex+rowspan][colIndex]){this.log('no right cell');return false;}
cellToMerge=tableMap[rowIndex+rowspan][colIndex];cellColspan=(parseInt(cell.getAttribute('colSpan'))||1);cellToMergeRowspan=(parseInt(cellToMerge.getAttribute('rowSpan'))||1);cellToMergeColspan=(parseInt(cellToMerge.getAttribute('colSpan'))||1);if(cell.colIndex!=cellToMerge.colIndex||cellColspan!=cellToMergeColspan){alert("Les cellules \u00e0 fusionner doivent commencer sur\n"+"la m\u00eame colonne et se terminer sur la m\u00eame colonne");return false;}
cell.innerHTML+='<br /><br />'+cellToMerge.innerHTML;cellToMerge.parentNode.removeChild(cellToMerge);cell.setAttribute('rowSpan',rowspan+cellToMergeRowspan);break;case'splitcellhorizontal':var rowIndex=cell.rowIndex;var rowspan=(parseInt(cell.getAttribute('rowSpan'))||1);var newLine=this.doc.createElement('tr');cell.parentNode.parentNode.insertBefore(newLine,cell.parentNode);for(var colIndex=0,cols=tableMap[rowIndex].length,colspan=0;colIndex<cols;colIndex+=colspan){if(!tableMap[rowIndex]||!tableMap[rowIndex][colIndex]){colspan=1;continue;}
var rowspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('rowSpan'))||1);var colspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('colSpan'))||1);if(tableMap[rowIndex][colIndex]==cell){var newCell=this.doc.createElement('td');newCell.appendChild(this.doc.createTextNode('\u00a0'));newCell.setAttribute('colSpan',colspan);newLine.appendChild(newCell);continue;}
tableMap[rowIndex][colIndex].setAttribute('rowSpan',rowspan+1);if(tableMap[rowIndex][colIndex].rowIndex==rowIndex){newLine.appendChild(tableMap[rowIndex][colIndex]);}}
break;case'splitcellvertical':var colIndex=cell.colIndex;var colspan=(parseInt(cell.getAttribute('colSpan'))||1);if(colspan>1){var cellColspan=Math.round(colspan/2);var newCellColspan=colspan-cellColspan;var newCell=this.doc.createElement('td');newCell.appendChild(this.doc.createTextNode('\u00a0'));newCell.setAttribute('colSpan',newCellColspan);cell.setAttribute('colSpan',cellColspan);cell.parentNode.insertBefore(newCell,cell);return true;}
for(var rowIndex=0,rows=tableMap.length,rawspan=0;rowIndex<rows;rowIndex+=rowspan){if(!tableMap[rowIndex]||!tableMap[rowIndex][colIndex]){rowspan=1;continue;}
var rowspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('rowSpan'))||1);var colspan=(parseInt(tableMap[rowIndex][colIndex].getAttribute('colSpan'))||1);if(tableMap[rowIndex][colIndex]==cell){var newCell=this.doc.createElement('td');newCell.appendChild(this.doc.createTextNode('\u00a0'));newCell.setAttribute('rowspan',rowspan);cell.parentNode.insertBefore(newCell,cell);continue;}
tableMap[rowIndex][colIndex].setAttribute('colSpan',colspan+1);}
break;case'celltoth':case'celltotd':var nodeName=cell.nodeName.toLowerCase();if(nodeName=='td'&&command=='celltotd')return true;if(nodeName=='th'&&command=='celltoth')return true;var rowspan=(parseInt(cell.getAttribute('rowSpan'))||1);var colspan=(parseInt(cell.getAttribute('colSpan'))||1);var innerHTML=cell.innerHTML;var newCell=this.doc.createElement(command=='celltoth'?'th':'td');newCell.setAttribute('rowSpan',rowspan);newCell.setAttribute('colSpan',colspan);newCell.innerHTML=innerHTML;cell.parentNode.replaceChild(newCell,cell);break;}
return true;},createLink:function(a){var selection=this.getSelection();var range=this.createRange(selection);if(typeof a=='undefined'){a=range.getSelectedElement();while(a&&a.nodeName.toLowerCase()!='a'){a=a.parentNode;}
if(!a||a.nodeName.toLowerCase()!='a'){a=null;}}
if(a){var url=prompt(lang_link_address,(typeof a.href!='undefined'?a.href:'http://'));if(!url)return false;a.href=url;return url;}
if(Prototype.Browser.IE){return this.doc.execCommand("createlink");}
url=null;selectedText=range.getSelectedText();if((matches=selectedText.match(BBW.pattern('URL')))!=null){url=matches[0];if(matches[1]=='www.')url='http://'+url;if(matches[1]=='ftp.')url='ftp://'+url;}
if(!url)url=prompt(lang_link_address,'http://');if(!url)return false;if(selectedText==''&&this.getElementsBySelector(range.getSelectedElement(),'img').length<1){range.insertNode(this.doc.createTextNode(url));range.selectNode(node);}
this.doc.execCommand("createlink",false,url);range.collapse(false);},setFontSize:function(optionSize){if(!optionSize){var list=document.getElementById('addbbcode'+this.bbcodearea_id+'_size');var optionSize=list.options[list.selectedIndex].value;var size=1;}
for(var i=7;i>0;i--){if(optionSize>=BBW.fontSize['px'][i]){size=i;break;}}
this.doc.execCommand('FontSize',false,size);},forceRedraw:function(){this.doc.body.style.visibility="hidden";this.doc.body.style.visibility="visible";},insertImage:function(url){this.focusEditor();this.forceRedraw();this.focusEditor();var selection=this.getSelection();var range=this.createRange(selection);img=null;if(!range.collpased){img=range.getSelectedElement();if(img&&img.nodeName.toLowerCase()!='img'){}
if(img.nodeName.toLowerCase()!='img'){img=null;}}
if(!img){var url=(url||prompt(lang_img_address,'http://'));if(!url){return false;}
this.doc.execCommand("insertImage",false,url);}else{var url=(url||prompt(lang_img_address,img.src));if(!url){return false;}
img.src=url;}
range.collapse(false);},insertBBCode:function(openTag,closeTag,HTMLTag,selection,range){this.focusEditor();if(!HTMLTag)HTMLTag='span';var container=this.doc.createElement(HTMLTag);container.appendChild(this.doc.createTextNode(openTag));closeNode=this.doc.createTextNode(closeTag);if(!selection)selection=this.getSelection();if(!range)range=this.createRange(selection);selectedText=range.getSelectedText();range.applyNode(container,closeNode);if(Prototype.Browser.IE){if(selectedText==''&&openTag!='')range.move('character',closeTag.length*-1);range.select();}else{range.selectNode(closeNode);if(Prototype.Browser.Opera){selection.collapse(closeNode,((selectedText==''&&openTag!='')?0:closeTag.length));}else{range.collapse((selectedText==''&&openTag!=''));}
this.focusEditor(true);}},insertMedia:function(type){var sel=this.getSelection();var range=this.createRange(sel);var src=range.getSelectedText();if(!src){var src=prompt(lang_media_address,"http://");}
if(!src)return;if(type=='flash'){var node=this.doc.createTextNode('[flash width= height= loop=]'+src+'[/flash]')}else{var node=this.doc.createTextNode('[media]'+src+'[/media]');}
range.replaceContents(node);range.collapse(false);},escapeHTML:function(str){var self=arguments.callee;if(!self.text){self.div=this.doc.createElement('div');self.text=self.div.appendChild(this.doc.createTextNode(''));}
if(Prototype.Browser.IE){self.text.data=str.replace(BBW.pattern('lineBreak'),'-PrOtOtYpE LiNeFeEd-');return self.div.innerHTML.replace(/-PrOtOtYpE LiNeFeEd-/g,"\r\n");}else{self.text.data=str;return self.div.innerHTML;}},getElementsBySelector:function(root,selector){return Element.getElementsBySelector(root,selector);},findSmileyCode:function(URL){if(typeof smilies=='undefined')return false;for(i in smilies){if(URL=='http://img'+smilies[i].s+'.xooimage.com/files'+smilies[i].u)return smilies[i].c;};return false;},smiliesPass:function(str){if(typeof smilies_sorted=='undefined')return str;if(!this.smilies_patterns){this.smilies_patterns=[];for(var i=0,l=smilies_sorted.length;i<l;i++){if(smilies[smilies_sorted[i]]['c'].length<1){continue;}
var pattern=new RegExp('(\\W)'+RegExp_quote(smilies[smilies_sorted[i]]['c'])+'(\\W)','g');var replacement='$1<img src="http://img'+smilies[smilies_sorted[i]]['s']+'.xooimage.com/files'+
smilies[smilies_sorted[i]]['u']+'" />$2';this.smilies_patterns.push([pattern,replacement]);}}
str=' '+str+' ';for(var i=0,l=this.smilies_patterns.length;i<l;i++){str=str.replace(this.smilies_patterns[i][0],this.smilies_patterns[i][1]);}
str=str.strip();return str;},fontSizeToHTMLSize:function(str){if(Prototype.Browser.WebKit){str=str.replace(/^-webkit-x/,'');switch(str){case'xx-small':case'x-small':case'small':case'medium':case'large':case'x-large':case'xx-large':return str;}}
switch(str){case'xx-small':return 1;case'x-small':return 2;case'small':return 3;case'medium':return 4;case'large':return 5;case'x-large':return 6;case'xx-large':return 7;}
var unit='px';if(/em$/i.test(str)){unit='em';}
if(/pt$/i.test(str)){unit='pt';}
size=1;str=parseInt(str);for(var i=7;i>0;i--){if(str>=BBW.fontSize[unit][i]){size=i;break;}}
if(Prototype.Browser.WebKit){return BBW.fontSize['css'][size];}
return size;},nodeToBBCode:function(node,previousNode){return this._nodeToBBCode(node,previousNode);},_nodeToBBCode:function(node,previousNode){var bbcode='';var closetags='';if(node.nodeType==3){var data=node.data;data=data.replace(BBW.pattern('junkChars'),' ');data=data.replace(BBW.pattern('lineBreak'),'');bbcode+=data;}else if(typeof node.nodeName!='undefined'){nodeName=node.nodeName.toLowerCase();switch(nodeName){case'sup':case'sub':case'del':bbcode+='['+node.nodeName.toLowerCase()+']';closetags='[/'+node.nodeName.toLowerCase()+']'+closetags;break;case'img':if(typeof node.src=='undefined'||!node.src){break;}
if((smileyCode=this.findSmileyCode(node.src))!=false){bbcode+=' '+smileyCode+' ';break;}
bbcode+='[img]'+node.src+'[/img]';break;case'embed':if(typeof node.src=='undefined'||!node.src){break;}
if(typeof node.type!='undefined'&&node.type.indexOf('flash')>-1){var width=(typeof node.width!='undefined'?node.width:'');var height=(typeof node.height!='undefined'?node.height:'');var loop=(typeof node.loop!='undefined'?node.loop:'');bbcode+='[flash width='+width+' height='+height+' loop='+loop+']';bbcode+=node.src;closetags+='[/flash]';}else{bbcode+='[media]'+node.src+'[/media]';}
break;case'a':if(typeof node.href=='undefined'||!node.href){break;}
if((node.innerHTML+'')!=''&&(node.innerHTML.unescapeHTML()+'').indexOf(node.href.unescapeHTML()+'')==0){break;}
bbcode+='[url='+node.href+']';closetags='[/url]'+closetags;break;case'ul':bbcode+='[list]';closetags='[/list]'+closetags;break;case'ol':bbcode+='[list=1]';closetags='[/list]'+closetags;break;case'li':bbcode+='[*]';break;case'hr':bbcode+='[hr]';break;case'br':try{if(node.className=='webkit-block-placeholder')break;}catch(e){};bbcode+="\n";break;case'blockquote':case'pre':username=(new Element.ClassNames(node)).toString();if(username=='code'||nodeName=='pre'){bbcode+='[code]';closetags='[/code]'+closetags;}else{bbcode+='[quote'+(username?'="'+username+'"':'')+']';closetags='[/quote]'+closetags;}
case'p':case'div':var align=node.getAttribute('align');if(!align&&Prototype.Browser.WebKit){align=(node.style['textAlign']||'');}
if(align&&(align=='left'||align=='right'||align=='center'||align=='justify')){bbcode+='['+align+']';closetags='\u00a0[/'+align+']'+closetags;}else{if(node.innerHTML==''||node.innerHTML.replace(/ /g,'')==''){if(!previousNode||typeof previousNode.nodeName=='undefined'){break;}
var nodeNameLowerCase=previousNode.nodeName.toLowerCase();if(nodeNameLowerCase!='p'&&nodeNameLowerCase!='div'){break;}}
if(previousNode&&typeof previousNode.nodeName!='undefined'){var align=previousNode.getAttribute('align');if(align=='left'||align=='right'||align=='center'||align=='justify'){break;}
if(Prototype.Browser.WebKit){align=(previousNode.style['textAlign']||'');if(align=='left'||align=='right'||align=='center'||align=='justify'){break;}}
var nodeNameLowerCase=previousNode.nodeName.toLowerCase();if(nodeNameLowerCase!='p'&&nodeNameLowerCase!='div'){var fc=null;for(var fci=0,fcl=node.childNodes.length;fci<fcl;++fci){if(node.childNodes[fci].nodeType==1){fc=node.childNodes[fci];break;}}
if(fc&&(fc.nodeName.toLowerCase()=='ul'||fc.nodeName.toLowerCase()=='ol')){break;}
bbcode+="\n";}}
closetags="\n"+closetags;}
break;case'table':case'tr':case'th':case'td':var argsStr='';for(var i=0,l=BBW.tableArgs.length;i<l;++i){var key=BBW.tableArgs[i];if(value=(node.getAttribute(key)||'').toString().replace(BBW.pattern('argCleanup'),'')){argsStr+=' '+key+'="'+value+'"';}}
bbcode+='['+nodeName+argsStr+']';closetags='[/'+nodeName+']'+closetags;break;case'b':case'strong':bbcode+='[b]';closetags='[/b]'+closetags;break;case'i':case'em':bbcode+='[i]';closetags='[/i]'+closetags;break;case'u':bbcode+='[u]';closetags='[/u]'+closetags;break;case's':case'strike':bbcode+='[del]';closetags='[/del]'+closetags;break;case'font':var color=size='';if(size=parseInt(node.getAttribute('size'))){if(BBW.fontSize['px'][size]){bbcode+='[size='+BBW.fontSize['px'][size]+']';closetags='[/size]'+closetags;}}
if(color=(node.getAttribute('color')||'').parseColor().toString()){bbcode+='[color='+color+']';closetags='[/color]'+closetags;}
if((fontFace=(node.getAttribute('face')))){if(fontFace!='default'){bbcode+='[font='+fontFace+']';closetags='[/font]'+closetags;}}
break;case'span':if(!Prototype.Browser.WebKit)break;if(node.style['textDecoration']){if(node.style['textDecoration']=='underline'){bbcode+='[u]';closetags='[/u]'+closetags;}
if(node.style['textDecoration']=='line-through'){bbcode+='[del]';closetags='[/del]'+closetags;}}
if(node.style['verticalAlign']){if(node.style['verticalAlign']=='super'){bbcode+='[sup]';closetags='[/sup]'+closetags;}
if(node.style['verticalAlign']=='sub'){bbcode+='[sub]';closetags='[/sub]'+closetags;}}
if(node.style['fontSize']){var size=$H(BBW.fontSize['css']).find(function(fontSize,pair){if(pair.value==fontSize)return true;}.bind(this,node.style['fontSize'].replace(/^-webkit-x/,'')));if(size){size=(BBW.fontSize['px'][size.key]||'');bbcode+='[size='+size+']';closetags='[/size]'+closetags;}}
break;}}else{}
if(typeof node.nodeName!='undefined'&&node.nodeName.toLowerCase()=='body'){bbcode='';closetags='';}
if(typeof node.childNodes!='undefined'&&node.childNodes){previousNode='';for(var cni=0;cni<node.childNodes.length;cni++){if(Prototype.Browser.IE){if(node.childNodes[cni].parentNode!=node)continue;}
var childNode=node.childNodes[cni];bbcode+=this._nodeToBBCode(childNode,previousNode);if(childNode.nodeType!=3&&typeof childNode.nodeName!='undefined'){previousNode=childNode;}}}
bbcode+=closetags;return bbcode;},BBCodeToHTML:function(bbcode){html=bbcode;closetag='';opentag='';html=this.escapeHTML(html);html=html.replace(/(\[table[^\]]*\])\s*(\[tr[^\]]*\])/ig,'$1$2');html=html.replace(/(\[tr[^\]]*\])\s*(\[(td|th)[^\]]*\])/ig,'$1$2');html=html.replace(/(\[\/(td|th)\])\s*(\[(\/tr|td|th)[^\]]*\])/ig,'$1$3');html=html.replace(/(\[\/tr\])\s*(\[(\/table|tr)[^\]]*\])/ig,'$1$2');html=html.replace(BBW.pattern('lineBreak'),BBW.TAGS.LINE_BREAK);html=html.replace(BBW.pattern('bbcodeLi'),'<li>');html=html.replace(BBW.pattern('htmlScriptSchemes'),'$1&#58;');while(true){var openPos=html.search(BBW.pattern('bbcodeOpen'));if(openPos<0){break;}
var m=html.match(BBW.pattern('bbcodeOpen'));var openTag=m[0];var tag=m[1];var args=(m[2]||'');var depth=1;var closeTag='[/'+tag+']';var closeTagPattern=new RegExp(RegExp_quote(closeTag),'i');var closePos=html.search(closeTagPattern);if(closePos<0){closeTag='';closetag='';closePos=openPos+openTag.length;}else if(closePos<openPos+openTag.length){closeTag_replace='&#x5B;/'+tag+'&#x5D;';html=html.substr(0,closePos)+closeTag_replace+html.substr(closePos+closeTag.length);continue;}
var contents=html.substr(openPos+openTag.length,closePos-(openPos+openTag.length));tag=BBW.TRANSLATED_BBCODES[tag]||tag;switch(tag){case'color':opentag='<font color="'+(args||'').substr(1).parseColor().toString()+'">';closetag='</font>';break;case'size':if(Prototype.Browser.WebKit){opentag='<span class="Apple-style-span" style="font-size: ';opentag+=this.fontSizeToHTMLSize((args||' ').substr(1));opentag+=';">';closetag='</span>';break;}
opentag='<font size="'+this.fontSizeToHTMLSize((args||' ').substr(1))+'">';closetag='</font>';break;case'font':opentag='<font face="'+this.escapeHTML((args||' ').substr(1))+'">';closetag='</font>';break;case'b':opentag=BBW.TAGS.BOLD_OPEN;closetag=BBW.TAGS.BOLD_CLOSE;break;case'i':opentag=BBW.TAGS.ITALIC_OPEN;closetag=BBW.TAGS.ITALIC_CLOSE;break;case'u':opentag=BBW.TAGS.UNDERLINE_OPEN;closetag=BBW.TAGS.UNDERLINE_CLOSE;break;case's':case'del':opentag=BBW.TAGS.STRIKE_OPEN;closetag=BBW.TAGS.STRIKE_CLOSE;break;case'sup':opentag=BBW.TAGS.SUP_OPEN;closetag=BBW.TAGS.SUP_CLOSE;break;case'sub':opentag=BBW.TAGS.SUB_OPEN;closetag=BBW.TAGS.SUB_CLOSE;break;case'table':case'tr':case'th':case'td':var argsStr='';if(args=args.strip()){args=args.replace(/\s+/g,'&').replace(/%/g,'%25').toQueryParams();for(var key in args){if(!BBW.tableArgs.include(key))continue;argsStr+=' '+key+'="'+this.escapeHTML(args[key].substr(1,args[key].length-2))+'"';}}
if(tag=='table')argsStr+=' unselectable="on"';opentag='<'+tag+argsStr+'>'+BBW.TAGS.BLOCK_OPEN;closetag=BBW.TAGS.BLOCK_CLOSE+'</'+tag+'>';break;case'align':opentag=BBW.TAGS.ALIGN_OPEN.replace(/%s/,(args||' ').substr(1));closetag=BBW.TAGS.ALIGN_CLOSE;break;case'left':case'right':case'center':case'justify':opentag=BBW.TAGS.ALIGN_OPEN.replace(/%s/,tag)+BBW.TAGS.BLOCK_OPEN;closetag=BBW.TAGS.BLOCK_CLOSE+BBW.TAGS.ALIGN_CLOSE;break;case'list':if(args&&args.length>0){opentag='<ol>';closetag='</ol>';}else{opentag='<ul>';closetag='</ul>';}
break;case'hr':opentag='<hr>';closetag='';break;case'img':opentag='<img src="'+contents+'" unselectable="on">';closetag='';contents='';break;case'url':var url=(args&&args.length>1?args.substr(1):contents);opentag='<a href="'+url+'">';closetag='</a>';break;case'code':opentag='<blockquote class="code">'+BBW.TAGS.BLOCK_OPEN;closetag=BBW.TAGS.BLOCK_CLOSE+'</blockquote>';contents=contents.replace(BBW.pattern('leftSquare'),'&#x5B;');contents=contents.replace(BBW.pattern('rightSquare'),'&#x5D;');contents=contents.replace(/\s/g,'&nbsp;');break;case'quote':var quote_username=this.escapeHTML(args.substr(2,args.length-3));quote_username=quote_username.replace(BBW.pattern('leftSquare'),'&#x5B;');quote_username=quote_username.replace(BBW.pattern('rightSquare'),'&#x5D;');opentag='<blockquote'+(args?' class="'+quote_username+'"':'')+'>'+BBW.TAGS.BLOCK_OPEN;closetag=BBW.TAGS.BLOCK_CLOSE+'</blockquote>';break;default:opentag='&#x5B;'+tag+(typeof args!='undefined'?args:'')+'&#x5D;';if(closeTag!=''){closetag='&#x5B;/'+tag+'&#x5D;';}}
if(open!=''){html=html.substr(0,openPos)+opentag+contents+closetag+html.substr(closePos+closeTag.length);}}
html=this.smiliesPass(html);html=html.replace(BBW.pattern('uLeftSquare'),'[');html=html.replace(BBW.pattern('uRightSquare'),']')
html=html.replace(BBW.pattern('uEscaped'),'&#');if(Prototype.Browser.IE){html='<P>'+html+'</P>';html=html.replace(BBW.pattern('EmptyLineBreakTag'),'<$1>&nbsp;</$1>');}
if(Prototype.Browser.WebKit){html='<div>'+html+'</div>';html=html.replace(BBW.pattern('EmptyLineBreakTag'),'<$1><br class="webkit-block-placeholder"></$1>');}
return html;},getPref:function(pref_name){if(!this.prefs){this.prefs={};var cookies=document.cookie.split(/; /);for(var i=0,l=cookies.length;i<l;i++){if(cookies[i].indexOf('x_editor_prefs=')==0){eval('var '+unescape(cookies[i])+';');this.prefs=x_editor_prefs;break;}}}
return(this.prefs[pref_name]||'');},setPref:function(pref_name,pref_value){var prefs=(this.prefs||{});prefs[pref_name]=pref_value;var data=Object.toJSON(prefs);var expires=new Date();expires.setTime(expires.getTime()+(3600*24*365*1000));document.cookie='x_editor_prefs='+escape(data)+'; '
+'expires='+expires.toGMTString()+'; '
+'path=/; domain='+document.location.hostname;},log:function(str){try{console.log(str);}catch(e){};},dir:function(obj){try{console.dir(obj);}catch(e){};},time:function(str){try{console.time(str);}catch(e){};},timeEnd:function(str){try{console.timeEnd(str);}catch(e){};},operaAntiScrollTopValue:0,operaAntiScrollTop:function(){if(!Prototype.Browser.Opera)return;if(this.operaAntiScrollTopValue>0)document.body.scrollTop=this.operaAntiScrollTopValue;this.operaAntiScrollTopValue=document.body.scrollTop;},ieAntiDocWriteToHistory:function(){var self=arguments.callee;if(self.alreadyLoaded){}else{self.alreadyLoaded=true;}}};RegExp_quote_pattern=['(\\[|\\]|\\\\|\\/|\\.|\\$|\\(|\\)|\\{|\\}|\\^|\\?|\\*|\\+|\\-|\\|)','g'];RegExp_quote=function(str){if(RegExp_quote_pattern instanceof Array){RegExp_quote_pattern=new RegExp(RegExp_quote_pattern[0],RegExp_quote_pattern[1]);}
return str.replace(RegExp_quote_pattern,'\\$1');};
