if(!this.JSON){JSON=function(){function f(n){return n<10?"0"+n:n}Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};var cx=new RegExp("/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g"),escapeable=new RegExp('/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g'),gap,indent,breaker,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==="string"){return c}return"\\u"+("0000"+(+(a.charCodeAt(0))).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(typeof value.length==="number"&&!(value.propertyIsEnumerable("length"))){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"["+breaker+gap+partial.join(","+breaker+gap)+breaker+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value,rep);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value,rep);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{"+breaker+gap+partial.join(","+breaker+gap)+breaker+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}return{stringify:function(value,replacer,space,linebreak){var i;gap="";indent="";if(space){if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}breaker=typeof linebreak!=="string"?"\n":linebreak}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})},parse:function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+(+(a.charCodeAt(0))).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}()}var goog=goog||{};goog.net=goog.net||{};goog.net.cookies=goog.net.cookies||{};goog.JsType_={UNDEFINED:"undefined"};goog.isDef=function(A){return typeof A!==goog.JsType_.UNDEFINED};goog.net.cookies.set=function(B,J,F,H,D){if(/;=/g.test(B)){throw new Error('Invalid cookie name "'+B+'"')}if(/;/g.test(J)){throw new Error('Invalid cookie value "'+J+'"')}if(!goog.isDef(F)){F=-1}var C=D?";domain="+D:"";var I=H?";path="+H:"";var G;if(F<0){G=""}else{if(F===0){var E=new Date(1970,1,1);G=";expires="+E.toUTCString()}else{var A=new Date(new Date().getTime()+F*1000);G=";expires="+A.toUTCString()}}document.cookie=B+"="+J+C+I+G};goog.net.cookies.get=function(C,G){var F=C+"=";var B=String(document.cookie);for(var H=-1;(H=B.indexOf(F,H+1))>=0;){var D=H;while(--D>=0){var E=B.charAt(D);if(E===";"){D=-1;break}}if(D===-1){var A=B.indexOf(";",H);if(A<0){A=B.length}return B.substring(H+F.length,A)}}return G};goog.net.cookies.remove=function(A,C,B){var D=goog.net.cookies.containsKey(A);goog.net.cookies.set(A,"",0,C,B);return D};goog.net.cookies.getKeyValues_=function(){var C=String(document.cookie);var G=C.split(/\s*;\s*/);var F=[],E=[],B;for(var D=0,A=G[D];D<G.length;D++){B=A.indexOf("=");if(B===-1){F.push("");E.push(A)}else{F.push(A.substring(0,B));E.push(A.substring(B+1))}}return{keys:F,values:E}};goog.net.cookies.getKeys=function(){return goog.net.cookies.getKeyValues_().keys};goog.net.cookies.getValues=function(){return goog.net.cookies.getKeyValues_().values};goog.net.cookies.isEmpty=function(){return(document.cookie.length===0)};goog.net.cookies.getCount=function(){var A=String(document.cookie);if(A===""){return 0}var B=A.split(/\s*;\s*/);return B.length};goog.net.cookies.containsKey=function(B){var A={};return goog.net.cookies.get(B,A)!==A};goog.net.cookies.containsValue=function(C){var B=goog.net.cookies.getKeyValues_().values;for(var A=0;A<B.length;A++){if(B[A]===C){return true}}return false};goog.net.cookies.clear=function(){var B=goog.net.cookies.getKeyValues_().keys;for(var A=B.length-1;A>=0;A--){goog.net.cookies.remove(B[A])}};goog.net.cookies.MAX_COOKIE_LENGTH=3950;Function.prototype.inherits=function(B){function A(){}A.prototype=B.prototype;this.superClass_=B.prototype;this.prototype=new A();this.prototype.constructor=this};var gadgets=gadgets||{};gadgets.error={};gadgets.error.SUBCLASS_RESPONSIBILITY="subclass responsibility";gadgets.error.TO_BE_DONE="to be done";gadgets.log=function(A){if(window.console&&console.log){console.log(A)}else{var B=document.createElement("div");B.className="gadgets-log-entry";B.innerHTML=A;document.body.appendChild(B)}};gadgets.callAsyncAndJoin=function(G,D,A){var E=G.length;var C=[];for(var B=0;B<G.length;B++){var F=function(H){G[H].call(A,function(I){C[H]=I;if(--E===0){D(C)}})};F(B)}};gadgets.Extensible=function(){};gadgets.Extensible.prototype.setDependencies=function(A){for(var B in A){this[B]=A[B]}};gadgets.Extensible.prototype.getDependencies=function(A){return this[A]};gadgets.UserPrefStore=function(){};gadgets.UserPrefStore.prototype.getPrefs=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.UserPrefStore.prototype.savePrefs=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.DefaultUserPrefStore=function(){gadgets.UserPrefStore.call(this)};gadgets.DefaultUserPrefStore.inherits(gadgets.UserPrefStore);gadgets.DefaultUserPrefStore.prototype.getPrefs=function(A){};gadgets.DefaultUserPrefStore.prototype.savePrefs=function(A){};gadgets.GadgetService=function(){};gadgets.GadgetService.prototype.setHeight=function(A,B){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.GadgetService.prototype.setTitle=function(B,A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.GadgetService.prototype.setUserPref=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.IfrGadgetService=function(){gadgets.GadgetService.call(this);gadgets.rpc.register("resize_iframe",this.setHeight);gadgets.rpc.register("set_pref",this.setUserPref);gadgets.rpc.register("set_title",this.setTitle);gadgets.rpc.register("requestNavigateTo",this.requestNavigateTo)};gadgets.IfrGadgetService.inherits(gadgets.GadgetService);gadgets.IfrGadgetService.prototype.setHeight=function(B){if(B>gadgets.container.maxheight_){B=gadgets.container.maxheight_}var A=document.getElementById(this.f);if(A){A.style.height=B+"px"}};gadgets.IfrGadgetService.prototype.setTitle=function(B){var A=document.getElementById(this.f+"_title");if(A){A.innerHTML=B.replace(/&/g,"&amp;").replace(/</g,"&lt;")}};gadgets.IfrGadgetService.prototype.setUserPref=function(F,C,E){var H=this.getGadgetIdFromModuleId(this.f);var G=gadgets.container.getGadget(H);var B=G.getUserPrefs();for(var D=1,A=arguments.length;D<A;D+=2){B[arguments[D]]=arguments[D+1]}G.setUserPrefs(B)};gadgets.IfrGadgetService.prototype.requestNavigateTo=function(A,D){var E=this.getGadgetIdFromModuleId(this.f);var B=this.getUrlForView(A);if(D){var C=JSON.stringify(D);if(C.length>0){B+="&appParams="+encodeURIComponent(C)}}if(B&&document.location.href.indexOf(B)===-1){document.location.href=B}};gadgets.IfrGadgetService.prototype.getUrlForView=function(A){if(A==="canvas"){return"/canvas"}else{if(A==="profile"){return"/profile"}else{return null}}};gadgets.IfrGadgetService.prototype.getGadgetIdFromModuleId=function(A){return parseInt(A.match(/_([0-9]+)$/)[1],10)};gadgets.LayoutManager=function(){};gadgets.LayoutManager.prototype.getGadgetChrome=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.StaticLayoutManager=function(){gadgets.LayoutManager.call(this)};gadgets.StaticLayoutManager.inherits(gadgets.LayoutManager);gadgets.StaticLayoutManager.prototype.setGadgetChromeIds=function(A){this.gadgetChromeIds_=A};gadgets.StaticLayoutManager.prototype.getGadgetChrome=function(B){var A=this.gadgetChromeIds_[B.id];return A?document.getElementById(A):null};gadgets.FloatLeftLayoutManager=function(A){gadgets.LayoutManager.call(this);this.layoutRootId_=A};gadgets.FloatLeftLayoutManager.inherits(gadgets.LayoutManager);gadgets.FloatLeftLayoutManager.prototype.getGadgetChrome=function(C){var A=document.getElementById(this.layoutRootId_);if(A){var B=document.createElement("div");B.className="skinItem";B.style.cssFloat="left";A.appendChild(B);return B}else{return null}};gadgets.Gadget=function(B){this.userPrefs_={};if(B){for(var A in B){if(B.hasOwnProperty(A)){this[A]=B[A]}}}if(!this.secureToken){this.secureToken="john.doe:john.doe:appid:cont:url:0"}};gadgets.Gadget.prototype.getUserPrefs=function(){return this.userPrefs_};gadgets.Gadget.prototype.setUserPrefs=function(A){this.userPrefs_=A;gadgets.container.userPrefStore.savePrefs(this)};gadgets.Gadget.prototype.getUserPref=function(A){return this.userPrefs_[A]};gadgets.Gadget.prototype.setUserPref=function(A,B){this.userPrefs_[A]=B;gadgets.container.userPrefStore.savePrefs(this)};gadgets.Gadget.prototype.render=function(A){if(A){this.appid=A.id.substr(A.id.lastIndexOf("_")+1);gadgets.container.setView(this.view);this.getContent(function(B){A.innerHTML=B})}};gadgets.Gadget.prototype.getContent=function(A){gadgets.callAsyncAndJoin([this.getTitleBarContent,this.getUserPrefsDialogContent,this.getMainContent],function(B){A(B.join(""))},this)};gadgets.Gadget.prototype.getTitleBarContent=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.Gadget.prototype.getUserPrefsDialogContent=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.Gadget.prototype.getMainContent=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.Gadget.prototype.getAdditionalParams=function(){return""};gadgets.IfrGadget=function(A){gadgets.Gadget.call(this,A);this.serverBase_="../../"};gadgets.IfrGadget.inherits(gadgets.Gadget);gadgets.IfrGadget.prototype.GADGET_IFRAME_PREFIX_="remote_iframe_";gadgets.IfrGadget.prototype.CONTAINER="default";gadgets.IfrGadget.prototype.cssClassGadget="gadgets-gadget";gadgets.IfrGadget.prototype.cssClassTitleBar="gadgets-gadget-title-bar";gadgets.IfrGadget.prototype.cssClassTitle="gadgets-gadget-title";gadgets.IfrGadget.prototype.cssClassTitleButtonBar="gadgets-gadget-title-button-bar";gadgets.IfrGadget.prototype.cssClassGadgetUserPrefsDialog="gadgets-gadget-user-prefs-dialog";gadgets.IfrGadget.prototype.cssClassGadgetUserPrefsDialogActionBar="gadgets-gadget-user-prefs-dialog-action-bar";gadgets.IfrGadget.prototype.cssClassTitleButton="gadgets-gadget-title-button";gadgets.IfrGadget.prototype.cssClassGadgetContent="gadgets-gadget-content";gadgets.IfrGadget.prototype.rpcToken=(2147483647*Math.random())|0;gadgets.IfrGadget.prototype.rpcRelay="files/container/rpc_relay.html";gadgets.IfrGadget.prototype.getTitleBarContent=function(A){A('<div id="'+this.cssClassTitleBar+"-"+this.id+'" class="'+this.cssClassTitleBar+'"><span id="'+this.getIframeId()+'_title" class="'+this.cssClassTitle+'">'+(this.title?this.title:"Title")+'</span> | <span class="'+this.cssClassTitleButtonBar+'"><a href="#" onclick="gadgets.container.getGadget('+this.id+').handleOpenUserPrefsDialog();return false;" class="'+this.cssClassTitleButton+'">settings</a> <a href="#" onclick="gadgets.container.getGadget('+this.id+').handleToggle();return false;" class="'+this.cssClassTitleButton+'">toggle</a></span></div>')};gadgets.IfrGadget.prototype.getUserPrefsDialogContent=function(A){A('<div id="'+this.getUserPrefsDialogId()+'" class="'+this.cssClassGadgetUserPrefsDialog+'"></div>')};gadgets.IfrGadget.prototype.setServerBase=function(A){this.serverBase_=A};gadgets.IfrGadget.prototype.getServerBase=function(){return this.serverBase_};gadgets.IfrGadget.prototype.getMainContent=function(A){var B=this.getIframeId();gadgets.rpc.setRelayUrl(B,this.serverBase_+this.rpcRelay);gadgets.rpc.setAuthToken(B,this.rpcToken);A('<div class="'+this.cssClassGadgetContent+'"><iframe id="'+B+'" name="'+B+'" class="'+this.cssClassGadget+'" src="'+this.getIframeUrl()+'" frameborder="no" scrolling="no"'+(this.height?' height="'+this.height+'"':"")+(this.width?' width="'+this.width+'"':"")+"></iframe></div>")};gadgets.IfrGadget.prototype.getIframeId=function(){return this.GADGET_IFRAME_PREFIX_+this.id};gadgets.IfrGadget.prototype.getUserPrefsDialogId=function(){return this.getIframeId()+"_userPrefsDialog"};gadgets.IfrGadget.prototype.getIframeUrl=function(){return this.serverBase_+"ifr?container="+this.CONTAINER+"&mid="+this.id+"&nocache="+gadgets.container.nocache_+"&country="+gadgets.container.country_+"&lang="+gadgets.container.language_+"&view="+gadgets.container.view_+(this.specVersion?"&v="+this.specVersion:"")+(gadgets.container.parentUrl_?"&parent="+encodeURIComponent(gadgets.container.parentUrl_):"")+(this.debug?"&debug=1":"")+this.getAdditionalParams()+this.getUserPrefsParams()+(this.secureToken?"&st="+this.secureToken:"")+"&url="+encodeURIComponent(this.specUrl)+"&rpctoken="+this.rpcToken+(this.viewParams?"&view-params="+encodeURIComponent(JSON.stringify(this.viewParams)):"")+(this.hashData?"&"+this.hashData:"")};gadgets.IfrGadget.prototype.getUserPrefsParams=function(){var C="";if(this.getUserPrefs()){for(var A in this.getUserPrefs()){var B=this.getUserPref(A);C+="&up_"+encodeURIComponent(A)+"="+encodeURIComponent(B)}}return C};gadgets.IfrGadget.prototype.handleToggle=function(){var B=document.getElementById(this.getIframeId());if(B){var A=B.parentNode;var C=A.style.display;A.style.display=C?"":"none"}};gadgets.IfrGadget.prototype.handleOpenUserPrefsDialog=function(){if(this.userPrefsDialogContentLoaded){this.showUserPrefsDialog()}else{var C=this;var A="ig_callback_"+this.id;window[A]=function(D){C.userPrefsDialogContentLoaded=true;C.buildUserPrefsDialog(D);C.showUserPrefsDialog()};var B=document.createElement("script");B.src="http://gmodules.com/ig/gadgetsettings?mid="+this.id+"&output=js"+this.getUserPrefsParams()+"&url="+this.specUrl;document.body.appendChild(B)}};gadgets.IfrGadget.prototype.buildUserPrefsDialog=function(A){var B=document.getElementById(this.getUserPrefsDialogId());B.innerHTML=A+'<div class="'+this.cssClassGadgetUserPrefsDialogActionBar+'"><input type="button" value="Save" onclick="gadgets.container.getGadget('+this.id+').handleSaveUserPrefs()"> <input type="button" value="Cancel" onclick="gadgets.container.getGadget('+this.id+').handleCancelUserPrefs()"></div>';B.childNodes[0].style.display=""};gadgets.IfrGadget.prototype.showUserPrefsDialog=function(A){var B=document.getElementById(this.getUserPrefsDialogId());B.style.display=(A||A===undefined)?"":"none"};gadgets.IfrGadget.prototype.hideUserPrefsDialog=function(){this.showUserPrefsDialog(false)};gadgets.IfrGadget.prototype.handleSaveUserPrefs=function(){this.hideUserPrefsDialog();var C={};var A=document.getElementById("m_"+this.id+"_numfields").value;for(var E=0;E<A;E++){var B=document.getElementById("m_"+this.id+"_"+E);if(B.type!=="hidden"){var F="m_"+this.id+"_up_";var D=B.name.substring(F.length);var G=B.value;C[D]=G}}this.setUserPrefs(C);this.refresh()};gadgets.IfrGadget.prototype.handleCancelUserPrefs=function(){this.hideUserPrefsDialog()};gadgets.IfrGadget.prototype.refresh=function(){var A=this.getIframeId();document.getElementById(A).src=this.getIframeUrl()};gadgets.Container=function(){this.gadgets_={};this.parentUrl_="http://"+document.location.host;this.country_=ComCore.Configuration.get("country");this.language_=ComCore.Configuration.get("language");this.view_="default";this.nocache_=0;this.maxheight_=2147483647};gadgets.Container.inherits(gadgets.Extensible);gadgets.Container.prototype.gadgetClass=gadgets.Gadget;gadgets.Container.prototype.userPrefStore=new gadgets.DefaultUserPrefStore();gadgets.Container.prototype.gadgetService=new gadgets.GadgetService();gadgets.Container.prototype.layoutManager=new gadgets.StaticLayoutManager();gadgets.Container.prototype.setParentUrl=function(A){this.parentUrl_=A};gadgets.Container.prototype.setCountry=function(A){this.country_=A};gadgets.Container.prototype.setNoCache=function(A){this.nocache_=A};gadgets.Container.prototype.setLanguage=function(A){this.language_=A};gadgets.Container.prototype.setView=function(A){this.view_=A};gadgets.Container.prototype.setMaxHeight=function(A){this.maxheight_=A};gadgets.Container.prototype.getGadgetKey_=function(A){return"gadget_"+A};gadgets.Container.prototype.getGadget=function(A){return this.gadgets_[this.getGadgetKey_(A)]};gadgets.Container.prototype.createGadget=function(A){return new this.gadgetClass(A)};gadgets.Container.prototype.addGadget=function(A){A.setUserPrefs(this.userPrefStore.getPrefs(A));this.gadgets_[this.getGadgetKey_(A.id)]=A};gadgets.Container.prototype.addGadgets=function(B){for(var A=0;A<B.length;A++){this.addGadget(B[A])}};gadgets.Container.prototype.renderGadgets=function(){for(var A in this.gadgets_){this.renderGadget(this.gadgets_[A])}};gadgets.Container.prototype.renderGadget=function(A){throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY)};gadgets.Container.prototype.nextGadgetInstanceId_=0;gadgets.Container.prototype.getNextGadgetInstanceId=function(){return this.nextGadgetInstanceId_++};gadgets.Container.prototype.refreshGadgets=function(){for(var A in this.gadgets_){this.gadgets_[A].refresh()}};gadgets.IfrContainer=function(){gadgets.Container.call(this)};gadgets.IfrContainer.inherits(gadgets.Container);gadgets.IfrContainer.prototype.gadgetClass=gadgets.IfrGadget;gadgets.IfrContainer.prototype.gadgetService=new gadgets.IfrGadgetService();gadgets.IfrContainer.prototype.setParentUrl=function(A){if(!A.match(/^http[s]?:\/\//)){A=document.location.href.match(/^[^?#]+\//)[0]+A}this.parentUrl_=A};gadgets.IfrContainer.prototype.renderGadget=function(B){var A=this.layoutManager.getGadgetChrome(B);B.render(A)};gadgets.NetlogGadgetService=function(){gadgets.IfrGadgetService.call(this);gadgets.rpc.register("resize_iframe",this.setHeight);gadgets.rpc.register("set_pref",this.setUserPref);gadgets.rpc.register("set_title",this.setTitle);gadgets.rpc.register("requestNavigateTo",this.requestNavigateTo);gadgets.rpc.register("debug",this.debug);gadgets.rpc.register("requestCredits",this.requestCredits);gadgets.rpc.register("requestPayment",this.requestPayment);gadgets.rpc.register("requestConfig",this.requestConfig);gadgets.rpc.register("share_app",this.shareApp);gadgets.rpc.register("shindig.requestShareApp",this.shareApp);gadgets.rpc.register("openPopup",this.openPopup);gadgets.rpc.register("getChatRoster",this.getChatRoster);gadgets.rpc.register("challengeUser",this.challengeUser);gadgets.rpc.register("registerOnUserStatusChange",this.registerOnUserStatusChange);gadgets.rpc.register("updateGameData",this.updateGameData);gadgets.rpc.register("showRegistrationDialog",this.showRegistrationDialog);gadgets.rpc.register("showLoginDialog",this.showLoginDialog)};gadgets.NetlogGadgetService.inherits(gadgets.IfrGadgetService);gadgets.NetlogGadgetService.prototype.setHeight=function(C){if(C>gadgets.container.maxheight_){C=gadgets.container.maxheight_}var A=document.getElementById(this.f);if(A){A.style.height=C+"px";A.height=C}var B=document.getElementById("gameWmodeFix");if(B){B.style.height=C+"px";B.height=C}};gadgets.NetlogGadgetService.prototype.shareAppCallback=function(B){gadgets.NetlogGadgetService.dialogLoaded=false;if(B.f!==undefined){var A=B.f;delete B.f;gadgets.rpc.call(A,"shareAppHandled",null,B)}};gadgets.NetlogGadgetService.prototype.shareAppDialog=function(C,A,B){if(gadgets.NetlogGadgetService.dialogLoaded!==true){gadgets.NetlogGadgetService.dialogLoaded=true;window.setTimeout(function(D){ComCore.Queuer.add(function(){obj=new ComCore.AppShare(A)});ComCore.AppShare.showDialog(C,A,gadgets.NetlogGadgetService.prototype.shareAppCallback,B)},500)}};gadgets.NetlogGadgetService.prototype.openPopup=function(E){var H=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(this.f);var G=gadgets.container.getGadget(H);var C=G.appid;var D=this.f;var F="no";if(E.scrolling){F="auto"}if(E.full_screen){var B=document.viewport.getDimensions();E.width=B.width-100;E.height=B.height-100}var A=new comcorePopupIframe(E.url,E.width,E.height,F,function(){gadgets.rpc.call(D,"statusPopup",null,{STATUS:"CLOSED"})})};gadgets.NetlogGadgetService.prototype.challengeUser=function(A){if(ComCore&&ComCore.Chat&&ComCore.Chat.controller!==null){ComCore.Chat.controller.games.createChallenge(A)}};gadgets.NetlogGadgetService.prototype.getChatRoster=function(){var B=this.f;var A=function(C){gadgets.rpc.call(B,"rosterReceived",null,C)};if(ComCore&&ComCore.Chat&&ComCore.Chat.controller!==null){ComCore.Chat.controller.games.getRoster(A)}};gadgets.NetlogGadgetService.prototype.registerOnUserStatusChange=function(){var B=this.f;var A=function(D,C){gadgets.rpc.call(B,"receiveOnUserStatusChange",null,{username:D,status:C})};if(ComCore&&ComCore.Chat&&ComCore.Chat.controller!==null){ComCore.Chat.controller.games.addUserStatusEventListener(A)}};var gamesObject;gadgets.NetlogGadgetService.prototype.updateGameData=function(A){if(!gamesObject){gamesObject=new ComCore.Games()}gamesObject.updateGameData()};gadgets.NetlogGadgetService.prototype.showRegistrationDialog=function(B){var A=new ComCore.RegisterDialog({annoying:false,token:B.token})};gadgets.NetlogGadgetService.prototype.showLoginDialog=function(B){var A=new ComCore.LoginDialog({token:B.token,why:"GAME_ANONYMOUS"})};gadgets.NetlogGadgetService.prototype.shareApp=function(F){var H=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(this.f);var G=gadgets.container.getGadget(H);var C=G.appid;var E=this.f;var D=window.location.href.substr(-16);if(G.game||D==="userGameDialog=1"){debug("game requesting share, will use gameshare dialog...");ComCore.Dialog.initialize({width:400});var A=$$(".shareButton")[0];debug("share button:");debug(A);ComCore.Dialog.getContent(A.attr("href"));return }if(typeof (F.reason)==="object"){F.reason=F.reason.fields_.body}var B=new ComCore.BootLoader();B.loadJavascript({name:"/s/j/page.share.js"},false,function(){gadgets.NetlogGadgetService.prototype.shareAppDialog(F,C,E)})};gadgets.NetlogGadgetService.prototype.debug=function(A){if(typeof (openSocial)!=="undefined"){openSocial.debug(A)}else{if(openSocialDebug){openSocialDebug.push(A)}}};gadgets.NetlogGadgetService.prototype.setUserPref=function(F,C,E){var H=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(this.f);var G=gadgets.container.getGadget(H);var B=G.getUserPrefs();for(var D=1,A=arguments.length;D<A;D+=2){B[arguments[D]]=arguments[D+1]}G.setUserPrefs(B)};gadgets.NetlogGadgetService.prototype.requestConfig=function(B){var A={PHOTOSTATIC:ComCore.Configuration.get("photoStaticURL"),STATIC:ComCore.Configuration.get("staticURL")};if(ComCore.Login!==undefined){A.PREMIUM=ComCore.Login.isPremium()}gadgets.rpc.call(this.f,"receiveConfig",null,A)};gadgets.NetlogGadgetService.prototype.requestCredits=function(G){var A=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(this.f);var H=gadgets.container.getGadget(A);var J=H.appid;if(!G.amount||!G.reason||!G.st){return false}var D=parseInt(G.amount,10);var E=G.reason;var C=this.f;var F=G.optParams||{};var I={st:G.st,data:F};var B=["/s/j/classes/class.credits.js"];ComCore.BootLoader.loadJavascriptFiles(B,false,function(){ComCore.Credits.requestCredits(D,{type:"APP",ID:J},{reason:E,custom:I,onAccept:function(K){gadgets.NetlogGadgetService.processRequestCredits(C,true,true,K)},onDeny:function(K){gadgets.NetlogGadgetService.processRequestCredits(C,true,false,K)},onFailure:function(K){gadgets.NetlogGadgetService.processRequestCredits(C,false,false,K)}})})};gadgets.NetlogGadgetService.prototype.requestPayment=function(F){var A=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(this.f);var G=gadgets.container.getGadget(A);var J=G.appid;if(!F.amount||!F.reason||!F.st){return false}var H=parseInt(F.amount,10);var D=F.reason;var C=this.f;var E=F.optParams||{};var I={st:F.st,data:E};var B=["/s/j/classes/class.payment.js"];ComCore.BootLoader.loadJavascriptFiles(B,false,function(){ComCore.Payment.requestPayment(H,{type:"APP",ID:J},{reason:D,custom:I,onAccept:function(K){gadgets.NetlogGadgetService.processRequestPayment(C,true,true,K)},onDeny:function(K){gadgets.NetlogGadgetService.processRequestPayment(C,true,false,K)},onFailure:function(K){gadgets.NetlogGadgetService.processRequestPayment(C,false,false,K)}})})};gadgets.NetlogGadgetService.processRequestCredits=function(D,C,B,A){if(C){gadgets.rpc.call(D,"creditsHandled",null,{success:true,result:{accepted:B,token:A.token}})}else{gadgets.rpc.call(D,"creditsHandled",null,{success:false,reason:"CANCELLED_BY_USER"})}};gadgets.NetlogGadgetService.processRequestPayment=function(D,C,B,A){if(C){gadgets.rpc.call(D,"creditsHandled",null,{success:true,result:{accepted:B,token:A.token}})}else{gadgets.rpc.call(D,"creditsHandled",null,{success:false,reason:"CANCELLED_BY_USER"})}};gadgets.NetlogGadgetService.prototype.requestNavigateTo=function(B,D){var G=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(this.f);var F=gadgets.container.getGadget(G);var A=ComCore.Page.buildAjaxURL("apps","checkApplicationAdded");var C=this;var E=new Ajax.Request(A,{method:"post",parameters:"appid="+F.appid,onSuccess:function(I,H){gadgets.NetlogGadgetService.processNavigatePermitted(H,F.appid,C,B,D)}})};gadgets.NetlogGadgetService.processNavigatePermitted=function(I,H,E,G,C){if(gadget.sandbox!==true&&G==="profile"&&(!I.success||!I.added)){if(gadget.hybrid===true){var B=new ComCore.ConfirmDialog(e,$("addToProfileText").value)}else{ComCore.AppsDialog.showAddDialog(H,true)}}else{var D=gadgets.NetlogGadgetService.getGadgetIdFromModuleId(E.f);var A=ComCore.Configuration.get("rootURL")+gadgets.NetlogGadgetService.getUrlForView(G,D);if(C){var F=JSON.stringify(C);if(F.length>0){A+="&appParams="+encodeURIComponent(F)}}if(A&&document.location.href.indexOf(A)===-1){document.location.href=A}}};gadgets.NetlogGadgetService.getUrlForView=function(A,C){var B=gadgets.container.getGadget(C);if(B.sandbox===true){if(A==="canvas"){return"/developer/opensocial/sandbox=1&view=canvas&url="+encodeURIComponent(B.specUrl)}else{if(A==="profile"){return"/developer/opensocial/sandbox=1&view=profile&url="+encodeURIComponent(B.specUrl)}else{return null}}}if(A==="canvas"){if(B.hybrid===true){return"/"+B.appname+"/"}else{if(B.game===true){return"/play/"+B.appname}}return"/apps/"+B.appname+"/"}else{if(A==="profile"){return"/profile/"}else{return null}}};gadgets.NetlogGadgetService.getGadgetIdFromModuleId=function(A){return parseInt(A.match(/_([0-9]+)$/)[1],10)};gadgets.NetlogGadget=function(A){gadgets.IfrGadget.call(this,A);this.serverBase_=ComCore.Configuration.get("shindig")};gadgets.NetlogGadget.inherits(gadgets.IfrGadget);gadgets.NetlogGadget.prototype.CONTAINER="netlog";gadgets.NetlogGadget.prototype.rpcToken=(2147483647)|0;gadgets.NetlogGadget.prototype.rpcRelay="files/container/rpc_relay.html";gadgets.NetlogGadget.prototype.setTitle=function(A){this.title=A};gadgets.NetlogGadget.prototype.getTitleBarContent=function(B){var A=(this.showtitle?'<div class=""><div id="'+this.cssClassTitleBar+"-"+this.id+'" class="clearfix '+this.cssClassTitleBar+'">'+(this.title?'<h2 id="'+this.getIframeId()+'_title" class="left"><a href="/apps/'+this.appname+'">'+this.title+"</a></h2>":"")+'<span class="'+this.cssClassTitleButtonBar+'" /></div>':"");B(A)};gadgets.NetlogGadget.prototype.getMainContent=function(A){var B=this.getIframeId();gadgets.rpc.setRelayUrl(B,this.serverBase_+this.rpcRelay);gadgets.rpc.setAuthToken(B,this.rpcToken);A('<div class="'+this.cssClassGadgetContent+'"><iframe id="'+B+'" name="'+B+'" class="'+this.cssClassGadget+'" src="'+this.getIframeUrl()+'" frameborder="0" scrolling="no"'+(this.height?' height="'+this.height+'"':"")+(this.width?' width="'+this.width+'"':"")+' style="margin:0 auto;display:block;background-color:transparent;"></iframe></div></div>')};gadgets.NetlogGadget.prototype.getIframeUrl=function(){this.secureToken=document.getElementById("ticket_"+this.appid).value;return this.serverBase_+"ifr?url="+encodeURIComponent(this.specUrl)+"&container="+this.CONTAINER+"&mid="+this.id+"&nocache="+this.cache+"&flushcache="+((this.flushcache!==undefined)?this.flushcache:0)+"&country="+gadgets.container.country_+"&lang="+gadgets.container.language_+"&view="+gadgets.container.view_+(this.specVersion?"&v="+this.specVersion:"")+(gadgets.container.parentUrl_?"&parent="+encodeURIComponent(gadgets.container.parentUrl_):"")+(this.debug?"&debug=1":"")+this.getAdditionalParams()+this.getUserPrefsParams()+"&rpctoken="+this.rpcToken+(this.secureToken?"&st="+this.secureToken:"")+(this.viewParams?"&view-params="+encodeURIComponent(this.viewParams):"")+(this.hashData?"&"+this.hashData:"")};gadgets.NetlogContainer=function(){gadgets.IfrContainer.call(this)};gadgets.NetlogContainer.inherits(gadgets.IfrContainer);gadgets.NetlogContainer.prototype.gadgetClass=gadgets.NetlogGadget;gadgets.NetlogContainer.prototype.gadgetService=new gadgets.NetlogGadgetService();gadgets.container=new gadgets.NetlogContainer();gadgets.CookieBasedUserPrefStore=function(){gadgets.UserPrefStore.call(this)};gadgets.CookieBasedUserPrefStore.inherits(gadgets.UserPrefStore);gadgets.CookieBasedUserPrefStore.prototype.USER_PREFS_PREFIX="gadgetUserPrefs-";gadgets.CookieBasedUserPrefStore.prototype.getPrefs=function(D){var F={};var I=this.USER_PREFS_PREFIX+D.id;var E=goog.net.cookies.get(I);if(E){var B=E.split("&");for(var C=0;C<B.length;C++){var H=B[C].split("=");var A=decodeURIComponent(H[0]);var G=decodeURIComponent(H[1]);F[A]=G}}return F};gadgets.CookieBasedUserPrefStore.prototype.savePrefs=function(G){var C=[];for(var A in G.getUserPrefs()){var B=G.getUserPref(A);var F=encodeURIComponent(A)+"="+encodeURIComponent(B);C.push(F)}var D=this.USER_PREFS_PREFIX+G.id;var E=C.join("&");goog.net.cookies.set(D,E)};gadgets.Container.prototype.userPrefStore=new gadgets.CookieBasedUserPrefStore();