
function showContent(obj)
{
	var output = "";
	for (prop in obj)
	{
		output += prop + "= " + obj[prop] + "\n";
	}
	alert(output);
}

var homePageSlideShow =
{
	images: { 0: new Image(),  1: new Image(),  2: new Image() },
	current: 0,
	init: function()
	{
		this.images[0].src = "images/home_0.jpg";
		this.images[1].src = "images/home_1.jpg";
		this.images[2].src = "images/home_2.jpg";
		window.setInterval("homePageSlideShow.next()", 3000);
	},
	next: function()
	{
		this.current = (this.current+1) % 3;
		document.getElementById("main_image").src = this.images[this.current].src;
	}
}

var navImages =
{
	images: new Object(),
	current: null,
	originalSrc: null,
	target: null,
	init: function()
	{
		this.target = document.getElementById("main_image");
		if (!this.target) return;
		
		this.originalSrc = this.target.src;
		
		var subnav = document.getElementById("subnav");
		subnav.onmouseover = this.mouseover;
		subnav.onmouseout = this.onmouseout;
		
		var subnav_elements = subnav.getElementsByTagName("li");
		
		for (var i = 0; i<subnav_elements.length; i++)
		{
			var id = subnav_elements[i].getElementsByTagName("a")[0].id;
			this.images[id] = new Image();
			this.images[id].src = "images/" + id + ".jpg";
		}
	},
	mouseover: function(elem)
	{
		var target = (elem) ? elem.target : event.srcElement;
		
		if (target.tagName == "A")
		{
	
			if (target.parentNode.tagName != "B")
			{
			
				navImages.target.src = navImages.images[target.id].src;
				
				if (document.getElementById("subcontent"))
				{
					document.getElementById("subcontent").style.visibility = "hidden";
					document.getElementById("subcontent-container").style.visibility = "hidden";
				}
			}
		}
		
	},
	onmouseout: function(elem)
	{
		navImages.target.src = navImages.originalSrc;
		
		if (document.getElementById("subcontent"))
		{
			document.getElementById("subcontent").style.visibility = "visible";
			document.getElementById("subcontent-container").style.visibility = "visible";
		}
	}
}
