var Menu = Class.create();
Menu.prototype = {
	initialize: function(itemPrefix, numItems, imagePrefix)
	{
		var i;
		this.imagePrefix = imagePrefix;
		this.pageFileName = document.URL.substring(document.URL.lastIndexOf('/')+1);
		this.pageFileName = this.pageFileName.substring(this.pageFileName.lastIndexOf('\\')+1);
		if(this.pageFileName.length == 0)
		{
			this.pageFileName = 'index.html';
		}
		var menuItems = document.getElementsByClassName('menuItem');
		menuItems.each( this.initItem, this );
	},
	initItem: function(anchorTag)
	{
		var targetURL = anchorTag.href.substring(anchorTag.href.lastIndexOf('/')+1);
		targetURL = targetURL.substring(anchorTag.href.lastIndexOf('\\')+1);
		var index = anchorTag.childNodes[0].src.lastIndexOf('.')
		
		anchorTag.imgBase = anchorTag.childNodes[0].src.substring(0, index);
		anchorTag.imgExt = anchorTag.childNodes[0].src.substring(index, anchorTag.childNodes[0].src.length);

		if(targetURL == this.pageFileName)
		{
			anchorTag.childNodes[0].src = anchorTag.imgBase+'-active'+anchorTag.imgExt;
			anchorTag.href = null;
		}
		else
		{
			anchorTag.onmouseover = function()
			{
				this.childNodes[0].src = this.imgBase+'-on'+this.imgExt;
			}
			anchorTag.onmouseout = function()
			{
				this.childNodes[0].src = this.imgBase+this.imgExt;
			}
		}
	}
};


