function initImgName(){for(var e in emotion.SmilmgName){var t=emotion.SmilmgName[e],o=emotion.SmileyBox[e],i="";if(o.length)return;for(var a=1;a<=t[1];a++)i=t[0],a<10&&(i+="0"),o.push(i=i+a+".gif")}}function initEvtHandler(e){for(var t=$G(e),o=0,i=0;o<t.childNodes.length;o++){var a=t.childNodes[o];1==a.nodeType&&(domUtils.on(a,"click",function(e){return function(){switchTab(e)}}(i)),i++)}switchTab(0),$G("tabIconReview").style.display="none"}function InsertSmiley(e,t){e={src:editor.options.emotionLocalization?editor.options.UEDITOR_HOME_URL+"dialogs/emotion/"+e:e};e._src=e.src,editor.execCommand("insertimage",e),t.ctrlKey||dialog.popup.hide()}function switchTab(e){autoHeight(e),0==emotion.tabExist[e]&&(emotion.tabExist[e]=1,createTab("tab"+e));for(var t=$G("tabHeads").getElementsByTagName("span"),o=$G("tabBodys").getElementsByTagName("div"),i=0,a=t.length;i<a;i++)t[i].className="",o[i].style.display="none";t[e].className="focus",o[e].style.display="block"}function autoHeight(e){var t=dialog.getDom("iframe"),o=t.parentNode.parentNode;switch(e){case 0:t.style.height="380px",o.style.height="392px";break;case 1:t.style.height="220px",o.style.height="232px";break;case 2:t.style.height="260px",o.style.height="272px";break;case 3:t.style.height="300px",o.style.height="312px";break;case 4:t.style.height="140px",o.style.height="152px";break;case 5:t.style.height="260px",o.style.height="272px";break;case 6:t.style.height="230px",o.style.height="242px"}}function createTab(e){for(var t,o,i,a,n,s=$G(e),l=emotion.SmileyPath+emotion.imageFolders[e],r=(iHeight=35,emotion.imageCss[e]),c=emotion.imageCssOffset[e],m=['<table class="smileytable">'],h=0,g=emotion.SmileyBox[e].length;h<g;){m.push("<tr>");for(var p=0;p<11;p++,h++)(t=emotion.SmileyBox[e][h])?(o=l+t+"?v=1.1",i=p<5.5?0:1,a=c*h*-1-1,n=emotion.SmileyInfor[e][h],m.push('<td  class="'+r+'"   border="1" width="3%" style="border-collapse:collapse;" align="center"  bgcolor="transparent" onclick="InsertSmiley(\''+(l+t).replace(/'/g,"\\'")+"',event)\" onmouseover=\"over(this,'"+o+"','"+i+'\')" onmouseout="out(this)">'),m.push("<span>"),m.push('<img  style="background-position:left '+a+'px;" title="'+n+'" src="'+emotion.SmileyPath+(editor.options.emotionLocalization?'0.gif" width="':'default/0.gif" width="')+'35" height="'+iHeight+'"></img>'),m.push("</span>")):m.push('<td width="3%"   bgcolor="#FFFFFF">'),m.push("</td>");m.push("</tr>")}m.push("</table>"),m=m.join(""),s.innerHTML=m}function over(e,t,o){e.style.backgroundColor="#ACCD3C",$G("faceReview").style.backgroundImage="url("+t+")",1==o&&($G("tabIconReview").className="show"),$G("tabIconReview").style.display="block"}function out(e){e.style.backgroundColor="transparent";e=$G("tabIconReview");e.className="",e.style.display="none"}function createTabList(e){for(var t={},o=0;o<e;o++)t["tab"+o]=[];return t}function createArr(e){for(var t=[],o=0;o<e;o++)t[o]=0;return t}window.onload=function(){editor.setOpt({emotionLocalization:!1}),emotion.SmileyPath=!0===editor.options.emotionLocalization?"images/":"http://img.baidu.com/hi/",emotion.SmileyBox=createTabList(emotion.tabNum),emotion.tabExist=createArr(emotion.tabNum),initImgName(),initEvtHandler("tabHeads")};