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;this.scrolled=false;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="124px";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)+10)+"px";if(globalChatHandle&&globalChatHandle.hasShown){h.height=(d.h-40<211?211:d.h-40)+"px";if(!this.scrolled){setTimeout(function(){globalChatHandle.scrollHistoryToBottom();},200);this.scrolled=true;}}else{h.height=(d.h<251?251:d.h)+"px";if(this.scrolled){this.scrolled=false;}}decps.height=(parseInt(w.h)-184-249)>0?(parseInt(w.h)-184-249)+"px":"0px";}catch(e){;}}};LIM.domReady(function(){if(document.body.getAttribute("type")=="leaveMessage"){return;}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"});map.push({"id":"language","key":"select"});map.push({"id":"msn","key":"add_msn_contact"});map.push({"id":"qq","key":"add_qq_contact"});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();};loadCss(getServerPrefix()+"chatClient/version2/style/structure.css");XHR.get({type:"get",url:document.location.protocol+"//"+LIM.config.chatDirDomains+"/localzition/"+language+".xml",timeout:20000,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 startChat=function(){try{var js=document.getElementById("chatbox:js");if(!js){window.live800Loaded=true;new XHR.script(getServerPrefix()+"chatClient/version2/scripts/chatbox.imjs","chatbox:js",function(){LIM.initChatbox();LIM.chatClientStarted=true;});loadCss(getServerPrefix()+"chatClient/version2/style/theme/"+LIM.config.skin+"/skin.css");LIM.markEl.style.width="219px";$("loading").style.display="none";$("chatwrap").style.display="block";if(typeof(isIE6)!="undefined"&&isIE6&&LIM.config.skin!="2011"){loadCss("version2/style/fix.jsp?s="+LIM.config.skin);}}}catch(e){setTimeout(startChat,50);}};if(!LIM.chatClientStarted){startChat();}},onError:function(){throw"Load local resources has Error!";}});};LIM.refresh(lang);function loadCss(url){var head=document.getElementsByTagName("head")[0],link=document.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=url;head.appendChild(link);}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){}};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();};var isValidated=false;function loadValidate(){try{if(LIM.config.preChatConfigContent.indexOf("pre_chat_box=1")>-1||(LIM.config.robot.enabled&&LIM.config.robot.priority)){LIM.suspendChat=true;return;}var $=LIM.$element,track=$('track');if(track&&track.complete){var trackId=(track.offsetHeight<<8)+track.offsetWidth;if(!isValidated)XHR.get({type:"get",url:"validate.jsp"+window.location.search+"&trackId="+trackId+"&t="+(new Date()).getTime(),timeout:20000,onSuccess:function(data){var dom=data,status=dom.getElementsByTagName("status"),rs=status[0].firstChild.nodeValue;LIM.validateResult=rs;}});isValidated=true;}else{setTimeout(loadValidate,20);}}catch(e){setTimeout(loadValidate,20);}};loadValidate();
