var HabboCounter={init:function(A){this.refreshFrequency=A;this.start();this.lastValue="0"},start:function(){new PeriodicalExecuter(this.onTimerEvent.bind(this),this.refreshFrequency)},onTimerEvent:function(){new Ajax.Request(habboReqPath+"/components/updateHabboCount",{onSuccess:function(A,B){if(B&&typeof B.habboCountText!="undefined"&&this.lastValue!=B.habboCountText&&$("habboCountUpdateTarget")!=null){new Effect.Fade("habboCountUpdateTarget",{duration:0.5,afterFinish:function(){Element.update("habboCountUpdateTarget",B.habboCountText); new Effect.Appear("habboCountUpdateTarget",{duration:0.5})}});this.lastValue=B.habboCountText}}})}};var HabboClientUtils={options:{},init:function(A){HabboClientUtils.options=Object.extend({remoteCallsEnabled:true},A||{});Event.observe(window,"load",resizeWin);Event.observe(window,"error",function(B){Event.stop(B); return true});Event.observe(window,"unload",clearOpener);ensureOpenerIsLoggedIn();addClientUnloadHook();Event.observe(document,"keypress",function(B){if(B.keyCode==Event.KEY_BACKSPACE){Event.stop(B)}})},cacheCheck:function(){if(HabboClientUtils.options.remoteCallsEnabled){new Ajax.Request(habboReqPath+"/cacheCheck",{onComplete:function(A){if(A.responseText=="false"){window.location.href=habboReqPath+"/client?"+new Date().getTime() }}})}},extWrite:function(A){document.write(A)},loaderTimeout:10000,taggingGameLoaderTimeout:15000,showLoader:function(B){var D={height:"1px"};if(!Prototype.Browser.IE){D.visibility="hidden"}$("clientembed").setStyle(D);$("clientembed-loader").show();$("clientembed-loader").addClassName("wait");HabboClientUtils.loaderIdx=B.length; var C=$("clientembed-loader").select("div b").first();HabboClientUtils.timer=window.setInterval(function(){C.innerHTML=B[HabboClientUtils.loaderIdx%B.length];HabboClientUtils.loaderIdx++},800);var E=HabboClientUtils.options.taggingGameEnabled?HabboClientUtils.hideTaggingGameLoader:HabboClientUtils.hideLoader; var A=HabboClientUtils.options.taggingGameEnabled?HabboClientUtils.taggingGameLoaderTimeout:HabboClientUtils.loaderTimeout;HabboClientUtils.loaderTimeoutTimer=window.setTimeout(function(){if(!!HabboClientUtils.timer){window.clearInterval(HabboClientUtils.timer)}if(!!HabboClientUtils.loaderTimeoutTimer){window.clearTimeout(HabboClientUtils.loaderTimeoutTimer) }E.apply([])},A)},hideLoader:function(){$("clientembed-loader").hide();$("clientembed").setStyle({visibility:"visible",height:"540px"})},hideTaggingGameLoader:function(){if(HabboClientUtils.options.taggingGameEnabled){$("clientembed-loader").removeClassName("wait");$("clientembed-loader").addClassName("dimmed"); $$("#clientembed-loader .loading-text").each(Element.hide);$("tagging-game").show()}},clientReady:function(){if(HabboClientUtils.options.taggingGameEnabled){$("show-client").setStyle({display:"block",height:"auto"});$("quit-tagging-game").setStyle({display:"none",height:"1px"});Event.observe($("clientembed-loader").select("a.go-to-client").first(),"click",function(A){Event.stop(A); HabboClientUtils.hideLoader()})}else{this.hideLoader()}},clientPageLog:function(){var B={};var A=determineSWVersion();if(A!="undefined"){B.javascriptVersion=A}B.osVersion=this.determineSimpleOSVersion();if(HabboClientUtils.options.remoteCallsEnabled){new Ajax.Request(habboReqPath+"/clientlog/clientpage",{method:"post",parameters:B}) }},determineSimpleOSVersion:function(){return navigator.platform+"/"+navigator.oscpu},logClientJavascriptError:function(A){var B=A;if(Prototype.Browser.Gecko){B+=" ("+A.fileName+":"+A.lineNumber+")"}if(Prototype.Browser.IE){B+=" ("+A.name+":"+A.message+")"}if(HabboClientUtils.options.remoteCallsEnabled){new Ajax.Request(habboReqPath+"/clientlog/jsexception",{method:"post",parameters:{exceptionMessage:B}}) }}};function resizeWin(){if(!document.all||screen.height>600){if(document.all){document.all["client-topbar"].style.display="block"}else{if(document.getElementById){document.getElementById("client-topbar").style.display="block"}}}if(window.opener!=null){var A=Utils.getPageSize();if(Prototype.Browser.IE){if(typeof document.body.style.maxHeight=="undefined"){A[0]=(screen.width>=990?960:720); A[1]+=35}else{A[0]=(screen.width>=990?990:750);A[1]+=55}}try{window.resizeTo(A[0],A[1])}catch(B){}window.setTimeout(function(){var C=Utils.getPageSize();C[0]=(screen.width>=990?960:720);try{window.resizeBy(C[0]-C[2],C[1]-C[3])}catch(D){}},500)}}function addClientUnloadHook(){if(habboClient==true&&determineSWVersion()!="undefined"){Event.observe(window,"unload",function(){Cookie.erase("habboclient"); new Ajax.Request(habboReqPath+"/account/unloadclient",{parameters:{windowName:HabboClient.windowName},asynchronous:false})})}}function clearOpener(){if(window.opener&&window.opener.openedHabbo){window.opener.openedHabbo=null}}var ClientMessageHandler={call:function(C,B){if(!!C){var A=C.split(/,+/).without("").uniq(); A.each(function(E){if(E.length>0&&typeof ClientMessageHandler[E]=="function"){try{ClientMessageHandler[E].apply(null,[B])}catch(D){}}})}},googleClientKeepAlive:null,googleLastTrackingCall:0,googleEvent:function(A,B){if(window.pageTracker){pageTracker._trackEvent(A,B)}},google:function(B){if(!ClientMessageHandler.googleClientKeepAlive){ClientMessageHandler.googleClientKeepAlive=window.setInterval(function(){var C=new Date().getTime(); if(ClientMessageHandler.googleLastTrackingCall=10){ShockwaveInstallation.removeInstallationCookie(); document.location=habboReqPath+"/client"}},embedInstallationMovie:function(){var B=ShockwaveInstallation.playerVersion==null?"":'';var C=ShockwaveInstallation.playerVersion==null?"":' playerVersion="'+ShockwaveInstallation.playerVersion+'"'; var A=''+B+'\n'; $("swdetection").innerHTML=A},startSwInstallation:function(){$("shockwave-install-button").style.display="none";$("shockwave-install-progressbar").style.display="block";ShockwaveInstallation.embedInstallationMovie()},removeInstallationCookie:function(){if(Cookie.get("shockwave_install")){Cookie.erase("shockwave_install") }}};function determineSWVersion(){if(navigator.plugins){navigator.plugins.refresh(false)}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-director"]&&navigator.mimeTypes["application/x-director"].enabledPlugin){if(navigator.plugins&&navigator.plugins["Shockwave for Director"]&&(tVersionIndex=navigator.plugins["Shockwave for Director"].description.indexOf("."))!=-1){return navigator.plugins["Shockwave for Director"].description.substring(tVersionIndex-2,tVersionIndex+2) }}else{try{var A=new ActiveXObject("SWCtl.SWCtl");if(A){return A.ShockwaveVersion("")}}catch(B){}}return"undefined"};