var a;function b(e,g,y,x){c.fillStyle=x;c.beginPath();c.arc(e+5,g+5,y,0,2*Math.PI,!0);c.closePath();c.fill()}function d(e,g){c.font="bold 14px Monospace";c.fillStyle="white";c.fillText(e,20,g)};function f(e,g){this.type="touch";this.x=e;this.y=g;this.b=15;this.opacity=1;this.j=0.05}f.prototype.update=function(){this.opacity-=this.j;this.remove=0>this.opacity?!0:!1};f.prototype.e=function(){b(this.x,this.y,this.b+5,"rgba(115,0,0,"+this.opacity+")");h.style.left=this.x+"px";h.style.top=this.y+"px"};var l=0,m=0,n=0;function p(e){l=(e.pageX-q)/r;m=(e.pageY-aa)/r;n=!0};function s(){this.type="bubble";this.b=20*Math.random()+10;2===t&&(this.speed=3*Math.random()+1);1===t&&(this.speed=3*Math.random()+5);3===t&&(this.speed=3*Math.random()+10);4===t&&(this.speed=3*Math.random()+7);this.x=Math.random()*u-this.b;this.y=v+100*Math.random()+100;this.d=Math.floor(256*Math.random());this.g=Math.floor(256*Math.random());this.h=Math.floor(256*Math.random());this.l=35+this.b;this.m=this.x;this.remove=!1}
s.prototype.update=function(){var e=null;2===t&&(e=0.004*(new Date).getTime());1===t&&(e=0.006*(new Date).getTime());3===t&&(e=0.004*(new Date).getTime());4===t&&(e=0.004*(new Date).getTime());this.y-=this.speed;this.x=this.l*Math.sin(e)+this.m;-10>this.y&&(w+=1,this.remove=!0,z.play(),1===w&&(A.play(),ba.style.top="-150px",ba.style.left="500px",ca.style.left="500px"),4===w&&(A.play(),ca.style.left="-320px"))};
s.prototype.e=function(){B.style.top=this.d+"px";var e=this.x,g=this.y,y=this.b,x="rgba("+this.d+","+this.g+","+this.h+",1)";c.fillStyle=x;c.beginPath();c.arc(e+5,g+5,y,0,2*Math.PI,!0);c.closePath();c.fill();c.beginPath();c.moveTo(e+10,g+93);c.lineTo(e+10,g);c.strokeStyle=x;c.closePath();c.stroke()};function C(e,g,y){this.x=e;this.y=g;this.b=y;this.i=this.d=Math.floor(256*Math.random());this.dir=1<2*Math.random()?1:-1;this.f=~~(4*Math.random())*this.dir;this.c=~~(7*Math.random());this.remove=!1}C.prototype.update=function(){this.x+=this.f;this.y+=this.c;this.f*=0.99;this.c*=0.99;this.c-=0.25;0>this.y&&(this.remove=!0)};C.prototype.e=function(){b(this.x,this.y,this.b+1,this.i.toString())};window.k=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1E3/60)};window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;
var D=document.getElementById("rio"),A=document.getElementById("sirena"),E=document.getElementById("mpause"),F=document.getElementById("collide"),da=document.getElementById("mp"),G=document.getElementById("next"),z=document.getElementById("out"),ea=document.getElementById("menut"),fa=document.getElementById("globo"),H=document.getElementById("pajaro2"),I=document.getElementById("pajaro4"),J=document.getElementById("pajaro7"),h=document.getElementById("pajaro14"),K=document.getElementById("micanvas"),
L=document.getElementById("menu"),M=document.getElementById("menupaused"),N=document.getElementById("btnplay1"),O=document.getElementById("backs3"),P=document.getElementById("backsound"),Q=document.getElementById("playerpajaro"),R=document.getElementById("mpausevoz"),ba=document.getElementById("mensaje"),ca=document.getElementById("mensaje2"),B=document.getElementById("pajaro13"),ga=document.getElementById("play"),S=document.getElementById("btnplaynext"),ha=document.getElementById("btnpaused"),u=
320,v=480,r=1,aa=0,q=0,T=[],U=100,V=0,w=0,ja=null,W=320,X=480,Y=null,c=null,Z=null,ka=null,la=null,$=!0,t=2;function ma(){X=window.innerHeight;W=X*ja;if(ka||la)document.body.style.height=window.innerHeight+50+"px";Y.style.width=W+"px";Y.style.height=X+"px";L.style.width=W+"px";L.style.height=X+"px";K.style.width=W+"px";K.style.height=X+"px";r=W/u;aa=Y.offsetTop;q=Y.offsetLeft;window.setTimeout(function(){window.scrollTo(0,1)},1)}
function na(){window.k(na);var e=null;if(!1===$){var g,y=!1;U-=1;0>U&&(T.push(new s),U=100*Math.random()+10);n&&(T.push(new f(l,m)),n=!1,y=!0);for(g=0;g<T.length;g+=1){T[g].update();if("bubble"===T[g].type&&y){var e=T[g],x=l,ia=m;if(e=(e.x-x)*(e.x-x)+(e.y-ia)*(e.y-ia)<(e.b+7)*(e.b+7)?!0:!1){for(x=0;5>x;x+=1)T.push(new C(T[g].x,T[g].y,2));V+=1;F.pause();F.currentTime=0;F.play();T[g].remove=e}}T[g].remove&&("undefined"!==typeof T[g].element&&T[g].element.remove(),T.splice(g,1))}1===t&&(O.play(),D.pause(),
5===w&&(N.style.display="block",S.style.display="none",L.style.left="0px",M.style.top="-150px",H.style.left="100px",H.style.top="100px",H.style.a="200px 200px, 0px 0px, auto auto",H.style.height="200px",H.style.width="200px",J.style.left="110px",J.style.top="370px",O.pause(),P.pause(),E.src="image/m1.ogg",E.play(),z.pause(),A.pause(),L.style.a="100% 100%",L.style.backgroundImage="url(static/image/gameover.gif)",L.style.borderBottomLeftRadius="0em",L.style.borderBottomRightRadius="0em",V=w=0,Q.style.left=
"160px",Q.style.top="150px",t=2,$=!0),132===V&&(I.style.left="-150px",I.style.backgroundImage="url(static/image/b9.gif)"),135===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="100px"),140===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),150===V&&(I.style.top="200px"),153===V&&(document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src="image/m2.ogg",P.play()),155===V&&(I.style.display=
"none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b2.gif)",H.style.top="200px"),163===V&&(I.style.top="200px"),165===V&&(J.style.left="140px"),168===V&&(J.style.left="180px"),172===V&&(I.style.left="-150px"),175===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="70px"),185===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),195===V&&(I.style.top="200px"),220===
V&&(document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src="image/m6.ogg",P.play()),225===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b14.gif)",H.style.top="270px"),250===V&&(I.style.top="200px"),253===V&&(J.style.left="240px"),258===V&&(J.style.left="180px"),265===V&&(I.style.left="-150px"),268===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="200px"),270===V&&(I.style.display=
"block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),275===V&&(I.style.top="200px"),277===V&&(document.getElementById("lbmsg").innerHTML="Next level",P.src="image/m5.ogg",P.play(),I.style.top="-150px"),279===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b7.gif)",H.style.top="270px"),285===V&&(I.style.top="200px"),288===V&&(J.style.left="140px"),295===V&&(J.style.left="180px"));2===t&&(document.getElementById("lbhit").innerHTML=
"Destroyed:"+V,P.play(),5===w&&(N.style.display="block",S.style.display="none",L.style.left="0px",M.style.top="-150px",H.style.left="100px",H.style.top="100px",H.style.a="200px 200px, 0px 0px, auto auto",H.style.height="200px",H.style.width="200px",J.style.left="110px",J.style.top="370px",Q.style.left="160px",Q.style.top="150px",O.pause(),P.pause(),E.src="image/m1.ogg",E.play(),z.pause(),A.pause(),L.style.a="100% 100%",L.style.backgroundImage="url(static/image/gameover.gif)",L.style.borderBottomLeftRadius=
"0em",L.style.borderBottomRightRadius="0em",V=w=0,t=2,$=!0),O.pause(),D.play(),P.play(),2===V&&console.log(2),5===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="100px"),10===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),15===V&&(I.style.top="200px"),18===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src="image/m2.ogg",P.play()),19===V&&G.pause(),
25===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b2.gif)",H.style.top="200px"),30===V&&(I.style.top="200px"),35===V&&(J.style.left="140px"),38===V&&(J.style.left="180px"),42===V&&(I.style.left="-150px"),45===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="70px"),50===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),55===V&&(I.style.top=
"200px"),58===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src="image/m5.ogg",P.play()),59===V&&G.pause(),65===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b14.gif)",H.style.top="270px"),70===V&&(I.style.top="200px"),75===V&&(J.style.left="240px"),78===V&&(J.style.left="180px"),82===V&&(I.style.left="-150px"),85===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left=
"200px"),90===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),95===V&&(I.style.top="200px"),98===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.top="-150px",P.src="image/m4.ogg",P.play()),99===V&&G.play(),105===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b7.gif)",H.style.top="270px"),120===V&&(I.style.top="200px"),125===V&&(J.style.left=
"140px"),128===V&&(J.style.left="180px",I.style.left="-150px",I.style.backgroundImage="url(static/image/b9.gif)",A.pause(),P.pause(),E.src="image/mf.ogg",E.play(),L.style.left="0px",L.style.a="100% 100%",L.style.backgroundImage="url(static/image/nextlevel.gif)",N.style.display="none",S.style.display="block",L.style.backgroundColor="rgba(20, 83, 83, 0)",M.style.top="-150px",Q.style.display="none",$=!0));3===t&&(document.getElementById("lbhit").innerHTML="Destroyed:"+V,P.play(),5===w&&(N.style.display=
"block",S.style.display="none",L.style.left="0px",M.style.top="-150px",H.style.left="100px",H.style.top="100px",H.style.a="200px 200px, 0px 0px, auto auto",H.style.height="200px",H.style.width="200px",J.style.left="110px",J.style.top="370px",Q.style.left="160px",Q.style.top="150px",O.pause(),P.pause(),E.src="image/m1.ogg",E.play(),z.pause(),A.pause(),L.style.a="100% 100%",L.style.backgroundImage="url(static/image/gameover.gif)",L.style.borderBottomLeftRadius="0em",L.style.borderBottomRightRadius=
"0em",V=w=0,t=2,$=!0),O.pause(),D.play(),P.play(),135===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="100px"),150===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),160===V&&(I.style.top="200px"),170===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src="image/m2.ogg",P.play()),172===V&&G.pause(),175===V&&(I.style.display="none",I.style.top="-150px",
I.style.left="150px",I.style.backgroundImage="url(static/image/b2.gif)",H.style.top="200px"),185===V&&(I.style.top="200px"),200===V&&(J.style.left="140px"),228===V&&(J.style.left="180px"),234===V&&(I.style.left="-150px"),236===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="70px"),250===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),255===V&&(I.style.top="200px"),258===V&&(G.play(),document.getElementById("lbmsg").innerHTML=
"Next level",I.style.left="-150px",P.src="image/m5.ogg",P.play()),259===V&&G.pause(),265===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b14.gif)",H.style.top="270px"),270===V&&(I.style.top="200px"),275===V&&(J.style.left="240px"),278===V&&(J.style.left="180px"),282===V&&(I.style.left="-150px"),285===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="200px"),290===V&&(I.style.display="block",I.style.a=
"90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),295===V&&(I.style.top="200px"),298===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.top="-150px",P.src="image/m4.ogg",P.play()),299===V&&G.play(),305===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b7.gif)",H.style.top="270px"),320===V&&(I.style.top="200px"),325===V&&(J.style.left="140px"),328===V&&(J.style.left="180px",I.style.left=
"-150px",I.style.backgroundImage="url(static/image/b9.gif)",A.pause(),P.pause(),E.src="image/mf.ogg",E.play(),L.style.left="0px",L.style.a="100% 100%",L.style.backgroundImage="url(static/image/nextlevel.gif)",N.style.display="none",S.style.display="block",L.style.backgroundColor="rgba(20, 83, 83, 0)",M.style.top="-150px",Q.style.display="none",$=!0));4===t&&(document.getElementById("lbhit").innerHTML="Destroyed:"+V,P.play(),5===w&&(N.style.display="block",S.style.display="none",L.style.left="0px",
M.style.top="-150px",H.style.left="100px",H.style.top="100px",H.style.a="200px 200px, 0px 0px, auto auto",H.style.height="200px",H.style.width="200px",J.style.left="110px",J.style.top="370px",Q.style.left="160px",Q.style.top="150px",O.pause(),P.pause(),E.src="image/m1.ogg",E.play(),z.pause(),A.pause(),L.style.a="100% 100%",L.style.backgroundImage="url(static/image/gameover.gif)",L.style.borderBottomLeftRadius="0em",L.style.borderBottomRightRadius="0em",V=w=0,t=2,$=!0),O.pause(),D.play(),P.play(),
330===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="100px"),335===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),336===V&&(I.style.top="200px"),338===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src="image/m2.ogg",P.play()),340===V&&G.pause(),343===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b2.gif)",
H.style.top="200px"),350===V&&(I.style.top="200px"),360===V&&(J.style.left="140px"),365===V&&(J.style.left="180px"),370===V&&(I.style.left="-150px"),376===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="70px"),378===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height="90px",I.style.width="90px"),380===V&&(I.style.top="200px"),382===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.left="-150px",P.src=
"image/m5.ogg",P.play()),385===V&&G.pause(),387===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b14.gif)",H.style.top="270px"),390===V&&(I.style.top="200px"),395===V&&(J.style.left="240px"),398===V&&(J.style.left="180px"),405===V&&(I.style.left="-150px"),408===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",B.style.left="200px"),412===V&&(I.style.display="block",I.style.a="90px 90px, auto auto, auto auto",I.style.height=
"90px",I.style.width="90px"),420===V&&(I.style.top="200px"),423===V&&(G.play(),document.getElementById("lbmsg").innerHTML="Next level",I.style.top="-150px",P.src="image/m4.ogg",P.play()),424===V&&G.play(),428===V&&(I.style.display="none",I.style.top="-150px",I.style.left="150px",I.style.backgroundImage="url(static/image/b7.gif)",H.style.top="270px"),435===V&&(I.style.top="200px"),439===V&&(J.style.left="140px"),445===V&&(J.style.left="180px",I.style.left="-150px",I.style.backgroundImage="url(static/image/b9.gif)",
A.pause(),P.pause(),E.src="image/mf.ogg",E.play(),L.style.left="0px",L.style.a="100% 100%",L.style.backgroundImage="url(static/image/nextlevel.gif)",N.style.display="none",S.style.display="block",L.style.backgroundColor="rgba(20, 83, 83, 0)",M.style.top="-150px",Q.style.display="none",$=!0))}g=u;y=v;c.fillStyle="transparent";c.fillRect(0,0,g,y);c.clearRect(0,0,u,v);for(g=0;g<a.total;g++)b(a.x+a.offset+g*a.b,a.y,a.b,"#fff");for(g=0;g<T.length;g+=1)T[g].e();d("Destroyed: "+V,30);d("Escaped: "+w,50);
1>V&&d("Touch the ballons for explode.",200)};var oa=setInterval(function(){Q.style.top="117px";Q.style.left="125px";N.style.top="180px";N.style.left="95px";window.clearInterval(oa)},2E3);B.addEventListener("touchstart",function(e){e.preventDefault();B.style.left="107px"},!0);
ga.addEventListener("touchstart",function(){F.play();fa.style.left="-380px";ea.style.left="-450px";!1===$?($=!0,E.pause(),da.play()):$=!1;L.style.left="-800px";M.style.top="0px";1===t&&(K.style.backgroundImage="url(static/image/p4.gif)");2===t&&(K.style.backgroundImage="url(static/image/p5.gif)",J.style.display="block",J.style.backgroundImage="url(static/image/m2.gif)",J.style.a="50px 50px, 0px 0px, auto auto",J.style.height="50px",J.style.width="50px");3===t&&(K.style.backgroundImage="url(static/image/p8.gif)",
J.style.display="block",J.style.backgroundImage="url(static/image/m2.gif)",J.style.a="50px 50px, 0px 0px, auto auto",J.style.height="50px",J.style.width="50px");4===t&&(K.style.backgroundImage="url(static/image/p6.gif)",J.style.display="block",J.style.backgroundImage="url(static/image/m2.gif)",J.style.a="50px 50px, 0px 0px, auto auto",J.style.height="50px",J.style.width="50px")},!0);
S.addEventListener("touchstart",function(e){e.preventDefault();t=1;K.style.backgroundImage="url(static/image/p4.gif)";E.pause();J.style.display="block";J.style.backgroundImage="url(static/image/b6.gif)";J.style.a="50px 50px, 0px 0px, auto auto";J.style.height="50px";J.style.width="50px";L.style.left="-600px";M.style.top="0px";$=!1},!0);
ha.addEventListener("touchstart",function(e){e.preventDefault();if(!1===$){if($=!0,1===t&&(J.style.display="block",M.style.left="0px",M.style.width="100px",M.style.height="380px",M.style.backgroundColor="rgb(104, 40, 16)",H.style.left="100px",H.style.top="100px",H.style.a="200px 200px, 0px 0px, auto auto",H.style.height="200px",H.style.width="200px",J.style.left="110px",J.style.top="370px",O.pause(),P.pause(),E.play(),R.play()),2===t||3===t||4===t)J.style.display="none",M.style.left="0px",M.style.width=
"100px",M.style.height="380px",M.style.backgroundColor="rgb(15, 44, 6)",H.style.left="100px",H.style.top="100px",H.style.a="200px 200px, 0px 0px, auto auto",H.style.height="200px",H.style.width="200px",J.style.left="110px",J.style.top="370px",O.pause(),P.pause(),E.play(),R.play()}else if(1===t&&(J.style.display="block",$=!1,M.style.left="150px",M.style.height="80px",M.style.width="100px",M.style.backgroundColor="#108053",H.style.left="50px",H.style.top="100px",H.style.a="100px 100px, 0px 0px, auto auto",
H.style.height="100px",H.style.width="100px",J.style.left="180px",J.style.top="345px",O.play(),P.play(),E.pause(),R.pause()),2===t||3===t||4===t)$=!1,M.style.left="150px",M.style.height="80px",M.style.width="100px",M.style.backgroundColor="#108053",J.style.display="block",H.style.left="50px",H.style.top="100px",H.style.a="100px 100px, 0px 0px, auto auto",H.style.height="100px",H.style.width="100px",J.style.left="180px",J.style.top="345px",O.play(),P.play(),E.pause(),R.pause()},!0);
window.addEventListener("load",function(){ja=u/v;W=u;X=v;Y=document.getElementById("game");Y.width=u;Y.height=v;c=Y.getContext("2d");Z=navigator.userAgent.toLowerCase();ka=-1<Z.indexOf("android")?!0:!1;la=-1<Z.indexOf("iphone")||-1<Z.indexOf("ipad")?!0:!1;a={x:-25,y:-40,b:50,time:0,offset:0};a.total=Math.ceil(u/a.b)+1;window.addEventListener("click",function(e){e.preventDefault();p(e)},!1);window.addEventListener("touchstart",function(e){e.preventDefault();p(e.touches[0])},!1);window.addEventListener("touchmove",
function(e){p(e.touches[0]);e.preventDefault()},!1);window.addEventListener("touchend",function(e){e.preventDefault()},!1);ma();na()},!1);window.addEventListener("resize",ma,!1);
