window.onload = loaded
var lightball, feature;
function loaded(){
	lightball = new Light();
	
	if($('spaces_controller')){
		feature = new Feature();
	}
}

var Light = Class.create();
Light.prototype = {
	initialize: function(){
		this.light = $('light');
		pos = Position.cumulativeOffset($('container'));
		this.left = pos[0];
		this.right = pos[1];
		
		this.light.style.left = (this.left - 150) + 'px';
		this.light.style.top = '-110px';
		this.light.style.display = '';
		
		this.currentposition = 0;
		this.run();
	},
	
	run: function(){
		if(this.currentposition != 2){
			if(this.currentposition == 0){
				to_x = 450;
				this.currentposition = 1;
			} else {
				to_x = -150;
				this.currentposition = 2;
			}
			
			//to_y = -(Math.random() * 150);
			new Effect.Move(this.light, {mode:'absolute', x: to_x + this.left, y: -110, duration: 2, afterFinish: function(){
					lightball.run();
			}});
		}
	}
}
