SEditor=function(C,A){A=A||{};if(typeof C==="string"){var D=document.getElementById(C);if(!D){D=document.createElement("div");D.id=C}A.container=D}else{if(C&&typeof C==="object"&&C.tagName){A.container=C}}A.c_toolbar=document.createElement("div");A.c_editor=document.createElement("div");var B=document.createElement("textarea");B.style.width="100%";B.style.height;if(A.height){B.style.height=A.height}else{B.style.height="200px"}if(A.width){B.style.width=A.width}else{B.style.width="100%"}A.editor=B;this.config=A;this.init()};SEditor.prototype={init:function(){this.loadToolbar();this.render()},loadToolbar:function(){var D=this;var B=D.config.editor;var F=D.config.c_toolbar;for(var E=1;E<=21;E++){var C=new String(E);if(C.length==1){C="0"+C}var A=document.createElement("a");A.style.cursor="pointer";A.id=C;A.innerHTML='<img style="padding:1px" border=0 src="/images/smiles/'+C+'.gif"  align="absmiddle" />';A.onclick=function(){D.setFormatTag("[sm:"+this.id+"]","")};F.appendChild(A)}},getValue:function(){return this.config.editor.value},setValue:function(A){this.config.editor.value=A},render:function(){var A=this.config.editor;var B=this.config.c_editor;var D=this.config.c_toolbar;var C=this.config.container;C.appendChild(D);C.appendChild(B);B.appendChild(A)},setFormatTag:function(C,G){var E=this.config.editor;if(document.selection){var F=document.selection.createRange().text;E.focus();var B=document.selection.createRange();B.text=C+F+G}else{var D=E.textLength;var A=E.selectionStart;var H=E.selectionEnd;if(H==1||H==2){H=D}var K=(E.value).substring(0,A);var J=(E.value).substring(A,H);var I=(E.value).substring(H,D);E.value=K+C+J+G+I;E.focus()}}};