MiniNewsLink = function() {};
MiniNewsLink.prototype = {
	init: function(init_options) {
		this.init_options = init_options;
		this.mini_news = init_options.mini_news;
		
		this.image_src = "images/" + this.parentNode.id + ".jpg";
		
		var image = new Image(); 
		image.src = this.image_src; 
		
		return this;
	},
	
	onmouseover: function() {
		this.mini_news.deactivate_links();
		this.activate();
	},
	
	activate: function() {
		this.className = "active";
		this.mini_news.image.src = this.image_src;
	},
	
	deactivate: function() {
		this.className = "";
	}
}

MiniNews = function() {};
MiniNews.prototype = {
	init: function(init_options) {
		this.init_options = init_options;
		this.image = init_options.image_element;
		
		this.links = this.getElementsByTagName('a');
		
		for(var i = 0; i < this.links.length; i++) {
			Object.extend(this.links[i], new MiniNewsLink()).init({
				mini_news: this
			});
		}
		
		this.links[0].activate();
		
		return this;
	},
	
	deactivate_links: function() {
		for(var i = 0; i < this.links.length; i++) {
			this.links[i].deactivate();
		}
	}
}


window.onload = function() {
	if($('section_header_mini_news')) {
		Object.extend($('section_header_mini_news'), new MiniNews()).init({
			image_element: $('mini_news_image')
		});
	}
}
