var Effect=function(){this.$=LIM.$element;this.addEvent=LIM.addEvent;this.getEventSrc=LIM.getEventSrc;this.init();};Effect.getStyle=function(el,name){if(el.style[name])return el.style[name];else if(el.currentStyle)return el.currentStyle[name];else if(document.defaultView&&document.defaultView.getComputedStyle){name=name.replace(/([A-Z])/g,"-$1");name=name.toLowerCase();var s=document.defaltView.getComputedStyle(el,"");return s&&s.getPropertyValue(name);}else return null;};Effect.fadeIn=function(el){var el=el,s=el.style,op,timer,base=40,filter=el.currentStyle.filter;if(!el.opacity)el.opacity=0;op=parseInt(el.opacity);s.opacity="."+(base+op);if(el.opacity<50){op++;el.opacity=op;clearTimeout(el.outTimer);var ef=this;el.inTimer=setTimeout(function(){ef.fadeIn(el);},20);}};Effect.fadeOut=function(el){var el=el,s=el.style,op,timer,base=90;if(!el.opacity)el.opacity=0;op=parseInt(el.opacity);s.opacity="."+(base-op);if(el.opacity<50){op++;el.opacity=op;clearTimeout(el.inTimer);var ef=this;el.outTimer=setTimeout(function(){ef.fadeOut(el);},20);}};Effect.prototype={init:function(){this.menuItemHover();this.enterButton();this.decorativeEffect();this.hideTop();this.hideRight();var l=this;setInterval(function(){l.lockInterface();},100);},menuItemHover:function(){var l=this.$('toolsbar').getElementsByTagName("li"),item;for(var i=0;i<l.length;i++){item=l[i];this.addEvent(item,"mouseover",function(e){var item=$eventSrc(e);item=(item.tagName.toUpperCase()=="LI")?item:item.parentNode;var sp=item.getElementsByTagName("span");item.className+=" hover";if(document.all&&sp[0])sp[0].style.left=window.event.clientX-10+"px";});this.addEvent(item,"mouseout",function(e){var item=$eventSrc(e);item=(item.tagName.toUpperCase()=="LI")?item:item.parentNode;var sp=item.getElementsByTagName("span");item.className=item.className.replace(new RegExp("(^|\\s)hover(\\s|$)"),"");if(document.all&&sp[0])sp[0].style.left=window.event.clientX-10+"px";});}},enterButton:function(){var $=LIM.$class,s=$("shortcut",this.$("entry-bar"))[0];this.addEvent(s,"mouseover",function(e){var i=$eventSrc(e);var el=i.parentNode,c=el.className;el.className=c.replace(/normal/g,"hover");});this.addEvent(s,"mouseout",function(e){var i=$eventSrc(e);var el=i.parentNode,c=el.className;el.className=c.replace(/hover/g,"normal");});},decorativeEffect:function(){},hideTop:function(){var $=LIM.$class,d2=$('decorative2')[0],t=$('arrow',d2)[0],head=$('head')[0];this.addEvent(d2,"click",function(e){var i=t,s=head.style;if(s.display!="none"){s.display="none";d2.style.top=0;i.className=i.className.replace(/top/,"down");}else{s.display="block";d2.style.top="39px";i.className=i.className.replace(/down/,"top");}});},hideRight:function(){var $=LIM.$class,d3=$('decorative3')[0],r=$('arrow',d3)[0],banner=this.$('banner');this.addEvent(d3,"click",function(e){var i=r,b=banner.style;if(b.display!="none"){b.display="none";d3.style.right=0;i.className=i.className.replace(/right/,"left");}else{b.display="block";d3.style.right="128px";i.className=i.className.replace(/left/,"right");}});},lockInterface:function(){try{var $=LIM.$class,s=$('head')[0].style,b=this.$('banner').style,h=this.$('history').style,w={},d={},bs=document.body.style;w.h=window.innerHeight||document.documentElement.clientHeight,w.w=window.innerWidth||document.documentElement.clientWidth;var dec=$('decorative3')[0],decps=dec.getElementsByTagName("p")[0].style;bs.width=w.w<570?(570+"px"):"100%";bs.height=w.h<424?(424+"px"):"100%";if(s.display=="none"){d.h=parseInt(w.h)-145;d.t=0;}else{d.h=parseInt(w.h)-173;d.t=39;}if(b.display=="none"){d.w=parseInt(w.w)-11;}else{d.w=parseInt(w.w)-140;}h.top=d.t+"px";h.width=(d.w<430?430:d.w)+"px";h.height=(d.h<251?251:d.h)+"px";decps.height=(parseInt(w.h)-184-249)>0?(parseInt(w.h)-184-249)+"px":"0px";}catch(e){;}}};LIM.domReady(function(){var $=LIM.$element;$.c=LIM.$class;LIM.refresh=function(l){var language=l||lang;var r=[];function replaceMenuItemText(){var map=[];map.push({"id":"save","key":"save"});map.push({"id":"file","key":"file"});map.push({"id":"activex","key":"active"});map.push({"id":"emotion","key":"emotion"});map.push({"id":"callback","key":"dialback"});map.push({"id":"switch","key":LIM.soundon?"sound_on":"sound_off"});map.push({"id":"jumper","key":"jumper_service"});map.push({"id":"evaluation","key":"evaluation"});map.push({"id":"exitChat","key":"exit_chat"});for(var i=0;i<map.length;i++){$(map[i].id).setAttribute('title',r[map[i].key]);}};function replaceOtherText(){$("enter").innerHTML=r["send_button"];$('exitChat').innerHTML=r["exit_chat"];if(typeof globalChatHandle=="undefined"){return;}var _lis=$('shortKeyMenu').getElementsByTagName("li");if(globalChatHandle.sendButtonShortcut=="Enter"){$('shortKeyTip').innerHTML=r.shortkey1;_lis[0].innerHTML=r.shortkey1+" *";_lis[1].innerHTML=r.shortkey2;}else{$('shortKeyTip').innerHTML=r.shortkey2;_lis[0].innerHTML=r.shortkey1;_lis[1].innerHTML=r.shortkey2+" *";}$('shortKeyTip').innerHTML+=":";if(globalChatHandle.chatStatus=="WAIT"){$('headerBox').innerHTML=r.towaitre;$('footerBox').innerHTML="";}if(globalChatHandle.chatStatus=="CHAT"||globalChatHandle.chatStatus=="INSTANT"){$("headerBox").innerHTML=r.italking.replace(/xx/g,globalChatHandle.operatorName);$("footerBox").innerHTML="";}if(globalChatHandle.chatStatus=="END"){$("headerBox").innerHTML=r.dialogovered;$("shortKeyTip").innerHTML=r.dialogovered;$("footerBox").innerHTML="";}};function changeText(){replaceMenuItemText();replaceOtherText();};XHR.get({type:"get",url:"localzition/"+language+".xml",onSuccess:function(data){function iterator(s){var n=s.childNodes,l=n.length,item;for(var i=0;i<l;i++){item=n.item(i);if(item.hasChildNodes())r[item.nodeName]=item.text||item.firstChild.nodeValue;}}var t=data.getElementsByTagName("text_res")[0],l=data.getElementsByTagName("language")[0];iterator(t);iterator(l);LIM.localRes=r;changeText();},onComplete:function(){var url="version2/scripts/chatbox.js";if(typeof globalChatHandle=="undefined"){new XHR.script(url,null,function(){LIM.initChatbox();});}},onError:function(){throw"Load local resources has Error!";}});};LIM.refresh(lang);new Effect();});function getAllEmotion(xml){try{var nodes=xml.getElementsByTagName("item"),length=nodes.length;var imgPath=xml.getElementsByTagName("server-path")[0].firstChild.nodeValue;if(!/https?:\/\//.test(imgPath)){imgPath="http://"+LIM.config["chatDirDomains"]+"/"+imgPath;}var emotions=[],node;for(var i=0;i<length;i++){node=nodes[i];emotions.push({"name":node.getAttribute("name"),"title":node.getAttribute("title"),"small":imgPath+node.getElementsByTagName("small")[0].firstChild.nodeValue,"normal":imgPath+node.getElementsByTagName("normal")[0].firstChild.nodeValue});}return emotions;}catch(e){alert(e);}};function createEmotion(emotions){var el=$('emotionsBox');var em;var html="";for(var i=0;i<emotions.length;i++){em=emotions[i];html+="<span title='"+em.title+"'><img src='"+em.small+"' normal='"+em.normal+"' onclick='addEmotion(this);'/></span>";}el.innerHTML=html;};function addEmotion(img){if(globalChatHandle.chatStatus=="ROBOT"){return}var editor=frames['inputbox'];editor.document.body.innerHTML+="<img src='"+img.getAttribute("normal")+"'/>";editor.focus();};