(function(){var A="twttr_anywhere",O="twttr_signed_out";var D,F=0;function J(){try{var c=document.getElementsByTagName("script")}catch(l){var c=[]}var n,a,b={};for(var h=0,k=c.length;h<k;h++){n=c[h];if(n.src.indexOf("/anywhere.js?")>-1){a=n}}if(a){var m=a.src.split("?").pop();if(m.indexOf("=")>0){var Z=m.split("&"),g;for(var f=0;(g=Z[f]);f++){var d=g.split("="),p=d[0],o=d[1];if(p=="id"){b.clientID=o}if(p=="v"){b.version=o}}}else{b.clientID=m}}return b}var S=(function(){var a,d,c;function b(f){var k=c.childNodes,j,h=null;for(var g=0,e=k.length;g<e;g++){j=k.item(g);if(j.getAttribute("key")==f){h=j;break}}return h}var Z={isExpired:function(e){if(e.match(/_expiry$/)){return false}var f=this.get(e+"_expiry");return(f&&(new Date()).getTime()>f)},setExpiry:function(f,e){this.set(f+"_expiry",(new Date()).getTime()+(1000*60*60*e))},setWithExpiry:function(f,g,e){this.setExpiry(f,e);this.set(f,g)},expire:function(e){this.del(e);this.del(e+"_expiry")}};if((a=window.localStorage)){Z.get=function(e){if(this.isExpired(e)){this.expire(e);return null}else{return a[e]}};Z.set=function(e,f){return(a[e]=f)};Z.del=function(e){a.removeItem(e)};Z.getAll=function(j){var h=-1,g,e=localStorage.length,f={};while(++h<e){g=localStorage.key(h);if(typeof j=="undefined"||g.match(j)){f[g]=localStorage.getItem(g)}}return f};return Z}else{if(document.documentElement.addBehavior){a=document.documentElement;a.addBehavior("#default#userData");a.load("twitter-anywhere");d=a.xmlDocument;c=d.documentElement;function b(f){var k=c.childNodes,j,h=null;for(var g=0,e=k.length;g<e;g++){j=k.item(g);if(j.getAttribute("key")==f){h=j;break}}return h}Z.get=function(e){var g,f=null;if(this.isExpired(e)){this.expire(e)}else{g=b(e);if(g){f=g.getAttribute("value")}}return f};Z.set=function(e,g){var f=b(e);if(!f){f=d.createNode(1,"item","");f.setAttribute("key",e);f.setAttribute("value",g);c.appendChild(f)}else{f.setAttribute("value",g)}a.save("twitter-anywhere");return g};Z.del=function(e){var f=b(e);if(f){c.removeChild(f)}a.save("twitter-anywhere")};Z.clear=function(){while(c.firstChild){c.removeChild(c.firstChild)}a.save("twitter-anywhere")};Z.getAll=function(k){var j=c.childNodes,h=-1,e=j.length,g={},l,f;while(++h<e){l=j.item(h);f=l.getAttribute("key");if(typeof k=="undefined"||f.match(k)){g[f]=l.getAttribute("value")}}return g};return Z}}}());function N(Z){var a=[twttr.anywhere._assetUrl()];if(Z.indexOf("_dev")!==0){a=a.concat([Z])}return a.concat("javascripts/client.js").join("/")}function L(a){var c=location.href.split("#");var Z=c.pop();var b=new RegExp(a+"=(.+?)(&|$)");if(Z.indexOf(a)!=-1){return Z.match(b)[1]}}function Q(){var Z;if(S&&(Z=S.get(A))){return Z}}function P(c){var a=c._clients,d=L("bridge_code");for(var b=0,Z=a.length;b<Z;b++){a[b]._fireAuthComplete(d)}}function I(c){var a=c._clients;for(var b=0,Z=a.length;b<Z;b++){a[b]._fireSignOut()}}function R(){var a=null;if((a=L("oauth_access_token"))){var Z=window.opener||window.parent;if(Z&&Z.parent.twttr){Z.parent.twttr.anywhere._setToken(a);P(Z.parent.twttr.anywhere);if(window.opener){window.close();if(window.self){window.self.close()}}return"callback_new_window"}else{if(window.parent!=window&&window.parent&&window.parent.twttr){window.parent.parent.twttr.anywhere._setToken(a);P(window.parent.parent.twttr.anywhere);window.parent.parent.twttr.anywhere._removeHeadlessAuth();return"headless"}else{twttr.anywhere._setToken(a);P(window.parent.parent.twttr.anywhere);setTimeout(function(){window.location.hash=""},100);return"callback_same_window"}}}if(L("oauth_error_reason")){window.parent.parent.twttr.anywhere._removeHeadlessAuth();return"headless"}try{window.parent.parent.twttr.anywhere._removeHeadlessAuth()}catch(b){}if((a=Q())){twttr.anywhere._setToken(a);return"cookie"}}function E(a,b){for(var Z in b){a[Z]=b[Z]}return a}function Y(a,Z){return function(){return Z.apply(a,arguments)}}var X=navigator.userAgent.toLowerCase();var M=(/msie/gi.test(X)&&!/opera/gi.test(X));var H='<iframe tabindex="-1" role="presentation" style="position:absolute;top:-9999px;"></iframe>';function G(Z){var d=document.createElement("div");d.innerHTML=H;var b=d.firstChild,c=Y(b,Z);if(M){if(twttr.anywhere._config.domain){b.src="javascript:'<script>window.onload=function(){document.write(\\'<script>document.domain=\\\""+twttr.anywhere._config.domain+"\\\";<\\\\/script>\\');document.close();};<\/script>'"}var a=false;b.attachEvent("onload",function(){if(a){return }a=true;c()})}else{b.addEventListener("load",c,false)}document.body.insertBefore(b,document.body.firstChild);return b}function V(Z){throw (Z)}function W(Z,b,a){if(!Z._initCallbacks){Z._initCallbacks=[]}Z._initCallbacks.push([b,a])}function C(b,g,h){var d=h.version,e;var a=b.contentWindow,c=h.window;var f=a.document.createElement("script");var Z=N(d);b.id="_twttr_anywhere_client_"+d;W(a,g,h);a._VERSION=d;a._URL=Z;f.type="text/javascript";f.src=Z;e=a.document.getElementsByTagName("head")[0];if(!e){e=document.createElement("head");a.document.documentElement.appendChild(e)}e.appendChild(f);return f}function U(Z,b){if(document.body){var a=twttr.anywhere._instances;a[Z.version]=G(function(){C(this,b,Z)})}else{setTimeout(function(){U(Z,b)},20)}}window.twttr=window.twttr||{};twttr.anywhere=function(b,d){if(D=="callback"||D=="headless"){return }if(typeof b=="function"){d=b;b=twttr.anywhere._config.defaultVersion}if(!twttr.anywhere._config.clientID){return V("To set up @anywhere, please provide a client ID")}var a;var c=twttr.anywhere._instances;if(typeof b==="string"||typeof b==="number"){b={version:b}}var Z=(b.version)?b.version.toString():twttr.anywhere._config.defaultVersion;b.version=twttr.anywhere._getVersion(Z);if(!b.version){return V("No @anywhere version matching "+Z)}b=E({window:window},b);if((a=c[b.version])){if(a.contentWindow._ready){a.contentWindow._init(d,b)}else{W(a.contentWindow,d,b)}}else{U(b,d)}};E(twttr.anywhere,{versions:["_dev","1","chirp_preview","pre","1.1","1.1.1","1.1.2"],_instances:{},_clients:[],_config:{defaultVersion:"1",assetHost:"platform{i}.twitter.com",secureAssetHost:"twitter-any.s3.amazonaws.com",baseHost:"twitter.com",serverHost:"api.twitter.com",serverPath:"xd_receiver.html",oauthHost:"oauth.twitter.com",ignoreSSL:false},_getVersion:function(a){if(!a){return null}a=a.toString();var c=[];for(var b=0,Z;(Z=twttr.anywhere.versions[b]);b++){if(Z.indexOf(a)===0){c.push(Z)}}return c.sort()[c.length-1]},config:function(Z){if(typeof Z==="string"){this._config.clientID=Z;return this._config}return E(this._config,Z||{})},signOut:function(){I(this);if(S){S.set(O,"true")}},_removeToken:function(){this.token=null;if(S){S.expire(A)}},_setToken:function(a){var Z;this.token=a;var b=S&&S.get(A);if(S&&(b!=""||!b)){S.setWithExpiry(A,a,2);S.expire(O)}},_removeHeadlessAuth:function(){if(this._headlessAuthWindow){this._headlessAuthWindow.parentNode.removeChild(this._headlessAuthWindow);this._headlessAuthWindow=null}},_signedOutFlagPresent:function(){return S&&S.get(O)=="true"},_proto:function(Z){return(window.location.protocol.match(/s\:$/)||Z)&&!twttr.anywhere._config.ignoreSSL?"https":"http"},_serverUrl:function(Z){if(twttr.anywhere._config.serverHost){return this._proto(Z)+"://"+[twttr.anywhere._config.serverHost,twttr.anywhere._config.serverPath].join("/")}},_assetUrl:function(a){var c=this._proto(a);var b=(c=="https")?twttr.anywhere._config.secureAssetHost:twttr.anywhere._config.assetHost;var Z=b.replace("{i}",F++);if(F==3){F=0}return c+"://"+Z},_baseUrl:function(Z){return this._proto(Z)+"://"+twttr.anywhere._config.baseHost},_oauthUrl:function(Z){return this._proto(Z)+"://"+twttr.anywhere._config.oauthHost+"/2"}});D=R();var T=J();var K=T.clientID;var B=T.version;if(K){twttr.anywhere._config.clientID=K}if(B){twttr.anywhere._config.defaultVersion=B}twttr.anywhere._signedOutCookiePresent=twttr.anywhere._signedOutFlagPresent}());