// Fall v2.0 By MaxxBlade - http://www.maxxblade.co.uk/fall

var fallObjects=new Array();function newObject(url,height,width){fallObjects[fallObjects.length]=new Array(url,height,width);}

///////////// EDIT THIS SECTION //////////////
var numObjs=18, waft=0, fallSpeed=0, wind=0;
newObject("/wp-content/themes/bab-child-theme/images/fall/01.gif",100,100);
newObject("/wp-content/themes/bab-child-theme/images/fall/02.gif",200,100);
newObject("/wp-content/themes/bab-child-theme/images/fall/03.gif",300,298);
newObject("/wp-content/themes/bab-child-theme/images/fall/04.gif",100,101);
newObject("/wp-content/themes/bab-child-theme/images/fall/05.gif",100,50);
newObject("/wp-content/themes/bab-child-theme/images/fall/06.gif",80,80);
newObject("/wp-content/themes/bab-child-theme/images/fall/07.gif",75,75);
newObject("/wp-content/themes/bab-child-theme/images/fall/08.gif",209,136);
newObject("/wp-content/themes/bab-child-theme/images/fall/09.gif",200,202);
newObject("/wp-content/themes/bab-child-theme/images/fall/10.gif",80,80);
newObject("/wp-content/themes/bab-child-theme/images/fall/11.gif",75,75);
newObject("/wp-content/themes/bab-child-theme/images/fall/12.gif",75,75);
newObject("/wp-content/themes/bab-child-theme/images/fall/13.gif",230,229);
newObject("/wp-content/themes/bab-child-theme/images/fall/14.gif",200,200);
newObject("/wp-content/themes/bab-child-theme/images/fall/15.gif",140,280);
newObject("/wp-content/themes/bab-child-theme/images/fall/16.gif",200,401);
newObject("/wp-content/themes/bab-child-theme/images/fall/17.gif",200,201);
newObject("/wp-content/themes/bab-child-theme/images/fall/18.gif",300,303);
//////////////////////////////////////////////

function winSize(){
winWidth=(moz)?window.innerWidth:document.body.clientWidth;
winHeight=(moz)?window.innerHeight:document.body.clientHeight;
}
function winOfy(){
winOffset=(moz)?window.pageYOffset:document.body.scrollTop;
}
function fallObject(num,vari,nu){
	objects[num]=new Array(
	parseInt(Math.random()*(winWidth-waft)),
	-30,
	(parseInt(Math.random()*waft))*((Math.random()>0.5)?1:-1),
	0.02+Math.random()/20,0,1+parseInt(Math.random()*fallSpeed),
	vari,
	fallObjects[vari][1],
	fallObjects[vari][2]);
	if(nu==1){
	document.write('<img id="fO'+i+'" style="position:absolute;" src="'+fallObjects[vari][0]+'">'); 
	}
}
function fall(){
	for(i=0;i<numObjs;i++){
		if((objects[i][1]>(winHeight-(objects[i][5]+objects[i][7])))
		||(objects[i][0]>(winWidth-(objects[i][2]+objects[i][8])))){
		fallObject(i,objects[i][6],0);
		}
		objects[i][0]+=wind;
		objects[i][1]+=objects[i][5];
		objects[i][4]+=objects[i][3];

		document.getElementById('fO'+i).style.top=(objects[i][1]+winOffset) + 'px';
		document.getElementById('fO'+i).style.left=(objects[i][0]+(objects[i][2]*Math.cos(objects[i][4]))) + 'px';

	}
	setTimeout("fall()",31);
}
var objects=new Array(),winOffset=0,winHeight,winWidth,togvis,moz=(document.getElementById&&!document.all)?1:0;winSize();
for (i=0;i<numObjs;i++){
fallObject(i,parseInt(Math.random()*fallObjects.length),1);
}
window.onscroll=winOfy;window.onresize=winSize;fall();