window.onload = function()
{
	this.navigation = new Navigation();
	PreloadImages();
	runSlideShow();
	runSlideShow2();
	runSlideShow3();
}

//+++++++++++++++++++++++++++++
function Navigation()
{
	Navigation.items = new Array();
	Navigation.show = function()
	{
		for (var i = 0; i < Navigation.items.length; i++)
		{
			var item = Navigation.items[i];

			// remove hover effect
			if (item.className == 'hover')
			{
				item.className = '';
			}
			// switch subnavigation
			var sm = document.getElementById(item.name + "_submenu");
			if (!sm)
			{
				continue;
			}
			sm.style.display = (item.className == 'current') ? '' : 'none';
		}
	}

	var m = document.getElementById('mainmenu');
	if (!m || !m.childNodes)
	{
		return;
	}
	var children = m.childNodes;
	for (var i = 0; i < children.length; i++)
	{
		var child = children.item(i);
		if (child.nodeName != 'A')
		{
			continue;
		}
		var index = Navigation.items.length;
		Navigation.items[index] = child;
	}

	Navigation.show();

	// generate javascript
	var onmouseover = function()
	{
		if (this.className == '')
		{
			this.className = 'hover';
		}
		for (var j = 0; j < Navigation.items.length; j++)
		{
			var item = Navigation.items[j];
			var sm = document.getElementById(item.name + "_submenu");
			if (sm)
			{
				sm.style.display = (this == item) ? '' : 'none';
			}
			if (this != item && item.className == 'hover')
			{
				item.className = '';
			}
		}

		if (this.timer)
		{
			clearTimeout(this.timer);
		}
		this.timer = self.setTimeout('Navigation.show()', 5000);
	}
	for (var i = 0; i < Navigation.items.length; i++)
	{
		var item = Navigation.items[i];
		item.onmouseover = onmouseover;

	}
}

//+++++++++++++++++++++++++++++
function PreloadImages()
{
	topon = new Image;
	topon.src = "graphics/top_on.gif";
	topoff = new Image;
	topoff.src = "graphics/top_off.gif";
}

//+++++++++++++++++++++++++++++
function img_act(imgName)
{
	eval("document."+imgName+".src="+imgName+"on.src;");
}

//+++++++++++++++++++++++++++++
function img_inact(imgName)
{
	eval("document."+imgName+".src="+imgName+"off.src;");
}

