			function Particle(posx, posy) {
	
				// the position of the particle
				this.posX = posx; 
				this.posY = posy; 
				// the velocity 
				this.velX = 0; 
				this.velY = 0; 
				
				// multiply the particle size by this every frame
				this.shrink = 1; 
				this.size = 1; 
				
				// multiply the velocity by this every frame to create
				// drag. A number between 0 and 1, closer to one is 
				// more slippery, closer to 0 is more sticky. values
				// below 0.6 are pretty much stuck :) 
				this.drag = 1; 
				
				// add this to the yVel every frame to simulate gravity
				this.gravity = 0; 
				
				// current transparency of the image
				this.alpha = (Math.random() * 55) + 44;//1;
				this.alpha = this.alpha/100;
				// subtracted from the alpha every frame to make it fade out
				this.fade = 0.01;
				
				// color
				this.brigthness = 255;//Math.floor(Math.random() * 255);
	
				this.update = function() {
				
					// simulate drag
					this.velX *= this.drag; 
					this.velY *= this.drag;
					
					// add gravity force to the y velocity 
					this.velY += this.gravity; 
					
					// and the velocity to the position
					this.posX += this.velX;
					this.posY += this.velY; 
					
					// shrink the particle
					this.size *= this.shrink;
					
					// and fade it out
					this.alpha -= this.fade; 
				 
				};
				
				this.render = function(c) {
					
					if(this.alpha<0.01) return; 
					
					// set the fill style to have the right alpha
					c.fillStyle = "rgba("+this.brigthness+","+this.brigthness+","+this.brigthness+","+this.alpha+")";
					
					// draw a circle of the required size
					c.beginPath();
					c.arc(this.posX, this.posY, this.size, 0, Math.PI*2, true);
				
					// and fill it
					c.fill();
				
				};
	
	
			}	
		
			// create canvas area
			var canvas = document.getElementById('snowCanvas'),
				ctx = canvas.getContext('2d'),
				// change the canvas size
				SCREEN_WIDTH = canvas.width = window.innerWidth,
				SCREEN_HEIGHT = canvas.height = 150,//window.innerHeight,
				particles = [];
				
				
			function snow() {
				
				// set id and add to body
	
				// animate
				setInterval(loop, 1000 / 40);
				
				function loop() {
				    
					// add a particle
					var particle = new Particle(Math.random() * SCREEN_WIDTH, 0);
					
					// set the size
					particle.size = Math.random() * 5;
					
					particle.velY = Math.random() * 5;
					
					// set the gravity
					particle.gravity = 0.01;
	
					// add to the array
					particles.push(particle);
					
				    // clear screen
				    ctx.clearRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
				    
				    for ( var i = 0; i < particles.length; i++) {
	                   	particle = particles[i];
	                   	
	    			    // update the particle view
	    			    particle.update();
	    			    
	        			// render
	        			particle.render(ctx);
					}
				    
				    // contstrain the array
				    while (particles.length > 500) {
				        particles.shift();
				    }
				}
			}
			
			snow();
			
			document.body.onresize = function (){
				snow();
			};
