function showFace(E,D){var F=$("face_bg");if(F){F.parentNode.removeChild(F)}F=document.createElement("div");F.id="face_bg";F.style.position="absolute";F.style.left=F.style.top="0px";F.style.width="100%";F.style.height=document.body.scrollHeight+"px";F.style.backgroundColor="#000";F.style.zIndex=10000;F.style.display="none";F.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0,finishOpacity=100,style=0)";F.style.opacity=0;F.onclick=function(){$(E+"_menu").style.display="none";$("face_bg").style.display="none"};$("append_parent").appendChild(F);if($(E+"_menu")!=null){$(E+"_menu").style.display=""}else{var C=document.createElement("div");C.id=E+"_menu";C.className="facebox";C.style.position="absolute";var B=document.createElement("ul");for(i=1;i<31;i++){var A=document.createElement("li");A.innerHTML='<img src="image/face/'+i+'.gif" onclick="insertFace(\''+E+"',"+i+", '"+D+'\')" style="cursor:pointer; position:relative;" />';B.appendChild(A)}C.appendChild(B);$("append_parent").appendChild(C)}setMenuPosition(E,0);F.style.display=""}function insertFace(C,D,B){var A="[em:"+D+":]";if($(B)!=null){insertContent(B,A)}$(C+"_menu").style.display="none";$("face_bg").style.display="none"}function textCounter(D,E,C){var B=strLen(D.value);var A=$(E);if(B>C){D.value=getStrbylen(D.value,C);A.innerHTML="0"}else{A.innerHTML=C-B}if(C-B>0){A.parentNode.style.color=""}else{A.parentNode.style.color="red"}}function getStrbylen(F,A){var B=0;var G=0;var E="";var D=F.split("");for(var C=0;C<D.length;C++){if(C<A&&B+byteLength(D[C])<=A){B+=byteLength(D[C]);G=C+1}}if(F.length>G){E=F.substr(0,G)}else{E=F}return E}function byteLength(A){aMatch=A.match(/[^\x00-\x80]/g);return(A.length+(!aMatch?0:aMatch.length))}function strLen(C){var D=document.charset;var A=0;for(var B=0;B<C.length;B++){A+=C.charCodeAt(B)<0||C.charCodeAt(B)>255?(D=="utf-8"?3:2):1}return A};