var O = [];

function Cobj(xs, ys, css, html, container){
	this.xs = xs;
	this.ys = ys;
	this.m = 1;
	this.x = xs * 10000;
	this.y = ys * 10000;
	this.o = html
	//this.o = document.createElement("span");
	//this.o.innerHTML = html;
	this.o.className = 'fly_tag';
	for(var i in css)this.o.style[i] = css[i];
	//container.appendChild(this.o);
	this.mov = function () {
		with(this) {
			if(xs!=0){
				x += xs;
				o.style.left = x+'px';
				if(xs>0 && x>container.offsetWidth) x = -o.offsetWidth;
				else if(xs<0 && x<-o.offsetWidth) x = container.offsetWidth;
			}
			if(ys!=0){
				y += ys;
				o.style.top = y+'px';
				if(ys>0 && y>container.offsetHeight) y = -o.offsetHeight;
				else if(ys<0 && y<-o.offsetHeight) y = container.offsetHeight;
			}
		}
	}
}

function run(){
	for(var i in O)O[i].mov();
	setTimeout("run();", 32);
}

function init(){
    //dom = document.body;
    var dom = document.getElementById('splash');
    var styles = new Array({
            'color': '#606060',
            'fontSize': '100pt',
            'letterSpacing': '-5px',
            'textAlign': 'center'
        },
        {
            'color': '#c0c0c0',
            'fontSize': '10pt',
            'left': '25%'
        },
        {
            'color': '#888',
            'fontSize': '48pt',
            'top': '25%'
        },
        {
            'color': '#fff',
            'fontSize': '14pt',
            'top': '55%'
        },
        {
            'color': '#ff8000',
            'fontSize': '16pt',
            'top': '65%'
        },
        {
            'color': '#b0b0c0',
            'fontSize': '18pt',
            'left': '10%'
        },
        {
            'color': '#fff',
            'fontSize': '20pt',
            'width': '50%',
            'textAlign': 'right'
        },
        {
            'color': '#9090f0',
            'fontSize': '22pt',
            'top': '10px'
        },
        {
            'color': '#8080ff',
            'fontSize': '20pt',
            'top': '60%'
        });
    var xs = new Array(-1, 0, 1, 2, 3);
    var ys = new Array(-2, -1, 0, 1, 2);
    elms = dom.getElementsByTagName('a');
    for (var i in elms) 
    {
        if (elms[i].innerHTML)
        {
            //candidates.push('<a href="' + elms[i].href + '">' + elms[i].innerHTML + '</a>');
             O.push(new Cobj(xs[Math.floor(Math.random()*5)],ys[Math.floor(Math.random()*5)],styles[Math.floor(Math.random()*10)],elms[i],dom));
        }
    }
	run();

}
