/*
	Last Updated 7-29-08
   	Javascript Menu Functions to make Snowflakes Fall
	Portions of this code were copied from other websites.	
	Known working with the following browsers: Firefox, IE
*/
var numberofsnowflakes = 20;
var snowdistance = "windowheight";
var randomnumber;
var snow = new Array(12);
	snow[0] = "images/snowflake1.gif";
	snow[1] = "images/snowflake2.gif";
	snow[2] = "images/snowflake3.gif";
	snow[3] = "images/snowflake4.gif";
	snow[4] = "images/snowflake5.gif";
	snow[5] = "images/snowflake6.gif";
	snow[6] = "images/snowflake7.gif";
	snow[7] = "images/snowflake8.gif";
	snow[8] = "images/snowflake9.gif";
	snow[9] = "images/snowflake10.gif";
	snow[10] = "images/snowflake11.gif";
	snow[11] = "images/snowflake12.gif";
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
function iecompattest() {
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
var dx, xp, yp;
var am, stx, sty;
var i, doc_width = 800, doc_height = 600;
var startpositionx, stoppositionx;
var startpositiony, stoppositiony;
var doc_width = 0, doc_height = 0;
if( typeof( window.innerWidth ) == 'number' ) {
	doc_width = window.innerWidth - 150;
    doc_height = window.innerHeight - 150;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    doc_width = document.documentElement.clientWidth - 150;
    doc_height = document.documentElement.clientHeight - 150;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    doc_width = document.body.clientWidth - 150;
    doc_height = document.body.clientHeight - 150;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < numberofsnowflakes; ++ i) {
	dx[i] = 0; // set coordinate variables
   	xp[i] = Math.random()*(doc_width-60); // set position variables
   	yp[i] = Math.random()*doc_height;
   	am[i] = Math.random()*20; // set amplitude variables
  	stx[i] = 0.02 + Math.random()/10; // set step variables
  	sty[i] = 0.7 + Math.random(); // set step variables
   	if (ie4up||ns6up) {
		picksnowflake ();
		document.write("<div id=\"dot"+ i +"\" style=\"position: absolute; z-index: 0;\"><img src='"+ snowflake +"' border=\"0\"><\/div>");
	}
}
function snowIE_NS6() {
	doc_width = ns6up?window.innerWidth-20 : iecompattest().clientWidth-20;
	doc_height = (window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
	for (i = 0; i < numberofsnowflakes; ++ i) { 
		yp[i] += sty[i];
		if (yp[i] > doc_height -50) {
			xp[i] = Math.random()*(doc_width-am[i]-50);
			yp[i] = 0;
			stx[i] = 0.02 + Math.random()/10;
			sty[i] = 0.7 + Math.random();
		}
		dx[i] += stx[i];
		document.getElementById("dot"+i).style.top=yp[i]+"px";
		document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
	}
	snowtimer=setTimeout("snowIE_NS6()", 10);
}
function hidesnow(){
	if (window.snowtimer) clearTimeout(snowtimer)
		for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
}
if (ie4up||ns6up){
	snowIE_NS6();
}
function picksnowflake () {
	randomnumber = Math.floor(11*Math.random());
	snowflake = (snow[randomnumber]);
}

