function snow(num_snow, snowflake, speed) {
	// snow number
	if(num_snow) {
		this.no = num_snow;
	} else {
		this.no = 10;
	}

	// snow type
	if(snowflake) {
		this.snowflake = snowflake;
	} else {
		this.snowflake = "star.gif";
	}

	// snow type
	if(speed) {
		this.speed = speed;
	} else {
		this.speed = 2;
	}

	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		this.doc_width = window.innerWidth;
		this.doc_height = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		this.doc_width = document.documentElement.clientWidth;
		this.doc_height = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		this.doc_width = document.body.clientWidth;
		this.doc_height = document.body.clientHeight;
	}

	this.doc_width = this.doc_width - 10;
	this.doc_height = this.doc_height - 10;

	// coordinate and position variables
	this.dx = new Array();
	this.xp = new Array();
	this.yp = new Array();

	// amplitude and step variables
	this.am = new Array();
	this.stx = new Array();
	this.sty = new Array();

	this.snow_array = new Array();
	var i ;
	for (i = 0; i < this.no; ++ i) {
		this.dx[i] = 0;                        // set coordinate variables
		this.xp[i] = Math.random()*(this.doc_width-50);  // set position variables
		this.yp[i] = Math.random()*this.doc_height;
		this.am[i] = Math.random()*20;         // set amplitude variables
		this.stx[i] = 0.02 + Math.random()/10; // set step variables
		this.sty[i] = 0.7 + Math.random();     // set step variables

		var image = document.createElement('img');
		image.id = "dot"+i;
		image.style.position = "absolute";
		image.style.zIndex = "20";
		image.src = "/images/snowflakes/" + this.snowflake;

		document.body.appendChild(image);
		this.snow_array[i] = image;
	}
	this.falling();
}

snow.prototype.falling = function(param) {
	for (i = 0; i < this.no; ++ i) {  // iterate for every dot
		this.yp[i] += this.sty[i];
		if (this.yp[i] > this.doc_height-50) {
			this.xp[i] = Math.random()*(this.doc_width-this.am[i]-30);
			this.yp[i] = 0;
			this.stx[i] = 0.02 + Math.random()/10;
			this.sty[i] = 0.7 + Math.random();
		}
		this.dx[i] += this.stx[i];
		var current_snow = this. snow_array[i];
		current_snow.style.top = this.yp[i] + "px";
		current_snow.style.left = this.xp[i] + this.am[i]*Math.sin(this.dx[i]) + "px";
	}

	var snow = this;
	window.setTimeout(function(){snow.falling();}, this.speed);
}

