//Following Section For MainMenu
//Sets up the menu
function menu()
{
	//Creates the arrays needed
	home_off = new Image(); home_off.src = "/gfxs/home.png";
	linux_off= new Image(); linux_off.src= "/gfxs/linux.png";
	image_off= new Image(); image_off.src= "/gfxs/images.png";
	link_off = new Image(); link_off.src = "/gfxs/links.png";
	mail_off = new Image(); mail_off.src = "/gfxs/mail.png";

	home_ovr = new Image(); home_ovr.src = "/gfxs/home-over.png";
	linux_ovr= new Image(); linux_ovr.src= "/gfxs/linux-over.png";
	image_ovr= new Image(); image_ovr.src= "/gfxs/images-over.png";
	link_ovr = new Image(); link_ovr.src = "/gfxs/links-over.png";
	mail_ovr = new Image(); mail_ovr.src = "/gfxs/mail-over.png";

	home_on = new Image(); home_on.src = "/gfxs/home-on.png";
	linux_on= new Image(); linux_on.src= "/gfxs/linux-on.png";
	image_on= new Image(); image_on.src= "/gfxs/images-on.png";
	link_on = new Image(); link_on.src = "/gfxs/links-on.png";
	
	// Find the menu div
	var d = document.getElementById( 'menu' );
	if( !d )
		return;

	// Collect the links
	var menuitems = d.getElementsByTagName( 'a' );

	for( var i = 0; i < menuitems.length; ++i )
	{
		menuitems[i].imgname = menuitems[i].getElementsByTagName( 'img' )[0].id;
		menuitems[i].onmouseover = function()
		{
			document[this.imgname].src = eval( this.imgname + "_ovr.src" );
		}

		menuitems[i].onmouseout = function()
		{
			if ( current == this.imgname )
				document[this.imgname].src = eval( this.imgname + "_on.src" );
			else
				document[this.imgname].src = eval( this.imgname + "_off.src" );
		}

		menuitems[i].onmousedown = function()
		{
			if( current )
				document[current].src = eval( current + "_off.src" );

			current = this.imgname;
			document[this.imgname].src = eval( this.imgname + "_on.src" );
		}
	}
}

window.onload=function()
{
	if( document.getElementById )
	{
		menu();
		document[current].src = eval( current + "_on.src");

		if( current == 'image' && document.createTextNode )
		{
			document.body.onmouseover=function()
			{
				gallery();
			}
		}
	}
}
