!function(){function Asteroids(){function Vector(t,e){"Object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e)}function Line(t,e){this.p1=t,this.p2=e}window.ASTEROIDS||(window.ASTEROIDS={enemiesKilled:0}),Vector.prototype={cp:function(){return new Vector(this.x,this.y)},mul:function(t){return this.x*=t,this.y*=t,this},mulNew:function(t){return new Vector(this.x*t,this.y*t)},add:function(t){return this.x+=t.x,this.y+=t.y,this},addNew:function(t){return new Vector(this.x+t.x,this.y+t.y)},sub:function(t){return this.x-=t.x,this.y-=t.y,this},subNew:function(t){return new Vector(this.x-t.x,this.y-t.y)},rotate:function(t){var e=this.x,i=this.y;return this.x=e*Math.cos(t)-Math.sin(t)*i,this.y=e*Math.sin(t)+Math.cos(t)*i,this},rotateNew:function(t){return this.cp().rotate(t)},setAngle:function(t){var e=this.len();return this.x=Math.cos(t)*e,this.y=Math.sin(t)*e,this},setAngleNew:function(t){return this.cp().setAngle(t)},setLength:function(t){var e=this.len();return e?this.mul(t/e):this.x=this.y=t,this},setLengthNew:function(t){return this.cp().setLength(t)},normalize:function(){var t=this.len();return this.x/=t,this.y/=t,this},normalizeNew:function(){return this.cp().normalize()},angle:function(){return Math.atan2(this.y,this.x)},collidesWith:function(t){return this.x>t.x&&this.y>t.y&&this.xe.x&&this.p1.xn.y&&this.p2.x>e.x&&this.p2.xn.y||(!!this.intersectsLine(new Line(i,e))||(!!this.intersectsLine(new Line(e,s))||(!!this.intersectsLine(new Line(i,n))||!!this.intersectsLine(new Line(n,s)))))},intersectsLine:function(t){var e=this.p1,i=this.p2,s=t.p1,n=t.p2,a=(n.y-s.y)*(i.x-e.x)-(n.x-s.x)*(i.y-e.y),o=(n.x-s.x)*(e.y-s.y)-(n.y-s.y)*(e.x-s.x),h=(i.x-e.x)*(e.y-s.y)-(i.y-e.y)*(e.x-s.x);if(0==a)return!1;var r=o/a,l=h/a;return 0<=r&&r<=1&&0<=l&&l<=1}};var that=this,isIE=!!window.ActiveXObject,isIEQuirks=isIE&&"BackCompat"==document.compatMode,w=document.documentElement.clientWidth,h=document.documentElement.clientHeight;isIEQuirks&&(w=document.body.clientWidth,h=document.body.clientHeight);var playerWidth=20,playerHeight=30,playerVerts=[[-1*playerHeight/2,-1*playerWidth/2],[-1*playerHeight/2,playerWidth/2],[playerHeight/2,0]],ignoredTypes=["HTML","HEAD","BODY","SCRIPT","TITLE","META","STYLE","LINK"];window.ActiveXObject&&(ignoredTypes=["HTML","HEAD","BODY","SCRIPT","TITLE","META","STYLE","LINK","SHAPE","LINE","GROUP","IMAGE","STROKE","FILL","SKEW","PATH","TEXTPATH","INS"]);var hiddenTypes=["BR","HR"],FPS=50,acc=300,maxSpeed=600,rotSpeed=360,bulletSpeed=700,particleSpeed=400,timeBetweenFire=150,timeBetweenBlink=250,timeBetweenEnemyUpdate=isIE?1e4:2e3,bulletRadius=2,maxParticles=isIE?20:40,maxBullets=isIE?10:20,createFlames,W,X,Y,Z,$,_,aa;function updateEnemyIndex(){for(var t,e=0;t=that.enemies[e];e++)removeClass(t,"ASTEROIDSYEAHENEMY");var i=document.body.getElementsByTagName("*");that.enemies=[];var s;for(e=0;s=i[e];e++)-1==indexOf(ignoredTypes,s.tagName.toUpperCase())&&"g_vml_"!=s.prefix&&hasOnlyTextualChildren(s)&&"ASTEROIDSYEAH"!=s.className&&0w?t.x=0:t.x<0&&(t.x=w),t.y>h?t.y=0:t.y<0&&(t.y=h)}function size(t){for(var e=t,i=0,s=0;i+=e.offsetLeft||0,s+=e.offsetTop||0,e=e.offsetParent;);return{x:i,y:s,width:t.offsetWidth||10,height:t.offsetHeight||10}}function addEvent(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&(t["e"+e+i]=i,t[e+i]=function(){t["e"+e+i](window.event)},t.attachEvent("on"+e,t[e+i]))}function removeEvent(t,e,i){t.removeEventListener?t.removeEventListener(e,i,!1):t.detachEvent&&(t.detachEvent("on"+e,t[e+i]),t[e+i]=null,t["e"+e+i]=null)}function arrayRemove(t,e,i){var s=t.slice((i||e)+1||t.length);return t.length=e<0?t.length+e:e,t.push.apply(t,s)}function applyVisibility(t){for(var e,i=0;e=window.ASTEROIDSPLAYERS[i];i++)e.gameContainer.style.visibility=t}function getElementFromPoint(t,e){applyVisibility("hidden");var i=document.elementFromPoint(t,e);return i?(3==i.nodeType&&(i=i.parentNode),applyVisibility("visible"),i):(applyVisibility("visible"),!1)}function addParticles(t){for(var e=(new Date).getTime(),i=maxParticles,s=0;stimeBetweenFire&&(this.bullets.unshift({dir:this.dir.cp(),pos:this.pos.cp(),startVel:this.vel.cp(),cameAlive:e}),this.firedAt=e,this.bullets.length>maxBullets&&this.bullets.pop()),this.keysPressed[code("B")]?(this.updated.enemies||(updateEnemyIndex(),this.updated.enemies=!0),t=!0,this.updated.blink.time+=1e3*i,this.updated.blink.time>timeBetweenBlink&&(this.toggleBlinkStyle(),this.updated.blink.time=0)):this.updated.enemies=!1,this.keysPressed[code("esc")])destroy.apply(this);else{this.vel.len()>maxSpeed&&this.vel.setLength(maxSpeed),this.pos.add(this.vel.mulNew(i)),this.pos.x>w?(window.scrollTo(this.scrollPos.x+50,this.scrollPos.y),this.pos.x=0):this.pos.x<0&&(window.scrollTo(this.scrollPos.x-50,this.scrollPos.y),this.pos.x=w),this.pos.y>h?(window.scrollTo(this.scrollPos.x,this.scrollPos.y+.75*h),this.pos.y=0):this.pos.y<0&&(window.scrollTo(this.scrollPos.x,this.scrollPos.y-.75*h),this.pos.y=h);for(var n=this.bullets.length-1;0<=n;n--)if(2e3',document.getElementsByTagName("head")[0].appendChild(xamlScript)}catch(t){}var script=document.createElement("script");script.setAttribute("type","text/javascript"),script.onreadystatechange=function(){"loaded"!=script.readyState&&"complete"!=script.readyState||"undefined"!=typeof G_vmlCanvasManager&&(window.ASTEROIDSPLAYERS[window.ASTEROIDSPLAYERS.length]=new Asteroids)},script.src="http://erkie.github.com/excanvas.js",document.getElementsByTagName("head")[0].appendChild(script)}else window.ASTEROIDSPLAYERS[window.ASTEROIDSPLAYERS.length]=new Asteroids}();