if(typeof GGConnectInstall=="undefined"){GGConnectInstall={}}Object.extend(GGConnectInstall,{getCurrentVersion:function(){if(this.isIE()){var A=document.createElement("iframe");A.style.display="none";document.body.appendChild(A);A=frames[frames.length-1];A.document.open();A.document.writeln('<script language="VBScript">');A.document.writeln("<!--");A.document.writeln("On error resume next");A.document.writeln('currentVersion = CreateObject("'+GG.config.plugin.activex.className+'").version');A.document.writeln("//-->");A.document.writeln("<\/script>");A.document.close();return A.currentVersion}else{var B=GG.config.plugin.netscape.mimeType;if(typeof navigator.mimeTypes[B]=="undefined"){return undefined}return navigator.mimeTypes[B].description.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)[0]}},getRequiredVersion:function(){if(this.isIE()){return GG.config.plugin.activex.version}else{return GG.config.plugin.netscape[this.isMac()?"versionMac":"version"]}},isIE:function(){return typeof DOMParser=="undefined"&&navigator.userAgent.indexOf("MSIE")!=-1&&navigator.userAgent.indexOf("Win")!=-1},isMac:function(){return/Mac/.match(navigator.platform)},check:function(B){B=B||{};var A=this.getCurrentVersion();var D=this.getRequiredVersion();var E=function(){if(typeof A=="undefined"){return"install"}if(A==D){return"installed"}var G=A.split(".");var F=D.split(".");for(var H=0;H<D.length;H++){if(typeof G[H]!="undefined"&&parseFloat(G[H])>parseFloat(F[H])){return"installed"}}return"upgrade"};var C=E();if(C=="install"){if(B.install){B.install()}return false}else{if(C=="upgrade"){if(B.upgrade){B.upgrade()}return false}else{return true}}},installFirefox:function(B){B=B||{};var D={"InstantAction.com Game Launcher":{URL:GG.config.plugin.urls.xpi,IconURL:"/images/plugin/plugin.png",toString:function(){return this.URL}}};var C=0;var A=setInterval(function(){var E=InstallTrigger.install(D,function(G,F){if(F!=0){if(B.onError){B.onError(F)}}else{if(B.onComplete){B.onComplete()}}});if(E){if(B.onAuthorized){B.onAuthorized()}clearInterval(A)}else{if(C==0){if(B.onUnauthorized){B.onUnauthorized()}}}C++},250)},installIE:function(B){var C=document.getElementById("ggconnect_install_container");C.innerHTML='<object id="ggconnect_install" classid="'+GG.config.plugin.activex.classId+'" codebase="'+GG.config.plugin.urls.cab+"#version="+GG.config.plugin.activex.version.replace(/\./g,",")+'" width="1" height="1"></object>';var A=setInterval(function(){if(typeof document.ggconnect_install.version!="undefined"){clearInterval(A);if(B.onComplete){B.onComplete()}}},250)}});Object.extend(GGConnectInstall,{downloadInstaller:function(B,A){this.setInstallCookie(A);this.logAndRedirect("download",GG.config.plugin.urls[B])},getCookieDomain:function(){return window.location.host.replace(/www(.login)?/g,"")},log:function(C,B){B=B||{};var A=["/logplugin"+C,GG.util.BrowserDetect.OS,GG.util.BrowserDetect.browser,GG.util.BrowserDetect.version];if(B.log){A=A.concat(B.log)}A=A.join("/");return new Ajax.Request(A,B)},logAndRedirect:function(B,A){return this.log(B,{onComplete:function(){window.location=A}})},setInstallCookie:function(B){var A=new Date();A.setTime(A.getTime()+30*24*60*60*1000);document.cookie="pluginInstall="+B+"; expires="+A.toGMTString()+"; domain="+this.getCookieDomain()+"; path=/"},setStatusCookie:function(){var A="installed";GGConnectInstall.check({install:function(){A="install"},upgrade:function(){A="upgrade"}});document.cookie="pluginStatus="+A+"; domain="+this.getCookieDomain()+"; path=/"}})