document.write("<style type=\"text/css\" media=\"screen\"><!-- @import \""+css_path+"screen/bbtageditor.css\"; --></style>");
function BBEditor(_1,_2,_3,_4,_5,_6){
if(this.dom){
this.boxId=_1;
this.toolbarId=_2;
this.toolbarEnabled=true;
this.smileyBoxId=_3;
this.smileyEnabled=true;
this.editorType=_4;
this.editor=document.getElementById(_5);
this.editorId=_5;
this.delayEnable=_6;
if(!_6){
this.editor.className="BBEtext";
}else{
this.editor.className="BBEtextDisabled";
}
}
}
BBEditor.prototype={boxId:"",btnMoreSrc:"bbe_btn_more.gif",btnFewerSrc:"bbe_btn_fewer.gif",delayEnable:false,dom:document.getElementById?true:false,editorId:"",editorType:"",iconSrcFolder:"./icons/",selectedText:"",smileyEnabled:false,smileyBoxId:"",smiliesOpened:false,smileyOpenWidth:200,smileySrcFolder:"",tags:{bold:"b",italic:"i",quote:"quote",link:"url",localLink:"link",emailLink:"email",image:"img",font:"font",fontSize:"size",fontColor:"color"},toolbarEnabled:false,toolbarId:"",toggleSrcFolder:"./icons/",type:"simple",doCode:function(_7){
this.selectedText=this.getSelection(this.editorId);
switch(_7){
case this.tags.quote:
this.insertQuote();
break;
case this.tags.link:
this.insertLink();
break;
case this.tags.localLink:
this.insertLink(true);
break;
case this.tags.font:
this.insertFont();
break;
default:
this.putSimpleTags(_7);
break;
}
},getSelection:function(){
if(this.editor.setSelectionRange){
return this.editor.value.substring(this.editor.selectionStart,this.editor.selectionEnd);
}else{
if(document.selection.createRange){
return document.selection.createRange().text;
}else{
return "";
}
}
},getSelectedValue:function(_8){
if(typeof (_8)==="string"){
_8=document.getElementById(_8);
}
return _8.options[_8.options.selectedIndex].value;
},getSelectionRange:function(){
if(this.editor.setSelectionRange){
return {begin:this.editor.selectionStart,end:this.editor.selectionEnd};
}
return null;
},insertFont:function(){
var _9=this.getSelectedValue("sel_"+this.editorId+"_font");
var _a=this.getSelectedValue("sel_"+this.editorId+"_size");
var _b=this.getSelectedValue("sel_"+this.editorId+"_color");
var _c="",_d=this.getSelection(),_e="";
var _f=[],_10=[];
var _11=this.getSelectionRange();
if(_9!==""){
_f[_f.length]="["+this.tags.font+"="+_9+"]";
_10[_10.length]="[/"+this.tags.font+"]";
}
if(_a!==""){
_f[_f.length]="["+this.tags.fontSize+"="+_a+"]";
_10[_10.length]="[/"+this.tags.fontSize+"]";
}
if(_b!==""){
_f[_f.length]="["+this.tags.fontColor+"="+_b+"]";
_10[_10.length]="[/"+this.tags.fontColor+"]";
}
_c=_f.join("");
for(var i=_10.length-1;i>-1;i--){
_e+=_10[i];
}
if(_c!==""){
this.insertText(_c+_d+_e);
this.setCursorPosition(_11,this.getSelectionRange(),_c,_d,_e);
}
this.editor.focus();
},insertLink:function(_13){
var _14=_13?this.tags.localLink:this.tags.link;
var _15="";
var _16="[/"+_14+"]";
var _17=this.getSelectionRange();
var _18=false;
var url=prompt("Enter the web address for this link:","http://");
var _1a=this.getSelection();
if(url){
_15="["+_14+"="+url+"]";
}else{
_15="["+_14+"]";
}
if(!_1a){
_1a="";
}
this.insertText(_15+_1a+_16);
this.setCursorPosition(_17,this.getSelectionRange(),_15,_1a,_16,true);
this.editor.focus();
},insertQuote:function(){
var _1b=this.getSelectionRange();
var _1c="["+this.tags.quote,_1d="";
var _1e="[/"+this.tags.quote+"]";
var by="";
var _20=this.getSelection();
var _21=false;
by=prompt("Who is this quote by?","");
by=by?by:"";
if(_20!==""){
_21=true;
}
_1c+=by!==""?"="+by+"]":"]";
if(_20!==""){
_1d=_20;
}
this.insertText(_1c+_1d+_1e);
this.setCursorPosition(_1b,this.getSelectionRange(),_1c,_1d,_1e,_21);
this.editor.focus();
},insertText:function(ins,_23){
var _24=null;
var _25="";
if(this.editor.setSelectionRange){
_24=this.getSelectionRange();
this.editor.value=this.editor.value.substring(0,_24.begin)+ins+this.editor.value.substring(_24.end,this.editor.value.length);
}else{
if(document.selection.createRange){
this.editor.focus();
document.selection.createRange().text=ins;
}
}
},putSimpleTags:function(_26){
var _27="["+_26+"]";
var _28="[/"+_26+"]";
var _29=this.selectedText!==""?this.selectedText:"";
var _2a=this.getSelectionRange();
var _2b=null;
this.insertText(_27+_29+_28);
_2b=this.getSelectionRange();
this.setCursorPosition(_2a,_2b,_27,_29,_28);
this.editor.focus();
},putSmiley:function(_2c){
if(this.smileyEnabled){
var _2d=this.getSelectionRange(),_2e=null;
var _2f=" :"+_2c+": ";
this.insertText(_2f);
this.setCursorPosition(_2d,this.getSelectionRange(),"",_2f,"");
this.editor.focus();
}
},setCursorPosition:function(_30,_31,_32,_33,_34,_35){
var r=null;
if(this.editor.setSelectionRange){
_31.end=_31.begin=_30.begin+_32.length;
if(_33!==""){
_31.end=_31.begin+=_33.length+_34.length;
}
this.editor.setSelectionRange(_31.begin,_31.end);
}else{
if(document.selection.createRange){
this.editor.focus();
r=document.selection.createRange();
if(r.text!==""){
r.move("character",r.text.length);
r.select();
}else{
if(!_35){
r.move("character",_34.length*-1);
r.select();
}
}
}
}
},spawnEditor:function(el){
var box=document.getElementById(this.boxId);
var _39=document.getElementById(this.editorId+"BodyBox");
if(el.innerHTML==="advanced editor"){
box.className="BBEbox "+(this.editorType==="simple"?"BBEboxsimple":"BBEboxfull");
_39.className="BBEtextBox";
this.editor.className="BBEtext";
el.innerHTML="simple editor";
}else{
box.className="BBEboxDisabled";
_39.className="BBEtextBoxDisabled";
this.editor.className="BBEtextDisabled";
el.innerHTML="advanced editor";
}
this.editor.focus();
box=_39=el=null;
},toggleSmilies:function(){
var _3a=null;
if(this.smiliesOpened){
_3a=$(this.editorId+"SmiliesCommon");
_3a.style.display="";
document.getElementById(this.editorId+"SmiliesAll").style.display="";
this.smiliesOpened=false;
}else{
_3a=$(this.editorId+"SmiliesAll");
document.getElementById(this.editorId+"SmiliesCommon").style.display="none";
_3a.style.display="block";
this.smiliesOpened=true;
}
}};

