function init()
{
    stars(menge, $$(window).width(),$$(window).height(),3);
    interval = window.setInterval('starsAnimate(test)', 25);
}

function stars(anzahl, xdim, ydim, max)
{
    for(i=0; i<anzahl; i++)
    {
        xpos = Math.floor(Math.random()*xdim+1);
        ypos = Math.floor(Math.random()*ydim+1);
        sc=(Math.floor(Math.random()*max));
        test.push(createStar(xpos, ypos, sc).scale(sc, sc));
    }
}

function createStar (x, y, sc) {
    gradstr = "r#fff-#2f73a0";
    star = paper.set();
    star.push(
            paper.ellipse(x, y, 10, 1).attr({"fill": gradstr,"opacity": "0.01"}),
            paper.ellipse(x, y, 1, 10).attr({"fill": gradstr,"opacity": "0.01"}),
            paper.circle(x, y, 5).attr({"fill": gradstr,"opacity": "0.01"})
    );

    return star;
};

function starsAnimate()
{
    scTarget=Math.floor(Math.random()*300)/100;
    target=Math.floor(Math.random()*(menge-1));
    test[target].animate({'scale':scTarget}, 2000, 'backOut');
}
