var f=this;Math.random();var g=function(a,d){var c=a.split("."),b=f;c[0]in b||!b.execScript||b.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===d?b=b[e]?b[e]:b[e]={}:b[e]=d};Math.random();var h,k,l,m,p,q=function(){return f.navigator?f.navigator.userAgent:null};p=m=l=k=h=!1;var r;if(r=q()){var t=f.navigator;h=0==r.lastIndexOf("Opera",0);k=!h&&(-1!=r.indexOf("MSIE")||-1!=r.indexOf("Trident"));m=(l=!h&&-1!=r.indexOf("WebKit"))&&-1!=r.indexOf("Mobile");p=!h&&!l&&!k&&"Gecko"==t.product}var u=k,v=p,w=l,x=m;var A;if(h&&f.opera){var B=f.opera.version;"function"==typeof B&&B()}else v?A=/rv\:([^\);]+)(\)|;)/:u?A=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:w&&(A=/WebKit\/(\S+)/),A&&A.exec(q());var C;C=!1;var D=q();D&&(-1!=D.indexOf("Firefox")||-1!=D.indexOf("Camino")||-1!=D.indexOf("iPhone")||-1!=D.indexOf("iPod")||-1!=D.indexOf("iPad")||-1!=D.indexOf("Chrome")||-1!=D.indexOf("Android")||-1!=D.indexOf("Safari")&&(C=!0));var E=C;var F=function(a){var d=window;if(x&&E&&d){d.focus();var c=0,b=null,b=d.setInterval(function(){a.closed||5==c?d.clearInterval(b):(a.close(),c++)},150)}else a.close()};var G,H=function(a){a=a||[];for(var d=[],c=0,b=a.length;c<b;++c){var e=String(a[c]||"");e&&d.push(e)}if(!d.length)return null;G?G.reset.call(G):G=shindig.sha1();G.update.call(G,d.join(" "));return G.digestString.call(G).toLowerCase()},I=function(a,d,c){this.i=String(a||"");this.e=String(d||"");this.a=String(c||"");this.d={};this.g=this.k=this.f=this.h="";this.c=null};
I.prototype.evaluate=function(){var a={},d="";try{d=String(document.cookie||"")}catch(c){}for(var d=d.split("; ").join(";").split(";"),b=0,e=d.length;b<e;++b){var s=d[b],y=s.indexOf("=");-1!=y?a[s.substr(0,y)]=s.substr(y+1):a[s]=null}this.d=a;if(this.d.SID)if(this.e=this.e.split(".")[0].split("@")[0],a="",a=0==this.i.indexOf("https://")?"SAPISID":"APISID",this.f=String(this.d[a]||""))if(a="",a=0==gadgets.rpc.getOrigin(String(window.location.href)).indexOf("https://")?"SAPISID":"APISID",this.h=String(this.d[a]||
"")){d=String(this.d.LSOLH||"").split(":");b=d.length;if(1==b||4==b)this.k=d[0];if(3==b||4==b)a=String(d[b-3]||""),d=String(d[b-1]||""),(b=H([a,this.h]).substr(0,4))&&b==d&&(this.g=a);this.a&&(a=this.a.indexOf("."),-1!=a&&(a=this.a.substr(0,a)||"",this.a=a+"."+H([this.f,this.i,this.e,this.k,this.g,a]).substr(0,4)));a=H([this.f,this.i,this.e,this.a]);this.a&&(a=a+"."+this.a);this.c=a}else this.c="";else this.c=""};
var J=function(a,d,c){a=new I(a,d,c);a.evaluate();return a},L=function(a,d){var c=K(this),b=null;if(a){a=String(a);var e=a.indexOf(".");-1!=e&&(b=a.substr(e+1))}c=J(c,d,b);return a==c.c},M=function(a,d){var c=K(this),b=J(c);if(String(a)!=b.c)throw Error("Unauthorized request");var e=String(d),c=parseInt(e,10);String(c)==e&&0<=c?(b=b.g)?(b=b.split("|"),c=b.length<=c?null:b[c]||null):c=null:c=null;return c},K=function(a){a=String(a.origin||"");if(!a)throw Error("RPC has no origin.");return a};
g("checkSessionState",L);g("getVersionInfo",M);var N=function(a){window.setTimeout(function(){gadgets.rpc.getTargetOrigin("..")==gadgets.rpc.getOrigin(a)&&gadgets.rpc.call("..","oauth2callback:"+gadgets.rpc.getAuthToken(".."),void 0,a)},1)},O=function(){gadgets.rpc.call("..","oauth2relayReady:"+gadgets.rpc.getAuthToken(".."));gadgets.rpc.register("check_session_state",L);gadgets.rpc.register("get_versioninfo",M)};g("oauth2callback",N);
g("oauth2verify",function(a,d){var c=window.open("javascript:void(0);",a),b;if(c&&!c.closed&&(b=c.oauth2callbackUrl))return window.b=window.b||{},window.j=window.j||window.setTimeout,window.setTimeout=function(a,b){try{var d=a,z=!1,n;a=function(){if(!z){z=!0;try{window.b[String(n)]=void 0,delete window.b[String(n)]}catch(a){}return d.call(this)}};var P=c.setTimeout(a,b);n=window.j(a,b);window.b[String(n)]=P;return n}catch(Q){}return window.j(a,b)},window.l=window.l||window.clearTimeout,window.clearTimeout=
function(a){try{var b=window.b[String(a)];b&&c.clearTimeout(b)}catch(d){}try{window.b[String(a)]=void 0,delete window.b[String(a)]}catch(z){}window.l(a)},N(String(b)),"keep_open"!=d&&F(c),!0;c&&!c.closed&&F(c);return!1});window.addEventListener?window.addEventListener("load",O,!1):window.attachEvent("onload",O);
