var Spotlight = function() {
	// Members
	
	this.Stage = document.getElementById("spotlight-stage");
	this.Velocity = 0;
	this.Timer = null;
	this.Scene = 0;
	
	// Methods
	
	this.Move = function(__Scene) {
		var ___X = new Array(null, null);
		
		// Clear the current timer if there is one.
		if(this.Timer != null) {
			clearTimeout(this.Timer);
		}
		
		// Check if scene is specified.
		if(__Scene > -1) {
			this.Scene = __Scene;
		}
		
		// Get the scene's x-coordinate.
		___X[0] = this.Scene * -440;
		
		// Get the stage's x-coordinate.
		___X[1] = parseInt(this.Stage.style.left);
		___X[1] = ___X[1] ? ___X[1] : 0;
		
		// Check if we are to the right of the destination.
		if(___X[0] < ___X[1]) {
			if(this.Velocity > 0) {
				if(this.Velocity > 0.5) {
					this.Velocity *= 0.75;
				} else {
					this.Velocity -= 0.25;
				}
			} else {
				this.Velocity -= 0.25;
			}
		} else if(___X[0] > ___X[1]) {
			if(this.Velocity < 0) {
				if(this.Velocity < -0.5) {
					this.Velocity *= 0.75;
				} else {
					this.Velocity += 0.25;
				}
			} else {
				this.Velocity += 0.25;
			}
		}
		
		if(2 > this.Velocity && this.Velocity > -2 && ___X[1] + 2 > ___X[0] && ___X[0] > ___X[1] - 2) {
			this.Velocity = 0;
			___X[1] = ___X[0];
		}
		
		this.Stage.style.left = Math.ceil(___X[1] + this.Velocity) + "px";
		
		if(this.Velocity != 0 || ___X[1] != ___X[0]) {
			this.Timer = setTimeout("Spotlight.Move(-1);", 10);
		} else {
			this.Scene = (this.Scene + 1) % 4;
			this.Timer = setTimeout("Spotlight.Move(-1);", 5000);
		}
	};
	
	// Initialize.
	this.Timer = setTimeout("Spotlight.Move(1);", 5000);
};

var News = function(__Contents) {
	// Members
	
	this.Current = null;
	this.Tabs = new Array(
		document.getElementById("news-tab-0"),
		document.getElementById("news-tab-1"),
		document.getElementById("news-tab-2"),
		document.getElementById("news-tab-3"),
		document.getElementById("news-tab-4")
	);
	this.Content = document.getElementById("news");
	this.Contents = __Contents;
	
	// Methods
	
	this.Show = function(__Id) {
		// Check if there's a current ID selected.
		if(this.Current != null) {
			this.Tabs[this.Current].className = "tabs";
		}
		
		// Set the new current ID.
		this.Current = __Id;
		
		// Set the new tab as active.
		this.Tabs[this.Current].className = "tabs-active";
		
		// Display the new content.
		this.Content.innerHTML = this.Contents[this.Current];
	};
};