var canvas1,ctx,w,h;if(screen.width>=988)var mp=150;else mp=75;var deactivationtimerhandler,reactivationtimerhandler,animationhandler,particles=[],angle=0,tiltangle=0,confettiactive=!0,animationcomplete=!0,particlecolors={coloroptions:["dodgerblue","olivedrab","gold","pink","slateblue","lightblue","violet","palegreen","steelblue","sandybrown","chocolate","crimson"],colorindex:0,colorincrementer:0,colorthreshold:10,getcolor:function(){return this.colorincrementer>=10&&(this.colorincrementer=0,this.colorindex++,this.colorindex>=this.coloroptions.length&&(this.colorindex=0)),this.colorincrementer++,this.coloroptions[this.colorindex]}};function confettiparticle(t){this.x=math.random()*w,this.y=math.random()*h-h,this.r=randomfromto(10,30),this.d=math.random()*mp+10,this.color=t,this.tilt=math.floor(10*math.random())-10,this.tiltangleincremental=.07*math.random()+.05,this.tiltangle=0,this.draw=function(){return ctx.beginpath(),ctx.linewidth=this.r/2,ctx.strokestyle=this.color,ctx.moveto(this.x+this.tilt+this.r/4,this.y),ctx.lineto(this.x+this.tilt,this.y+this.tilt+this.r/4),ctx.stroke()}}function initializebutton(){$("#stopbutton").click(deactivateconfetti),$("#startbutton").click(restartconfetti)}function setglobals(){canvas1=document.getelementbyid("canvas"),ctx=canvas1.getcontext("2d"),w=window.innerwidth,h=window.innerheight,canvas1.width=w,canvas1.height=h}function initializeconfetti(){particles=[],animationcomplete=!1;for(var t=0;tw+20||t.x<-20||t.y>h)&&confettiactive&&(i%5>0||i%2==0?repositionparticle(t,math.random()*w,-10,math.floor(10*math.random())-10):math.sin(angle)>0?repositionparticle(t,-5,math.random()*h,math.floor(10*math.random())-10):repositionparticle(t,w+5,math.random()*h,math.floor(10*math.random())-10))}function stepparticle(t,i){t.tiltangle+=t.tiltangleincremental,t.y+=(math.cos(angle+t.d)+3+t.r/2)/2,t.x+=math.sin(angle),t.tilt=15*math.sin(t.tiltangle-i/3)}function repositionparticle(t,i,n,e){t.x=i,t.y=n,t.tilt=e}function startconfetti(){w=window.innerwidth,h=window.innerheight,canvas1.width=w,canvas1.height=h,function t(){return animationcomplete?null:(animationhandler=requestanimframe(t),draw())}()}function cleartimers(){cleartimeout(reactivationtimerhandler),cleartimeout(animationhandler)}function deactivateconfetti(){confettiactive=!1,cleartimers()}function stopconfetti(){animationcomplete=!0,null!=ctx&&ctx.clearrect(0,0,w,h)}function restartconfetti(){cleartimers(),stopconfetti(),reactivationtimerhandler=settimeout(function(){confettiactive=!0,animationcomplete=!1,initializeconfetti()},100)}$(document).ready(function(){setglobals(),initializebutton(),initializeconfetti(),$(window).resize(function(){w=window.innerwidth,h=window.innerheight,canvas1.width=w,canvas1.height=h})}),window.requestanimframe=window.requestanimationframe||window.webkitrequestanimationframe||window.mozrequestanimationframe||window.orequestanimationframe||window.msrequestanimationframe||function(t){return window.settimeout(t,1e3/60)};