/* -*- javascript -*- 
     Copyright 2006 dhx.
     All Rights Reserved
     System        : CONFETTI_JS : 
     Object Name   : $RCS_FILE$
     Revision      : $REVISION$
     Date          : Sun Oct 1 22:26:27 2006
     Created By    : Daniel Haag, dhx
     Created       : Sun Oct 1 22:26:27 2006

     Last Modified : <061010.2232>
     ID            : $Id$
     Source        : $Source$
     Description	
     Notes
*/
var ns4 = document.layers;
var ie4 = document.all;
var nn6 = document.getElementById && !document.all;

star=new Image();

star.src = "pics/stern.gif"

Amount=30; 

Ypos=new Array();
Xpos=new Array();
Speed=new Array();
Step=new Array();
Cstep=new Array();

if(!ns4) {

for (i = 0; i < Amount; i++){
    document.write('<div id="si'+i+'" class="fstar">');
    document.write('<img src="'+star.src+'">');
    document.write('</div>');
}

for (i=0; i < Amount; i++){
    Ypos[i] = 10000;
    Xpos[i] = 0;
    Speed[i]= Math.random()*3+1;
    Cstep[i]=0;
    Step[i]=Math.random()*0.1 + 0.05;
}

}

function setspos(sobj,px,py) {
    sobj.left = px + "px";
    sobj.top = py + "px";
}


function loadfall() {
	if(!ns4) {
		fall();
	}
}

function fall() {
	var WinHeight=nn6?window.innerHeight:(window.document.body.clientHeight?window.document.body.clientHeight:document.documentElement.clientHeight);
	var WinWidth=nn6?window.innerWidth-70:(window.document.body.clientWidth?window.document.body.clientWidth:document.documentElement.clientWidth);
	var hscrll=nn6?window.pageYOffset:document.body.scrollTop;
	var wscrll=nn6?window.pageXOffset:document.body.scrollLeft;
	for (i=0; i < Amount; i++){
		sy = Speed[i]*Math.sin((90*Math.PI)/180);
                sx = Speed[i]*Math.cos(Cstep[i]);
		Ypos[i]+=sy;
		Xpos[i]+=sx;
                if (Ypos[i] > WinHeight-40){
			Ypos[i]= Math.round(Math.random()*WinHeight) - WinHeight;
			Xpos[i]= Math.round(Math.random()*WinWidth);
			Speed[i]= Math.random()*5+3;
		}
                
                setspos(document.getElementById("si"+i).style,Math.min(WinWidth,Xpos[i]),Ypos[i]+hscrll);
                    
                Cstep[i]+=Step[i];
	}
	setTimeout('fall()',115);
}

