//--------------------------------------------------------------------------------------------------
var speedTableY   = new Array();
var posX          = new Array();
var smooth        = new Array();
var amplitude     = new Array();
var tabB          = new Array();
var speed         = 50;
var speedLevelsY  = 5;
var layersCount   = screen.width/100;
//--------------------------------------------------------------------------------------------------
function ustaw()
{
            clWidth = document.body.clientWidth - 50;
            for( i = 0; i < layersCount; i++)
            {
                posX[i] = Math.ceil(Math.random() * clWidth);
                speedTableY[i] = Math.ceil(Math.random() * speedLevelsY);
                amplitude[i] = Math.ceil(Math.random() * 15 + 5);
                smooth[i] = Math.ceil(Math.random() * 48) + 10;
                tabB[i] = Math.random() * 4;
            };
};
//--------------------------------------------------------------------------------------------------
function start()
{
            clWidth = document.body.clientWidth - 50;
            clHeight = document.body.clientHeight;
            for( i = 0; i < layersCount; i++)
            {
                y = parseInt(document.getElementById('el' + i).style.top);
                y += speedTableY[i];
                tabB[i] += Math.PI / smooth[i];
                x = parseInt(Math.sin(tabB[i]) * amplitude[i]) + posX[i];
                if( x >= clWidth)
                {
                    x = clWidth;
                };
                document.getElementById('el' + i).style.left = x;
                if( y >= clHeight - 45)
                {
                    y = -50;
                    posX[i] = Math.ceil(Math.random() * clWidth);
                    speedTableY[i] = Math.ceil(Math.random() * speedLevelsY);
                    amplitude[i] = Math.ceil(Math.random() * 15 + 5);
                    smooth[i] = Math.ceil(Math.random() * 48) + 48;
                };
                document.getElementById('el' + i).style.top = y;
            };
            setTimeout('start()', speed);
};
//--------------------------------------------------------------------------------------------------
function Fall()
{
    for( i = 0; i < layersCount; i++)
    {
        str = '<DIV ID="el' + i + '" ';
        str += 'style = "visibility: visible; ';
        str += 'position: absolute; ';
        str += 'top: 1; ';
        str += 'left: 1;">';
        str += '<IMG SRC="img/s.ico">';
        str += '</DIV>';
        document.write(str);
    };
};
//-------------------------------------------------------------------------------------------------