var g=void 0,i=null;function aa(){return function(){}}var j,ba=ba||{},l=this;function ca(a,b){var c=a.split("."),d=l;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&b!==g?d[e]=b:d=d[e]?d[e]:d[e]={}}function da(a){for(var a=a.split("."),b=l,c;c=a.shift();)if(b[c]!=i)b=b[c];else return i;return b}function m(){}
function ea(a){var b=typeof a;if(b=="object")if(a){if(a instanceof Array)return"array";else if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(c=="[object Window]")return"object";if(c=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(c=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if(b=="function"&&typeof a.call=="undefined")return"object";return b}function q(a){return ea(a)=="array"}function fa(a){var b=ea(a);return b=="array"||b=="object"&&typeof a.length=="number"}function r(a){return typeof a=="string"}function ga(a){return ea(a)=="function"}function ha(a){a=ea(a);return a=="object"||a=="array"||a=="function"}function s(a){return a[ia]||(a[ia]=++ja)}var ia="closure_uid_"+Math.floor(Math.random()*2147483648).toString(36),ja=0;
function ka(a,b,c){return a.call.apply(a.bind,arguments)}function la(a,b,c){if(!a)throw Error();if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}else return function(){return a.apply(b,arguments)}}function ma(a,b,c){ma=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?ka:la;return ma.apply(i,arguments)}
function na(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var oa=Date.now||function(){return+new Date};function t(a,b){function c(){}c.prototype=b.prototype;a.n=b.prototype;a.prototype=new c};function pa(a){this.b=a;this.ma=this.Ga=this.a=i;this.na=0;this.Va=this.Ea=this.Ka=this.La=i;this.nb=this.mb=-200;this.ub=120;this.fb=13;this.gb=45;this.Hb=3;this.ra=100}
pa.prototype={i:function(){var a=document.createElement("canvas");if((!a.getContext||!a.getContext("2d"))&&confirm("Oh no! your browser doesn't support this website! SpotTheBall.com requires a modern browser. We suggest you use Google Chrome or Firefox. Would you like more information on how to upgrade?"))window.location="http://www.whatbrowser.org/";this.a=a.getContext("2d");this.a.save();this.height=500;this.width=740;a.id="ctx";a.width=this.width;a.height=this.height;document.getElementById("canvasContainer").appendChild(a);
var b=this;this.Ga=new Image;this.Ga.src="client/img/pitch.png";this.La=new Image;this.La.src="client/img/inner.png";this.Ka=new Image;this.Ka.src="client/img/inner-filmstrip.png";this.Ea=new Image;this.Ea.src="client/img/crosshair-big.png";this.Va=new Image;this.Va.src="client/img/spot.png";this.b.log("Initalised Canvas graphics adaptor.");document.onmousemove=function(a){b.mb=a.pageX-document.getElementById("canvasContainer").offsetLeft;b.nb=a.pageY-document.getElementById("canvasContainer").offsetTop}},
lb:function(a,b){this.ma=new Image;this.ma.src=a;this.ma.onload=b},hc:function(){this.Ga.complete&&this.a.drawImage(this.Ga,0,0)},uc:function(){this.La.complete&&this.a.drawImage(this.La,0,0)},ec:function(a){if(this.ma.complete)this.a.globalAlpha=this.na,this.a.drawImage(this.ma,this.fb,this.gb),this.a.globalAlpha=1,this.na<1&&(this.na+=a/2E3)},dc:function(){this.Ea.complete&&this.a.drawImage(this.Ea,this.mb-this.ub/2,this.nb-this.ub/2)},tc:function(){this.Ka.complete&&this.a.drawImage(this.Ka,0,
0)},gc:function(a){for(var b=0,c=a.length;b<c;b++)this.Va.complete&&!isNaN(a[b].left)&&this.a.drawImage(this.Va,a[b].left-23.5+this.fb,a[b].top-18+this.gb)},fc:function(a,b,c,d,e){if(b!=!1){this.a.save();this.a.rotate(1.2*Math.PI/180);this.a.font="17pt 'Permanent Marker'";this.a.textBaseline="top";if(this.Hb!=d)this.Hb=d,this.ra=0;this.ra<100&&(this.ra+=a/60);this.a.textAlign="left";this.a.fillStyle="rgba(0, 0, 0, "+this.ra/10+")";this.a.fillText("Guesses remaining: x"+d,32,15);this.a.fillStyle="rgba(240, 240, 240, "+
this.ra/10+")";this.a.fillText("Guesses remaining: x"+d,30,13);this.a.textAlign="right";this.a.fillStyle="#000";this.a.fillText("Prize: \u00a3"+c+" from "+e,702,20);this.a.fillStyle="#eee";this.a.fillText("Prize: \u00a3"+c+" from "+e,700,18);this.a.font="16pt 'Permanent Marker'";this.a.fillStyle="#000";this.a.textAlign="center";this.a.textBaseline="bottom";this.a.fillText("Game ends in: "+b,362,467);this.a.fillStyle="#ccc";this.a.fillText("Game ends in: "+b,360,465);this.a.restore()}},ic:function(){this.a.save();
this.a.rotate(1.2*Math.PI/180);this.a.font="19pt 'Permanent Marker'";this.a.textAlign="center";this.a.fillStyle="rgba(0, 0, 0, 1)";this.a.fillText("Showing your previous entry!",350,45);this.a.fillStyle="rgba(240, 240, 240, 1)";this.a.fillText("Showing your previous entry!",350,43)},jc:function(){this.a.save();this.a.rotate(1.2*Math.PI/180);this.a.font="19pt 'Permanent Marker'";this.a.textAlign="center";this.a.fillStyle="rgba(0, 0, 0, 1)";this.a.fillText("Latest game results",350,45);this.a.fillStyle=
"rgba(240, 240, 240, 1)";this.a.fillText("Latest game results",350,43)},ia:function(a,b,c,d,e,f,h,k,n){this.clear();b?(this.ec(a),n!="resultMontage"&&(this.gc(d),c||this.dc()),this.tc(),n=="play"?this.fc(a,e,f,3-d.length,h):n=="result"?this.ic():n=="resultMontage"&&this.jc()):(this.hc(),this.uc())},clear:function(){this.a.fillStyle="rgb(255,255,255)";this.a.fillRect(0,0,this.width,this.height);this.a.restore()}};function qa(a){this.stack=Error().stack||"";if(a)this.message=String(a)}t(qa,Error);qa.prototype.name="CustomError";function ra(a,b){for(var c=1;c<arguments.length;c++)var d=String(arguments[c]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a}var sa=/^[a-zA-Z0-9\-_.!~*'()]*$/;function ta(a){a=String(a);return!sa.test(a)?encodeURIComponent(a):a}function ua(a){if(!va.test(a))return a;a.indexOf("&")!=-1&&(a=a.replace(wa,"&amp;"));a.indexOf("<")!=-1&&(a=a.replace(xa,"&lt;"));a.indexOf(">")!=-1&&(a=a.replace(ya,"&gt;"));a.indexOf('"')!=-1&&(a=a.replace(za,"&quot;"));return a}
var wa=/&/g,xa=/</g,ya=/>/g,za=/\"/g,va=/[&<>\"]/;
function Aa(a,b){for(var c=0,d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=String(b).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=Math.max(d.length,e.length),h=0;c==0&&h<f;h++){var k=d[h]||"",n=e[h]||"",o=RegExp("(\\d*)(\\D*)","g"),B=RegExp("(\\d*)(\\D*)","g");do{var p=o.exec(k)||["","",""],v=B.exec(n)||["","",""];if(p[0].length==0&&v[0].length==0)break;c=Ba(p[1].length==0?0:parseInt(p[1],10),v[1].length==0?0:parseInt(v[1],10))||Ba(p[2].length==0,v[2].length==0)||Ba(p[2],v[2])}while(c==
0)}return c}function Ba(a,b){if(a<b)return-1;else if(a>b)return 1;return 0};function Ca(a,b){b.unshift(a);qa.call(this,ra.apply(i,b));b.shift();this.Mc=a}t(Ca,qa);Ca.prototype.name="AssertionError";function Da(a,b){throw new Ca("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var Ea=Array.prototype,Fa=Ea.indexOf?function(a,b,c){return Ea.indexOf.call(a,b,c)}:function(a,b,c){c=c==i?0:c<0?Math.max(0,a.length+c):c;if(r(a))return!r(b)||b.length!=1?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Ga=Ea.forEach?function(a,b,c){Ea.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=r(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)};function Ha(a,b){var c=Fa(a,b);c>=0&&Ea.splice.call(a,c,1)}
function Ia(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c],e;if(q(d)||(e=fa(d))&&d.hasOwnProperty("callee"))a.push.apply(a,d);else if(e)for(var f=a.length,h=d.length,k=0;k<h;k++)a[f+k]=d[k];else a.push(d)}};var u,Ja,Ka,La;function Ma(){return l.navigator?l.navigator.userAgent:i}La=Ka=Ja=u=!1;var Na;if(Na=Ma()){var Oa=l.navigator;u=Na.indexOf("Opera")==0;Ja=!u&&Na.indexOf("MSIE")!=-1;Ka=!u&&Na.indexOf("WebKit")!=-1;La=!u&&!Ka&&Oa.product=="Gecko"}var w=Ja,x=La,Pa=Ka,Qa=l.navigator,Ra=(Qa&&Qa.platform||"").indexOf("Mac")!=-1,Sa;
a:{var Ta="",Ua;if(u&&l.opera)var Va=l.opera.version,Ta=typeof Va=="function"?Va():Va;else if(x?Ua=/rv\:([^\);]+)(\)|;)/:w?Ua=/MSIE\s+([^\);]+)(\)|;)/:Pa&&(Ua=/WebKit\/(\S+)/),Ua)var Wa=Ua.exec(Ma()),Ta=Wa?Wa[1]:"";if(w){var Xa,Ya=l.document;Xa=Ya?Ya.documentMode:g;if(Xa>parseFloat(Ta)){Sa=String(Xa);break a}}Sa=Ta}var Za={};function $a(a){Za[a]||(Za[a]=Aa(Sa,a)>=0)}var ab={};function bb(){return ab[9]||(ab[9]=w&&document.documentMode&&document.documentMode>=9)};function cb(a,b){for(var c in a)b.call(g,a[c],c,a)}function db(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function eb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function fb(){var a=y,b;for(b in a)return!1;return!0}var gb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
function hb(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<gb.length;f++)c=gb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var ib;var A=w?"focusin":"DOMFocusIn";!w||bb();w&&$a("8");function C(){}C.prototype.xb=!1;C.prototype.M=function(){if(!this.xb)this.xb=!0,this.o()};C.prototype.o=function(){this.cc&&jb.apply(i,this.cc)};function jb(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];fa(d)?jb.apply(i,d):d&&typeof d.M=="function"&&d.M()}};function D(a,b){this.type=a;this.currentTarget=this.target=b}t(D,C);D.prototype.o=function(){delete this.type;delete this.target;delete this.currentTarget};D.prototype.ea=!1;D.prototype.Oa=!0;var kb=new Function("a","return a");function lb(a,b){a&&this.i(a,b)}t(lb,D);j=lb.prototype;j.target=i;j.relatedTarget=i;j.offsetX=0;j.offsetY=0;j.clientX=0;j.clientY=0;j.screenX=0;j.screenY=0;j.button=0;j.keyCode=0;j.charCode=0;j.ctrlKey=!1;j.altKey=!1;j.shiftKey=!1;j.metaKey=!1;j.vc=!1;j.zb=i;
j.i=function(a,b){var c=this.type=a.type;D.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(x){var e;a:{try{kb(d.nodeName);e=!0;break a}catch(f){}e=!1}e||(d=i)}}else if(c=="mouseover")d=a.fromElement;else if(c=="mouseout")d=a.toElement;this.relatedTarget=d;this.offsetX=a.offsetX!==g?a.offsetX:a.layerX;this.offsetY=a.offsetY!==g?a.offsetY:a.layerY;this.clientX=a.clientX!==g?a.clientX:a.pageX;this.clientY=a.clientY!==g?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||(c=="keypress"?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.vc=Ra?a.metaKey:a.ctrlKey;this.state=a.state;this.zb=a;delete this.Oa;delete this.ea};j.o=function(){lb.n.o.call(this);this.relatedTarget=this.currentTarget=this.target=this.zb=i};function mb(){}var nb=0;j=mb.prototype;j.key=0;j.ga=!1;j.tb=!1;j.i=function(a,b,c,d,e,f){if(ga(a))this.Jb=!0;else if(a&&a.handleEvent&&ga(a.handleEvent))this.Jb=!1;else throw Error("Invalid listener argument");this.wa=a;this.Rb=b;this.src=c;this.type=d;this.capture=!!e;this.hb=f;this.tb=!1;this.key=++nb;this.ga=!1};j.handleEvent=function(a){return this.Jb?this.wa.call(this.hb||this.src,a):this.wa.handleEvent.call(this.wa,a)};var ob,pb=(ob="ScriptEngine"in l&&l.ScriptEngine()=="JScript")?l.ScriptEngineMajorVersion()+"."+l.ScriptEngineMinorVersion()+"."+l.ScriptEngineBuildVersion():"0";function E(a,b){this.Nb=b;this.O=[];if(a>this.Nb)throw Error("[goog.structs.SimplePool] Initial cannot be greater than max");for(var c=0;c<a;c++)this.O.push(this.B?this.B():{})}t(E,C);E.prototype.B=i;E.prototype.wb=i;E.prototype.getObject=function(){return this.O.length?this.O.pop():this.B?this.B():{}};function qb(a,b){a.O.length<a.Nb?a.O.push(b):rb(a,b)}function rb(a,b){if(a.wb)a.wb(b);else if(ha(b))if(ga(b.M))b.M();else for(var c in b)delete b[c]}
E.prototype.o=function(){E.n.o.call(this);for(var a=this.O;a.length;)rb(this,a.pop());delete this.O};var sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb;
(function(){function a(){return{e:0,u:0}}function b(){return[]}function c(){function a(b){b=h.call(a.src,a.key,b);if(!b)return b}return a}function d(){return new mb}function e(){return new lb}var f=ob&&!(Aa(pb,"5.7")>=0),h;xb=function(a){h=a};if(f){sb=function(){return k.getObject()};tb=function(a){qb(k,a)};ub=function(){return n.getObject()};vb=function(a){qb(n,a)};wb=function(){return o.getObject()};yb=function(){qb(o,c())};zb=function(){return B.getObject()};Ab=function(a){qb(B,a)};Bb=function(){return p.getObject()};
Cb=function(a){qb(p,a)};var k=new E(0,600);k.B=a;var n=new E(0,600);n.B=b;var o=new E(0,600);o.B=c;var B=new E(0,600);B.B=d;var p=new E(0,600);p.B=e}else sb=a,tb=m,ub=b,vb=m,wb=c,yb=m,zb=d,Ab=m,Bb=e,Cb=m})();var F={},G={},H={},I={};
function J(a,b,c,d,e){if(b)if(q(b))for(var f=0;f<b.length;f++)J(a,b[f],c,d,e);else{var d=!!d,h=G;b in h||(h[b]=sb());h=h[b];d in h||(h[d]=sb(),h.e++);var h=h[d],k=s(a),n;h.u++;if(h[k]){n=h[k];for(f=0;f<n.length;f++)if(h=n[f],h.wa==c&&h.hb==e){if(h.ga)break;return}}else n=h[k]=ub(),h.e++;f=wb();f.src=a;h=zb();h.i(c,f,a,b,d,e);c=h.key;f.key=c;n.push(h);F[c]=h;H[k]||(H[k]=ub());H[k].push(h);a.addEventListener?(a==l||!a.vb)&&a.addEventListener(b,f,d):a.attachEvent(b in I?I[b]:I[b]="on"+b,f)}else throw Error("Invalid event type");
}function Db(a,b,c,d,e){if(q(b))for(var f=0;f<b.length;f++)Db(a,b[f],c,d,e);else{d=!!d;a:{f=G;if(b in f&&(f=f[b],d in f&&(f=f[d],a=s(a),f[a]))){a=f[a];break a}a=i}if(a)for(f=0;f<a.length;f++)if(a[f].wa==c&&a[f].capture==d&&a[f].hb==e){Eb(a[f].key);break}}}
function Eb(a){if(F[a]){var b=F[a];if(!b.ga){var c=b.src,d=b.type,e=b.Rb,f=b.capture;c.removeEventListener?(c==l||!c.vb)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in I?I[d]:I[d]="on"+d,e);c=s(c);e=G[d][f][c];if(H[c]){var h=H[c];Ha(h,b);h.length==0&&delete H[c]}b.ga=!0;e.Ob=!0;Fb(d,f,c,e);delete F[a]}}}
function Fb(a,b,c,d){if(!d.Ma&&d.Ob){for(var e=0,f=0;e<d.length;e++)if(d[e].ga){var h=d[e].Rb;h.src=i;yb(h);Ab(d[e])}else e!=f&&(d[f]=d[e]),f++;d.length=f;d.Ob=!1;f==0&&(vb(d),delete G[a][b][c],G[a][b].e--,G[a][b].e==0&&(tb(G[a][b]),delete G[a][b],G[a].e--),G[a].e==0&&(tb(G[a]),delete G[a]))}}
function Gb(a){var b,c=0,d=b==i;b=!!b;if(a==i)cb(H,function(a){for(var e=a.length-1;e>=0;e--){var f=a[e];if(d||b==f.capture)Eb(f.key),c++}});else if(a=s(a),H[a])for(var a=H[a],e=a.length-1;e>=0;e--){var f=a[e];if(d||b==f.capture)Eb(f.key),c++}}function Hb(a,b,c,d,e){var f=1,b=s(b);if(a[b]){a.u--;a=a[b];a.Ma?a.Ma++:a.Ma=1;try{for(var h=a.length,k=0;k<h;k++){var n=a[k];n&&!n.ga&&(f&=Ib(n,e)!==!1)}}finally{a.Ma--,Fb(c,d,b,a)}}return Boolean(f)}
function Ib(a,b){var c=a.handleEvent(b);a.tb&&Eb(a.key);return c}
xb(function(a,b){if(!F[a])return!0;var c=F[a],d=c.type,e=G;if(!(d in e))return!0;var e=e[d],f,h;ib===g&&(ib=w&&!l.addEventListener);if(ib){f=b||da("window.event");var k=!0 in e,n=!1 in e;if(k){if(f.keyCode<0||f.returnValue!=g)return!0;a:{var o=!1;if(f.keyCode==0)try{f.keyCode=-1;break a}catch(B){o=!0}if(o||f.returnValue==g)f.returnValue=!0}}o=Bb();o.i(f,this);f=!0;try{if(k){for(var p=ub(),v=o.currentTarget;v;v=v.parentNode)p.push(v);h=e[!0];h.u=h.e;for(var z=p.length-1;!o.ea&&z>=0&&h.u;z--)o.currentTarget=
p[z],f&=Hb(h,p[z],d,!0,o);if(n){h=e[!1];h.u=h.e;for(z=0;!o.ea&&z<p.length&&h.u;z++)o.currentTarget=p[z],f&=Hb(h,p[z],d,!1,o)}}else f=Ib(c,o)}finally{if(p)p.length=0,vb(p);o.M();Cb(o)}return f}d=new lb(b,this);try{f=Ib(c,d)}finally{d.M()}return f});!w||bb();!x&&!w||w&&bb()||x&&$a("1.9.1");w&&$a("9");function Jb(a,b){cb(b,function(b,d){d=="style"?a.style.cssText=b:d=="class"?a.className=b:d=="for"?a.htmlFor=b:d in Kb?a.setAttribute(Kb[d],b):d.lastIndexOf("aria-",0)==0?a.setAttribute(d,b):a[d]=b})}var Kb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};function Lb(){}t(Lb,C);j=Lb.prototype;j.vb=!0;j.pb=i;j.addEventListener=function(a,b,c,d){J(this,a,b,c,d)};j.removeEventListener=function(a,b,c,d){Db(this,a,b,c,d)};
j.dispatchEvent=function(a){var b=a.type||a,c=G;if(b in c){if(r(a))a=new D(a,this);else if(a instanceof D)a.target=a.target||this;else{var d=a,a=new D(b,this);hb(a,d)}var d=1,e,c=c[b],b=!0 in c,f;if(b){e=[];for(f=this;f;f=f.pb)e.push(f);f=c[!0];f.u=f.e;for(var h=e.length-1;!a.ea&&h>=0&&f.u;h--)a.currentTarget=e[h],d&=Hb(f,e[h],a.type,!0,a)&&a.Oa!=!1}if(!1 in c)if(f=c[!1],f.u=f.e,b)for(h=0;!a.ea&&h<e.length&&f.u;h++)a.currentTarget=e[h],d&=Hb(f,e[h],a.type,!1,a)&&a.Oa!=!1;else for(e=this;!a.ea&&e&&
f.u;e=e.pb)a.currentTarget=e,d&=Hb(f,e,a.type,!1,a)&&a.Oa!=!1;a=Boolean(d)}else a=!0;return a};j.o=function(){Lb.n.o.call(this);Gb(this);this.pb=i};var K=l.window;function Mb(a,b,c,d){if(!q(a)||!q(b))throw Error("Start and end parameters must be arrays");if(a.length!=b.length)throw Error("Start and end points must be the same length");this.ya=a;this.kc=b;this.duration=c;this.sb=d;this.coords=[]}t(Mb,Lb);var y={},L=i;function Nb(){Ob();var a=oa(),b;for(b in y)Pb(y[b],a);L=fb()?i:K.setTimeout(Nb,20)}function Ob(){L&&(K.clearTimeout(L),L=i)}function Qb(a){a=s(a);delete y[a];fb()&&Ob()}j=Mb.prototype;j.q=0;j.Eb=0;j.p=0;j.startTime=i;j.yb=i;j.kb=i;
j.play=function(a){if(a||this.q==0)this.p=0,this.coords=this.ya;else if(this.q==1)return!1;Qb(this);this.startTime=oa();this.q==-1&&(this.startTime-=this.duration*this.p);this.yb=this.startTime+this.duration;this.kb=this.startTime;this.p||this.U();M(this,"play");this.q==-1&&M(this,"resume");this.q=1;a=s(this);a in y||(y[a]=this);L||(L=K.setTimeout(Nb,20));Pb(this,this.startTime);return!0};j.stop=function(a){Qb(this);this.q=0;if(a)this.p=1;Rb(this,this.p);M(this,"stop");this.ba()};
j.pause=function(){if(this.q==1)Qb(this),this.q=-1,M(this,"pause")};j.o=function(){this.q!=0&&this.stop(!1);M(this,"destroy");Mb.n.o.call(this)};function Pb(a,b){a.p=(b-a.startTime)/(a.yb-a.startTime);if(a.p>=1)a.p=1;a.Eb=1E3/(b-a.kb);a.kb=b;Rb(a,a.p);a.p==1?(a.q=0,Qb(a),M(a,"finish"),a.ba()):a.q==1&&a.ob()}function Rb(a,b){ga(a.sb)&&(b=a.sb(b));a.coords=Array(a.ya.length);for(var c=0;c<a.ya.length;c++)a.coords[c]=(a.kc[c]-a.ya[c])*b+a.ya[c]}j.ob=function(){M(this,"animate")};
j.U=function(){M(this,"begin")};j.ba=function(){M(this,"end")};function M(a,b){a.dispatchEvent(new Sb(b,a))}function Sb(a,b){D.call(this,a);this.coords=b.coords;this.x=b.coords[0];this.y=b.coords[1];this.Qc=b.coords[2];this.duration=b.duration;this.p=b.p;this.Db=b.Eb;this.state=b.q;this.Ec=b}t(Sb,D);function N(a,b,c,d,e){Mb.call(this,b,c,d,e);this.element=a}t(N,Mb);N.prototype.Ua=m;N.prototype.ob=function(){this.Ua();N.n.ob.call(this)};N.prototype.ba=function(){this.Ua();N.n.ba.call(this)};N.prototype.U=function(){this.Ua();N.n.U.call(this)};function O(a,b,c,d,e){typeof b=="number"&&(b=[b]);typeof c=="number"&&(c=[c]);N.call(this,a,b,c,d,e);if(b.length!=1||c.length!=1)throw Error("Start and end points must be 1D");}t(O,N);
O.prototype.Ua=function(){var a=this.coords[0],b=this.element.style;if("opacity"in b)b.opacity=a;else if("MozOpacity"in b)b.MozOpacity=a;else if("filter"in b)b.filter=a===""?"":"alpha(opacity="+a*100+")"};O.prototype.show=function(){this.element.style.display=""};O.prototype.aa=function(){this.element.style.display="none"};function P(a,b,c){O.call(this,a,1,0,b,c)}t(P,O);P.prototype.U=function(){this.show();P.n.U.call(this)};P.prototype.ba=function(){this.aa();P.n.ba.call(this)};
function Q(a,b,c){O.call(this,a,0,1,b,c)}t(Q,O);Q.prototype.U=function(){this.show();Q.n.U.call(this)};var Tb=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");function Ub(a){if(typeof a.Q=="function")return a.Q();if(r(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return db(a)}function Vb(a,b,c){if(typeof a.forEach=="function")a.forEach(b,c);else if(fa(a)||r(a))Ga(a,b,c);else{var d;if(typeof a.$=="function")d=a.$();else if(typeof a.Q!="function")if(fa(a)||r(a)){d=[];for(var e=a.length,f=0;f<e;f++)d.push(f)}else d=eb(a);else d=g;for(var e=Ub(a),f=e.length,h=0;h<f;h++)b.call(c,e[h],d&&d[h],a)}};function Wb(a,b){this.w={};this.k=[];var c=arguments.length;if(c>1){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else if(a){a instanceof Wb?(c=a.$(),d=a.Q()):(c=eb(a),d=db(a));for(var e=0;e<c.length;e++)this.set(c[e],d[e])}}j=Wb.prototype;j.e=0;j.rb=0;j.Q=function(){Xb(this);for(var a=[],b=0;b<this.k.length;b++)a.push(this.w[this.k[b]]);return a};j.$=function(){Xb(this);return this.k.concat()};j.A=function(a){return R(this.w,a)};
j.clear=function(){this.w={};this.rb=this.e=this.k.length=0};j.remove=function(a){return R(this.w,a)?(delete this.w[a],this.e--,this.rb++,this.k.length>2*this.e&&Xb(this),!0):!1};function Xb(a){if(a.e!=a.k.length){for(var b=0,c=0;b<a.k.length;){var d=a.k[b];R(a.w,d)&&(a.k[c++]=d);b++}a.k.length=c}if(a.e!=a.k.length){for(var e={},c=b=0;b<a.k.length;)d=a.k[b],R(e,d)||(a.k[c++]=d,e[d]=1),b++;a.k.length=c}}j.get=function(a,b){return R(this.w,a)?this.w[a]:b};
j.set=function(a,b){R(this.w,a)||(this.e++,this.k.push(a),this.rb++);this.w[a]=b};j.K=function(){return new Wb(this)};function R(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Yb(a){return Zb(a||arguments.callee.caller,[])}
function Zb(a,b){var c=[];if(Fa(b,a)>=0)c.push("[...circular reference...]");else if(a&&b.length<50){c.push($b(a)+"(");for(var d=a.arguments,e=0;e<d.length;e++){e>0&&c.push(", ");var f;f=d[e];switch(typeof f){case "object":f=f?"object":"null";break;case "string":break;case "number":f=String(f);break;case "boolean":f=f?"true":"false";break;case "function":f=(f=$b(f))?f:"[fn]";break;default:f=typeof f}f.length>40&&(f=f.substr(0,40)+"...");c.push(f)}b.push(a);c.push(")\n");try{c.push(Zb(a.caller,b))}catch(h){c.push("[exception trying to get caller]\n")}}else a?
c.push("[...long stack...]"):c.push("[end]");return c.join("")}function $b(a){if(ac[a])return ac[a];a=String(a);if(!ac[a]){var b=/function ([^\(]+)/.exec(a);ac[a]=b?b[1]:"[Anonymous]"}return ac[a]}var ac={};function S(a,b,c,d,e){this.reset(a,b,c,d,e)}S.prototype.xc=0;S.prototype.Bb=i;S.prototype.Ab=i;var bc=0;S.prototype.reset=function(a,b,c,d,e){this.xc=typeof e=="number"?e:bc++;this.Pc=d||oa();this.va=a;this.qc=b;this.Lc=c;delete this.Bb;delete this.Ab};S.prototype.Vb=function(a){this.va=a};function T(a){this.rc=a}T.prototype.Na=i;T.prototype.va=i;T.prototype.Za=i;T.prototype.Ib=i;function cc(a,b){this.name=a;this.value=b}cc.prototype.toString=function(){return this.name};var dc=new cc("SEVERE",1E3),ec=new cc("WARNING",900),fc=new cc("CONFIG",700),gc=new cc("FINE",500),hc=new cc("FINEST",300);T.prototype.getParent=function(){return this.Na};T.prototype.Vb=function(a){this.va=a};function ic(a){if(a.va)return a.va;if(a.Na)return ic(a.Na);Da("Root logger has no level set.");return i}
T.prototype.log=function(a,b,c){if(a.value>=ic(this).value){a=this.mc(a,b,c);b="log:"+a.qc;l.console&&(l.console.timeStamp?l.console.timeStamp(b):l.console.markTimeline&&l.console.markTimeline(b));l.msWriteProfilerMark&&l.msWriteProfilerMark(b);for(b=this;b;){var c=b,d=a;if(c.Ib)for(var e=0,f=g;f=c.Ib[e];e++)f(d);b=b.getParent()}}};
T.prototype.mc=function(a,b,c){var d=new S(a,String(b),this.rc);if(c){d.Bb=c;var e;var f=arguments.callee.caller;try{var h;var k=da("window.location.href");if(r(c))h={message:c,name:"Unknown error",lineNumber:"Not available",fileName:k,stack:"Not available"};else{var n,o,B=!1;try{n=c.lineNumber||c.Kc||"Not available"}catch(p){n="Not available",B=!0}try{o=c.fileName||c.filename||c.sourceURL||k}catch(v){o="Not available",B=!0}h=B||!c.lineNumber||!c.fileName||!c.stack?{message:c.message,name:c.name,
lineNumber:n,fileName:o,stack:c.stack||"Not available"}:c}e="Message: "+ua(h.message)+'\nUrl: <a href="view-source:'+h.fileName+'" target="_new">'+h.fileName+"</a>\nLine: "+h.lineNumber+"\n\nBrowser stack:\n"+ua(h.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+ua(Yb(f)+"-> ")}catch(z){e="Exception trying to expose exception! You win, we lose. "+z}d.Ab=e}return d};function U(a,b){a.log(gc,b,g)}var jc={},kc=i;
function lc(a){kc||(kc=new T(""),jc[""]=kc,kc.Vb(fc));var b;if(!(b=jc[a])){b=new T(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=lc(a.substr(0,c));if(!c.Za)c.Za={};c.Za[d]=b;b.Na=c;jc[a]=b}return b};function mc(){if(x)this.L={},this.Xa={},this.Qa=[]}mc.prototype.h=lc("goog.net.xhrMonitor");mc.prototype.Fa=x;function nc(a){var b=oc;if(b.Fa){var c=r(a)?a:ha(a)?s(a):"";b.h.log(hc,"Pushing context: "+a+" ("+c+")",g);b.Qa.push(c)}}function pc(){var a=oc;if(a.Fa){var b=a.Qa.pop();a.h.log(hc,"Popping context: "+b,g);qc(a,b)}}function rc(a){var b=oc;if(b.Fa){a=s(a);U(b.h,"Opening XHR : "+a);for(var c=0;c<b.Qa.length;c++){var d=b.Qa[c];sc(b.L,d,a);sc(b.Xa,a,d)}}}
function qc(a,b){var c=a.Xa[b],d=a.L[b];c&&d&&(a.h.log(hc,"Updating dependent contexts",g),Ga(c,function(a){Ga(d,function(b){sc(this.L,a,b);sc(this.Xa,b,a)},this)},a))}function sc(a,b,c){a[b]||(a[b]=[]);Fa(a[b],c)>=0||a[b].push(c)}var oc=new mc;function tc(){}tc.prototype.Ca=i;function uc(){return vc(wc)}var wc;function xc(){}t(xc,tc);function vc(a){return(a=yc(a))?new ActiveXObject(a):new XMLHttpRequest}function zc(a){var b={};yc(a)&&(b[0]=!0,b[1]=!0);return b}xc.prototype.ib=i;
function yc(a){if(!a.ib&&typeof XMLHttpRequest=="undefined"&&typeof ActiveXObject!="undefined"){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.ib=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.ib}wc=new xc;function V(a){this.headers=new Wb;this.la=a||i}t(V,Lb);V.prototype.h=lc("goog.net.XhrIo");var Ac=/^https?:?$/i,Bc=[];function Cc(a,b){var c=new V;Bc.push(c);b&&J(c,"complete",b);J(c,"ready",na(Dc,c));c.send(a,g,g,g)}function Dc(a){a.M();Ha(Bc,a)}j=V.prototype;j.F=!1;j.f=i;j.Wa=i;j.ua="";j.Lb="";j.sa=0;j.ta="";j.bb=!1;j.Ja=!1;j.jb=!1;j.R=!1;j.Ta=0;j.X=i;j.Sb="";j.Dc=!1;
j.send=function(a,b,c,d){if(this.f)throw Error("[goog.net.XhrIo] Object is active with another request");b=b?b.toUpperCase():"GET";this.ua=a;this.ta="";this.sa=0;this.Lb=b;this.bb=!1;this.F=!0;this.f=this.la?vc(this.la):new uc;this.Wa=this.la?this.la.Ca||(this.la.Ca=zc(this.la)):wc.Ca||(wc.Ca=zc(wc));rc(this.f);this.f.onreadystatechange=ma(this.Pb,this);try{U(this.h,W(this,"Opening Xhr")),this.jb=!0,this.f.open(b,a,!0),this.jb=!1}catch(e){U(this.h,W(this,"Error opening Xhr: "+e.message));Ec(this,
e);return}var a=c||"",f=this.headers.K();d&&Vb(d,function(a,b){f.set(b,a)});b=="POST"&&!f.A("Content-Type")&&f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");Vb(f,function(a,b){this.f.setRequestHeader(b,a)},this);if(this.Sb)this.f.responseType=this.Sb;if("withCredentials"in this.f)this.f.withCredentials=this.Dc;try{if(this.X)K.clearTimeout(this.X),this.X=i;if(this.Ta>0)U(this.h,W(this,"Will abort after "+this.Ta+"ms if incomplete")),this.X=K.setTimeout(ma(this.za,this),this.Ta);
U(this.h,W(this,"Sending request"));this.Ja=!0;this.f.send(a);this.Ja=!1}catch(h){U(this.h,W(this,"Send error: "+h.message)),Ec(this,h)}};j.dispatchEvent=function(a){if(this.f){nc(this.f);try{return V.n.dispatchEvent.call(this,a)}finally{pc()}}else return V.n.dispatchEvent.call(this,a)};j.za=function(){if(typeof ba!="undefined"&&this.f)this.ta="Timed out after "+this.Ta+"ms, aborting",this.sa=8,U(this.h,W(this,this.ta)),this.dispatchEvent("timeout"),this.abort(8)};
function Ec(a,b){a.F=!1;if(a.f)a.R=!0,a.f.abort(),a.R=!1;a.ta=b;a.sa=5;Fc(a);Gc(a)}function Fc(a){if(!a.bb)a.bb=!0,a.dispatchEvent("complete"),a.dispatchEvent("error")}j.abort=function(a){if(this.f&&this.F)U(this.h,W(this,"Aborting")),this.F=!1,this.R=!0,this.f.abort(),this.R=!1,this.sa=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),Gc(this)};j.o=function(){if(this.f){if(this.F)this.F=!1,this.R=!0,this.f.abort(),this.R=!1;Gc(this,!0)}V.n.o.call(this)};
j.Pb=function(){!this.jb&&!this.Ja&&!this.R?this.sc():Hc(this)};j.sc=function(){Hc(this)};
function Hc(a){if(a.F&&typeof ba!="undefined")if(a.Wa[1]&&Ic(a)==4&&Jc(a)==2)U(a.h,W(a,"Local request error detected and ignored"));else if(a.Ja&&Ic(a)==4)K.setTimeout(ma(a.Pb,a),0);else if(a.dispatchEvent("readystatechange"),Ic(a)==4){U(a.h,W(a,"Request complete"));a.F=!1;var b;a:switch(Jc(a)){case 0:b=r(a.ua)?a.ua.match(Tb)[1]||i:a.ua.D;b=!(b?Ac.test(b):self.location?Ac.test(self.location.protocol):1);break a;case 200:case 204:case 304:case 1223:b=!0;break a;default:b=!1}if(b)a.dispatchEvent("complete"),
a.dispatchEvent("success");else{a.sa=6;var c;try{c=Ic(a)>2?a.f.statusText:""}catch(d){U(a.h,"Can not get status: "+d.message),c=""}a.ta=c+" ["+Jc(a)+"]";Fc(a)}Gc(a)}}
function Gc(a,b){if(a.f){var c=a.f,d=a.Wa[0]?m:i;a.f=i;a.Wa=i;if(a.X)K.clearTimeout(a.X),a.X=i;b||(nc(c),a.dispatchEvent("ready"),pc());var e=oc;if(e.Fa){var f=s(c);U(e.h,"Closing XHR : "+f);delete e.Xa[f];for(var h in e.L)Ha(e.L[h],f),e.L[h].length==0&&delete e.L[h]}try{c.onreadystatechange=d}catch(k){a.h.log(dc,"Problem encountered resetting onreadystatechange: "+k.message,g)}}}function Ic(a){return a.f?a.f.readyState:0}
function Jc(a){try{return Ic(a)>2?a.f.status:-1}catch(b){return a.h.log(ec,"Can not get status: "+b.message,g),-1}}function Kc(a){try{return a.f?a.f.responseText:""}catch(b){return U(a.h,"Can not get responseText: "+b.message),""}}function W(a,b){return b+" ["+a.Lb+" "+a.ua+" "+Jc(a)+"]"};function Lc(a){this.b=a;this.c=i;this.$a="remote";this.bc=this.ca=i}
Lc.prototype={aa:function(a,b){var c=isNaN(b)||b==i?200:b;a===i&&(a=aa());this.c.style.display=="none"?a():(c=new P(this.c,c),J(c,"end",a),c.play())},go:function(a){var b=this.c,c=this;this.bc=a;if(this.$a=="remote")this.aa(function(){Cc(c.ca[a].path,function(d){d=Kc(d.target);b.innerHTML=d;c.ca[a].onload instanceof Object&&setTimeout(c.ca[a].onload,0);d=new Q(b,300);J(d,"end",function(){c.ca[a].Qb instanceof Object&&setTimeout(c.ca[a].Qb,0)});d.play()})});else if(this.$a=="appcelerator"){var d="overlays/"+
a+".html",e=Titanium.Yb.Hc(),f=Titanium.Yb.getFile(e,d).Nc(),c=this;$("#overlay").Gc(200,function(){$("#overlay").Ic(f).Fc(300,function(){callback instanceof Object&&setTimeout(callback,0)})})}},i:function(a,b){this.$a=a;this.ca=b;var c=document.getElementById("canvasContainer");this.c=document.createElement("div");this.c.id="overlay";this.c.style.position="absolute";this.c.style.top="0";this.c.style.display="none";c.appendChild(this.c);this.b.log("Initalised Overlay.")}};function Mc(){this.enabled=!0}Mc.prototype={i:function(a){this.enabled=a;this.log("Initalised Logger")},log:function(a){this.enabled&&typeof console!=="undefined"&&console.log(a)}};function Nc(a){this.b=a}
Nc.prototype={i:function(){this.log("Initalised LocalStorageDb")},removeItem:function(a){window.localStorage.removeItem(a);this.log("Removed: "+a)},setItem:function(a,b){try{window.localStorage.removeItem(a),window.localStorage.setItem(a,b)}catch(c){this.log("Error inside setItem"),this.log(c)}this.log("Storage set item for: "+a)},lc:function(a){value=this.getItem(a);value=="true"&&(value=!0);value=="false"&&(value=!1);return value},getItem:function(a){var b;try{b=window.localStorage.getItem(a)}catch(c){this.log("Error inside getItem() for key:"+a),
this.log(c),b=i}this.log("Storage returning value for: "+a+" value:"+b);return b},log:function(a){this.b.log(a)}};function Oc(a){this.b=a;this.I=[];this.l=[];this.j=[];this.Ya=this.Da=this.T=!1;this.J=!0}
Oc.prototype={i:function(a){var b=document.createElement("audio");if(this.J=!!b.canPlayType){this.Da=b.canPlayType("audio/ogg")!=="no"&&b.canPlayType("audio/ogg")!=="";this.Ya=b.canPlayType("audio/mpeg")!=="no"&&b.canPlayType("audio/mpeg")!=="";this.b.log("AudioPlayer: Audio support: "+(this.J?"Yes":"No"));this.b.log("AudioPlayer: Mp3 support: "+(this.Ya?"Yes":"No"));this.b.log("AudioPlayer: Ogg support: "+(this.Da?"Yes":"No"));this.I=a;var a=0,c;for(c in this.I){for(var b=[],d=0;d<this.I[c].j;d++){var e=
new Audio(this.wc(this.I[c].file));e.volume=this.I[c].volume;e.load();b.push({xa:e,Cb:0});a++}this.l[this.I[c].fa]={j:b,duration:g,Mb:0,V:this.I[c].V}}this.b.log("Sfx Initalised. "+this.I.length+" sound effects, "+a+" channels");return!0}else this.b.log("Audio not supported")},wc:function(a){if(typeof a=="object"){var b=a.mp3,a=a.ogg;if(this.Da&&a!==g)return a;else if(this.Ya&&b!==g)return b;else if(a!==g)return a;else if(b!==g)return b}else return a},play:function(a){if(!this.T&&this.J){var b=new Date;
if(this.l[a].duration==g&&!isNaN(this.l[a].j[0].xa.duration))this.l[a].duration=this.l[a].j[0].xa.duration;else if(isNaN(this.l[a].j[0].xa.duration)){this.b.log('"'+a+'" not ready to play... duration : '+this.l[a].j[0].xa.duration);return}if(!(b.getTime()-this.l[a].Mb<1)){this.l[a].Mb=b.getTime();for(var c=0;c<this.l[a].j.length;c++)if(this.l[a].j[c].Cb<b.getTime()){this.l[a].j[c].Cb=b.getTime()+this.l[a].duration*1E3;this.l[a].j[c].xa.play();break}}}}};ca("rocket.game.Controller",Pc);function Pc(a){this.Fb=a;this.ja=this.ka=i;this.Y=[];this.oa=0;this.i()}
Pc.prototype={i:function(){this.Fb.i();this.ia()},ia:function(){this.ja=new Date;if(!this.ka)this.ka=this.ja;this.Fb.ia(this.ja-this.ka);this.Db=1E3/(this.ja-this.ka);this.Y.push(this.Db);if(this.Y.length>30){var a=0,b;for(b in this.Y)a+=this.Y[b];this.oa=Math.round(a/this.Y.length);this.Y=[];this.oa>35&&this.Oc++;if(!isNaN(this.oa)&&isFinite(this.oa))document.getElementById("fps").innerHTML=""+this.oa}this.ka=this.ja;a=30-(this.ja-this.ka);a<1&&(a=1);setTimeout(function(){controller.ia()},a)}};function Qc(a,b){var c;a instanceof Qc?(this.ha(b==i?a.v:b),Rc(this,a.D),Sc(this,a.Ba),Tc(this,a.N),Uc(this,a.da),Vc(this,a.W),Wc(this,a.z.K()),Xc(this,a.pa)):a&&(c=String(a).match(Tb))?(this.ha(!!b),Rc(this,c[1]||"",!0),Sc(this,c[2]||"",!0),Tc(this,c[3]||"",!0),Uc(this,c[4]),Vc(this,c[5]||"",!0),Wc(this,c[6]||"",!0),Xc(this,c[7]||"",!0)):(this.ha(!!b),this.z=new Yc(i,this,this.v))}j=Qc.prototype;j.D="";j.Ba="";j.N="";j.da=i;j.W="";j.pa="";j.nc=!1;j.v=!1;
j.toString=function(){if(this.r)return this.r;var a=[];this.D&&a.push(Zc(this.D,$c),":");this.N&&(a.push("//"),this.Ba&&a.push(Zc(this.Ba,$c),"@"),a.push(r(this.N)?encodeURIComponent(this.N):i),this.da!=i&&a.push(":",String(this.da)));this.W&&(this.N&&this.W.charAt(0)!="/"&&a.push("/"),a.push(Zc(this.W,this.W.charAt(0)=="/"?ad:bd)));var b=String(this.z);b&&a.push("?",b);this.pa&&a.push("#",Zc(this.pa,cd));return this.r=a.join("")};
j.K=function(){var a=this.D,b=this.Ba,c=this.N,d=this.da,e=this.W,f=this.z.K(),h=this.pa,k=new Qc(i,this.v);a&&Rc(k,a);b&&Sc(k,b);c&&Tc(k,c);d&&Uc(k,d);e&&Vc(k,e);f&&Wc(k,f);h&&Xc(k,h);return k};function Rc(a,b,c){X(a);delete a.r;a.D=c?b?decodeURIComponent(b):"":b;if(a.D)a.D=a.D.replace(/:$/,"")}function Sc(a,b,c){X(a);delete a.r;a.Ba=c?b?decodeURIComponent(b):"":b}function Tc(a,b,c){X(a);delete a.r;a.N=c?b?decodeURIComponent(b):"":b}
function Uc(a,b){X(a);delete a.r;if(b){b=Number(b);if(isNaN(b)||b<0)throw Error("Bad port number "+b);a.da=b}else a.da=i}function Vc(a,b,c){X(a);delete a.r;a.W=c?b?decodeURIComponent(b):"":b}function Wc(a,b,c){X(a);delete a.r;b instanceof Yc?(a.z=b,a.z.Aa=a,a.z.ha(a.v)):(c||(b=Zc(b,dd)),a.z=new Yc(b,a,a.v))}function ed(a,b,c){X(a);delete a.r;q(c)||(c=[String(c)]);a=a.z;Y(a);fd(a);b=Z(a,b);if(a.A(b)){var d=a.g.get(b);q(d)?a.e-=d.length:a.e--}c.length>0&&(a.g.set(b,c),a.e+=c.length)}
function Xc(a,b,c){X(a);delete a.r;a.pa=c?b?decodeURIComponent(b):"":b}function X(a){if(a.nc)throw Error("Tried to modify a read-only Uri");}j.ha=function(a){this.v=a;this.z&&this.z.ha(a);return this};var gd=/^[a-zA-Z0-9\-_.!~*'():\/;?]*$/;function Zc(a,b){var c=i;r(a)&&(c=a,gd.test(c)||(c=encodeURI(a)),c.search(b)>=0&&(c=c.replace(b,hd)));return c}function hd(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var $c=/[#\/\?@]/g,bd=/[\#\?:]/g,ad=/[\#\?]/g,dd=/[\#\?@]/g,cd=/#/g;
function Yc(a,b,c){this.C=a||i;this.Aa=b||i;this.v=!!c}function Y(a){if(!a.g&&(a.g=new Wb,a.e=0,a.C))for(var b=a.C.split("&"),c=0;c<b.length;c++){var d=b[c].indexOf("="),e=i,f=i;d>=0?(e=b[c].substring(0,d),f=b[c].substring(d+1)):e=b[c];e=decodeURIComponent(e.replace(/\+/g," "));e=Z(a,e);a.add(e,f?decodeURIComponent(f.replace(/\+/g," ")):"")}}j=Yc.prototype;j.g=i;j.e=i;
j.add=function(a,b){Y(this);fd(this);a=Z(this,a);if(this.A(a)){var c=this.g.get(a);q(c)?c.push(b):this.g.set(a,[c,b])}else this.g.set(a,b);this.e++;return this};j.remove=function(a){Y(this);a=Z(this,a);if(this.g.A(a)){fd(this);var b=this.g.get(a);q(b)?this.e-=b.length:this.e--;return this.g.remove(a)}return!1};j.clear=function(){fd(this);this.g&&this.g.clear();this.e=0};j.A=function(a){Y(this);a=Z(this,a);return this.g.A(a)};
j.$=function(){Y(this);for(var a=this.g.Q(),b=this.g.$(),c=[],d=0;d<b.length;d++){var e=a[d];if(q(e))for(var f=0;f<e.length;f++)c.push(b[d]);else c.push(b[d])}return c};j.Q=function(a){Y(this);if(a)if(a=Z(this,a),this.A(a)){var b=this.g.get(a);if(q(b))return b;else a=[],a.push(b)}else a=[];else for(var b=this.g.Q(),a=[],c=0;c<b.length;c++){var d=b[c];q(d)?Ia(a,d):a.push(d)}return a};
j.set=function(a,b){Y(this);fd(this);a=Z(this,a);if(this.A(a)){var c=this.g.get(a);q(c)?this.e-=c.length:this.e--}this.g.set(a,b);this.e++;return this};j.get=function(a,b){Y(this);a=Z(this,a);if(this.A(a)){var c=this.g.get(a);return q(c)?c[0]:c}else return b};
j.toString=function(){if(this.C)return this.C;if(!this.g)return"";for(var a=[],b=0,c=this.g.$(),d=0;d<c.length;d++){var e=c[d],f=ta(e),e=this.g.get(e);if(q(e))for(var h=0;h<e.length;h++)b>0&&a.push("&"),a.push(f),e[h]!==""&&a.push("=",ta(e[h])),b++;else b>0&&a.push("&"),a.push(f),e!==""&&a.push("=",ta(e)),b++}return this.C=a.join("")};function fd(a){delete a.ab;delete a.C;a.Aa&&delete a.Aa.r}j.K=function(){var a=new Yc;if(this.ab)a.ab=this.ab;if(this.C)a.C=this.C;if(this.g)a.g=this.g.K();return a};
function Z(a,b){var c=String(b);a.v&&(c=c.toLowerCase());return c}j.ha=function(a){a&&!this.v&&(Y(this),fd(this),Vb(this.g,function(a,c){var d=c.toLowerCase();c!=d&&(this.remove(c),this.add(d,a))},this));this.v=a};function id(a,b){this.Aa=new Qc(a);this.$b=b?b:"callback";this.za=5E3}var jd=0;
id.prototype.send=function(a,b,c,d){a=a||i;if(!document.documentElement.firstChild)return c&&c(a),i;d=d||"_"+(jd++).toString(36)+oa().toString(36);l._callbacks_||(l._callbacks_={});var e=document.createElement("script"),f=i;this.za>0&&(f=l.setTimeout(kd(d,e,a,c),this.za));c=this.Aa.K();if(a)for(var h in a)(!a.hasOwnProperty||a.hasOwnProperty(h))&&ed(c,h,a[h]);b&&(l._callbacks_[d]=ld(d,e,b,f),ed(c,this.$b,"_callbacks_."+d));Jb(e,{type:"text/javascript",id:d,charset:"UTF-8",src:c.toString()});document.getElementsByTagName("head")[0].appendChild(e);
return{Jc:d,za:f}};function kd(a,b,c,d){return function(){md(a,b,!1);d&&d(c)}}function ld(a,b,c,d){return function(e){l.clearTimeout(d);md(a,b,!0);c.apply(g,arguments)}}function md(a,b,c){l.setTimeout(function(){b&&b.parentNode&&b.parentNode.removeChild(b)},0);l._callbacks_[a]&&(c?delete l._callbacks_[a]:l._callbacks_[a]=m)};ca("rocket.stb.SpotTheBall",nd);function nd(){this.b=new Mc;this.d=new Oc(this.b);this.s=new pa(this.b);this.c=new Lc(this.b);this.t=[];this.m=new Nc(this.b);this.qa=this.G=!1;this.Bc=this.Cc=this.Ub=this.Tb=this.S=this.Z=this.P=this.Ia=this.Ha=this.cb=i;this.Pa="http://www.spottheball.com/stb/";this.Ra=this.Sa=this.Xb=i}
nd.prototype={i:function(){if(this.ac()){this.b.i(!1);this.d.i([{fa:"click",file:{ogg:"client/sfx/click.ogg",mp3:"client/sfx/click.mp3"},volume:0.3,j:5,V:!1},{fa:"kick",file:{ogg:"client/sfx/kick.ogg",mp3:"client/sfx/kick.mp3"},volume:0.8,j:3,V:!1},{fa:"camera",file:{ogg:"client/sfx/camera.ogg",mp3:"client/sfx/camera.mp3"},volume:1,j:1,V:!1},{fa:"cheer",file:{ogg:"client/sfx/cheer.ogg",mp3:"client/sfx/cheer.mp3"},volume:0.8,j:1,V:!1},{fa:"whistle",file:{ogg:"client/sfx/whistle.ogg",mp3:"client/sfx/whistle.mp3"},
volume:0.15,j:1,V:!1},{fa:"vuvuzela",file:{ogg:"client/sfx/vuvuzela.ogg",mp3:"client/sfx/vuvuzela.mp3"},volume:0.6,j:1,V:!1}]);this.s.i();var a=this;this.c.i("remote",{submit:{path:"client/overlay/submit.html",onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}var d=document.getElementById("entry_name"),e=document.getElementById("entry_email");d.value=a.m.getItem("user_name")==i?"":a.m.getItem("user_name");e.value=a.m.getItem("user_email")==i?"":a.m.getItem("user_email");
if(!("placeholder"in d)&&d.value=="")d.value="Your Name",J(d,"focus",function(){if(this.value=="Your Name")this.value=""}),J(d,"blur",function(){if(this.value=="")this.value="Your Name"});if(!("placeholder"in e)&&e.value=="")e.value="Your Email Address",J(e,"focus",function(){if(this.value=="Your Email Address")this.value=""}),J(e,"blur",function(){if(this.value=="")this.value="Your Email Address"});if(d=document.getElementsByTagName("button"))for(e=0;e<d.length;e++)J(d[e],"mouseover",c),J(d[e],A,
c),J(d[e],"click",b);J(document.getElementById("goHome"),"click",function(){a.G=!1;a.c.go("home")});J(document.getElementById("submit"),"click",function(){a.yc(document.getElementById("entry_name").value=="Your Name"?"":document.getElementById("entry_name").value,document.getElementById("entry_email").value=="Your Email Address"?"":document.getElementById("entry_email").value)})}},tellFriend:{path:"client/overlay/tell-friend.html",onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}
var d=document.getElementById("from_name"),e=document.getElementById("friend_name"),f=document.getElementById("friend_email");d.value=a.m.getItem("user_name")==i?"":a.m.getItem("user_name");e.value=a.Sa==g?"":a.Sa;f.value=a.Ra==g?"":a.Ra;if(!("placeholder"in e)&&e.value=="")e.value="Your Friend's Name",J(e,"focus",function(){if(this.value=="Your Friend's Name")this.value=""}),J(e,"blur",function(){if(this.value=="")this.value="Your Friend's Name"});if(!("placeholder"in f)&&f.value=="")f.value="Your Friend's Email Address",
J(f,"focus",function(){if(this.value=="Your Friend's Email Address")this.value=""}),J(f,"blur",function(){if(this.value=="")this.value="Your Friend's Email Address"});var h=document.getElementsByTagName("button");if(h)for(var k=0;k<h.length;k++)J(h[k],"mouseover",c),J(h[k],A,c),J(h[k],"click",b);J(document.getElementById("submit"),"click",function(){a.zc(d.value=="Your Name"?"":d.value,e.value=="Your Friend's Name"?"":e.value,f.value=="Your Friend's Email Address"?"":f.value)})}},submitError:{path:"client/overlay/submit-error.html",
onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}document.getElementById("submitError").innerHTML=a.qb;var d=document.getElementsByTagName("button");if(d)for(var e=0;e<d.length;e++)J(d[e],"mouseover",c),J(d[e],A,c),J(d[e],"click",b);J(document.getElementById("back"),"click",function(){a.c.go("submit")})}},tellFriendError:{path:"client/overlay/submit-error.html",onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}document.getElementById("submitError").innerHTML=
a.Xb;var d=document.getElementsByTagName("button");if(d)for(var e=0;e<d.length;e++)J(d[e],"mouseover",c),J(d[e],A,c),J(d[e],"click",b);J(document.getElementById("back"),"click",function(){a.c.go("tellFriend")})}},home:{path:"client/overlay/home.html",onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}var d=document.getElementsByTagName("button");if(d)for(var e=0;e<d.length;e++)J(d[e],"mouseover",c),J(d[e],A,c),J(d[e],"click",b);J(document.getElementById("playNow"),
"click",function(){a.b.log("Playing");a.c.aa(function(){a.Wb()},700)});J(document.getElementById("latestResult"),"click",function(){a.b.log("Loading result...");a.c.go("loading");a.eb="resultMontage";a.s.lb(a.Tb,function(){a.b.log("Result photograph downloaded");setTimeout(function(){a.c.aa(aa());a.Wb()},500);setTimeout(function(){a.c.go("result")},2500)})});document.getElementById("sponsorButton").innerHTML=a.P;document.getElementById("sponsorName").innerHTML=a.P;document.getElementById("prize").innerHTML=
a.Ia;document.getElementById("resultThumbnail").src=a.Ub;J(document.getElementById("sponsorButton"),"click",function(){window.open(a.Z,"sponsor")})},Qb:function(){setTimeout(function(){var a=new Q(document.getElementById("sponsorInformation"),500);J(a,"end",aa());a.play()},600);setTimeout(function(){var a=new Q(document.getElementById("latestResultContainer"),500);J(a,"end",aa());a.play()},300)}},result:{path:"client/overlay/result.html",onload:function(){function b(){a.d.play("click")}var c=document.getElementsByTagName("button");
if(c)for(var d=0;d<c.length;d++)J(c[d],"mouseover",b),J(c[d],A,b);J(document.getElementById("playNow"),"click",function(){a.d.play("cheer");a.G=!1;a.b.log("Playing");a.c.go("loading");setTimeout(function(){a.H()},1E3)})}},submitSuccess:{path:"client/overlay/submit-success.html",onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}var d=document.getElementsByTagName("button");if(d)for(var e=0;e<d.length;e++)J(d[e],"mouseover",c),J(d[e],A,c),J(d[e],"click",b);J(document.getElementById("tellFriend"),
"click",function(){a.c.go("tellFriend")});J(document.getElementById("goHome"),"click",function(){a.G=!1;a.c.go("home")});document.getElementById("sponsorButton").innerHTML="Visit "+a.P;J(document.getElementById("sponsorButton"),"click",function(){window.open(a.Z,"sponsor")})}},tellFriendSuccess:{path:"client/overlay/tell-friend-success.html",onload:function(){function b(){a.d.play("vuvuzela")}function c(){a.d.play("click")}var d=document.getElementsByTagName("button");if(d)for(var e=0;e<d.length;e++)J(d[e],
"mouseover",c),J(d[e],A,c),J(d[e],"click",b);J(document.getElementById("tellFriend"),"click",function(){a.c.go("tellFriend")});J(document.getElementById("goHome"),"click",function(){a.G=!1;a.c.go("home")});document.getElementById("sponsorButton").innerHTML="Visit "+a.P;J(document.getElementById("sponsorButton"),"click",function(){window.open(a.Z,"sponsor")})}},loading:{path:"client/overlay/loading.html",onload:aa()}});setTimeout(function(){a.c.go("loading")},500);J(document.getElementById("ctx"),
"click",function(){a.G&&!a.qa&&a.Zb(a.s.mb-a.s.fb,a.s.nb-a.s.gb)});J(document.getElementById("audio"),"click",function(){a.d.T===!0?a.Ac():a.T()});document.location.hash==""||document.location.hash==i||document.location.hash==g?setTimeout(function(){a.H()},500):setTimeout(function(){a.pc(document.location.hash)},500);if(this.d.J)this.S=this.d.Da?new Audio("client/sfx/music.ogg"):new Audio("client/sfx/music.mp3"),this.S.autoplay=!0,this.S.loop=!0,this.S.volume=0.15,this.S.load();this.oc();this.b.log("Initalised Spot The Ball Game.")}},
oc:function(){this.m.lc("mute")===!0&&this.T();this.Cc=this.m.getItem("user_name");this.Bc=this.m.getItem("user_email")},T:function(){this.d.T=!0;this.d.J&&this.S.pause();document.getElementById("audio").style.backgroundImage="url(client/img/audio_off.png)";this.m.setItem("mute",!0)},Ac:function(){this.d.T=!1;this.d.J&&this.S.play();document.getElementById("audio").style.backgroundImage="url(client/img/audio_on.png)";this.m.setItem("mute",!1)},Wb:function(){this.b.log("Game started");this.G=!0;this.qa=
!1;this.t=[];this.s.na=0;this.d.play("camera")},H:function(){var a=this;this.b.log("Fetching game data...");(new id(this.Pa+"api/game/","callback")).send({},function(b){a.b.log("Downloaded game data");a.b.log(b);if(b.status){var c=new Date;a.Ia=b.prize;a.P=b.sponsor;a.Z=b.sponsorUrl;a.Tb=b.resultImage;a.Ub=b.resultThumbnail;a.eb="play";a.Ha=new Date(c.getTime()+b.secondsRemaining*1E3);a.cb=b.id;a.b.log("game ends: "+a.Ha+" : "+a.Gb());a.s.lb(b.image,function(){a.b.log("Game photograph downloaded");
setTimeout(function(){a.c.go("home")},500)})}else a.b.log("No game found..."),setTimeout(a.H,1E4)},function(){setTimeout(function(){a.H()},2E3)})},pc:function(a){var b=this;this.b.log("Fetching game result data...");(new id(this.Pa+"api/result/","callback")).send({ref:a},function(a){b.b.log("Downloaded game result data");b.b.log(a);a.status?(b.Ia=a.prize,b.P=a.sponsor,b.Z=a.sponsorUrl,b.eb="result",b.cb=a.id,b.t=[{left:a.entryOne.x,top:a.entryOne.y},{left:a.entryTwo.x,top:a.entryTwo.y},{left:a.entryThree.x,
top:a.entryThree.y}],b.s.lb(a.image,function(){b.b.log("Game photograph downloaded");setTimeout(function(){b.c.aa(function(){b.G=!0;b.qa=!0;b.s.na=0;b.d.play("camera");setTimeout(function(){b.c.go("result")},2500)},500)},500)})):(b.b.log("Fetching result failed... loading current game"),b.H())},function(){setTimeout(function(){b.H()},2E3)})},yc:function(a,b){var c=this;this.m.setItem("user_name",a);this.m.setItem("user_email",b);this.Kb(b)?(this.b.log("Submitting competition entry..."),(new id(this.Pa+
"api/submit/","callback")).send({name:a,email:b,gameId:this.cb,guess_one:this.t[0].left+"x"+this.t[0].top,guess_two:this.t[1].left+"x"+this.t[1].top,guess_three:this.t[2].left+"x"+this.t[2].top},function(a){c.b.log(" result");c.b.log(a);a.status==!0?(c.b.log("Entry success"),c.c.go("submitSuccess"),c.d.play("cheer")):(c.qb=a.error,c.c.go("submitError"))},function(){setTimeout(function(){c.H()},2E3)})):(c.qb="Please enter a valid email address!",c.c.go("submitError"))},zc:function(a,b,c){var d=this;
this.m.setItem("user_name",a);this.Sa=b;this.Ra=c;this.Kb(c)?(this.b.log("Submitting Tell a friend..."),(new id(this.Pa+"api/tell_friend/","callback")).send({from_name:a,friend_name:b,friend_email:c},function(a){a.status==!0?(d.Sa="",d.Ra="",d.b.log("Tell friend success"),d.c.go("tellFriendSuccess"),d.d.play("cheer")):(d.b.log("Tell friend failed"),d.qb=a.error,d.c.go("tellFriendError"))},function(){setTimeout(function(){d.H()},2E3)})):(d.Xb="You friends email address is invalid!",d.c.go("tellFriendError"))},
Zb:function(a,b){this.d.play("kick");this.t.push({left:a,top:b});if(this.t.length==3){this.qa=!0;this.d.play("whistle");var c=this;setTimeout(function(){c.c.go("submit")},1E3)}},ia:function(a){this.s.ia(a,this.G,this.qa,this.t,this.Ha==i?!1:this.Gb(),this.Ia,this.P,this.Z,this.eb)},Gb:function(){var a=this.Ha.getTime()-(new Date).getTime(),b=Math.floor(a/864E5),c=Math.floor((a-b*864E5)/36E5),d=Math.floor((a-b*864E5-c*36E5)/6E4),a=Math.floor((a-b*864E5-c*36E5-d*6E4)/1E3);return b+" day"+(b==1?"":"s")+
" "+c+" hour"+(c==1?"":"s")+" "+d+" minute"+(d==1?"":"s")+" and "+a+" second"+(a==1?"":"s")},Kb:function(a){return RegExp("^([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22))*\\x40([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d))*$").test(a)?
!0:!1},ac:function(){var a=!0,b=document.createElement("canvas");if(!b.getContext||!b.getContext("2d"))a=!1;if(a)return!0;document.getElementById("bgContainer").style.display="none";a=document.createElement("div");a.innerHTML="<div class='terms'><div class='inner' style='padding:20px 40px; color:#fff;'><h3>Oh no!</h3><p>Your browser doesn't support this website! SpotTheBall.com requires a modern browser. We suggest you use Google Chrome or Firefox. Click the link below for more information on how to upgrade:</p><p style='text-align:center;'><a href='http://www.whatbrowser.org/' target='_NEW' style='color:#fff; font-size:1.3em;'>Click here for information on upgrading your browser.</a></p></div></div>";
b=document.getElementById("canvasContainer");b.style.marginTop=0;b.appendChild(a);return!1}};

