var menuColors = {
	'route.php' : '#41AA54',
	'station.php' : '#34B3D1',
	'event.php' : '#F781BF',
	'volunteer.php' : '#BC75B7',
	'karatsuline.php' : '#FD8831',
	'article.php' : '#41B194',
	'links.php' : '#9FD44A'
}

var stationMenuColors = {
	'nishikaratsu.php' : '#FC4128',
	'karatsu.php' : '#FC4128',
	'oniduka.php' : '#FC4128',
	'yamamoto.php' : '#FC4128',
	'honmutabe.php' : '#FC4128',
	'ouchi.php' : '#FC4128',
	'iwaya.php' : '#FC4128',
	'kyuragi.php' : '#FC4128',
	'taku.php' : '#FC4128',
	'nakataku.php' : '#FC4128',
	'higashitaku.php' : '#FC4128',
	'ogi.php' : '#FC4128',
	'kubota.php' : '#FC4128'
}

var eventMenuColors = {
	'event200807.php' : '#666666',
	'event20080720.php' : '#666666',
	'20090912jrwalk.php' : '#666666'
}

function setMenuColor()
{
	var menu = document.getElementById('mainmenu');
	var menus = menu.getElementsByTagName('li');
	location.pathname.match(/\/([^\/]+)$/);
	var filename= RegExp.$1;
	if(typeof menuColors[filename] == 'undefined')
	{
		if(typeof stationMenuColors[filename] != 'undefined')
		{
			for(var i = 0; i < menus.length; i ++)
			{
				var aTags = menus[i].getElementsByTagName('a');
				for(var j = 0; j < aTags.length; j ++)
				{
					if(aTags[j].getAttribute('href').match(/\/([^\/]+)$/))
					{
						if(RegExp.$1 == filename)
						{
							menus[i].style.backgroundColor = '#FC4128';
						}
					}
				}
			}
			filename = 'station.php';
		}
		if(typeof eventMenuColors[filename] != 'undefined')
		{
			for(var i = 0; i < menus.length; i ++)
			{
				var aTags = menus[i].getElementsByTagName('a');
				for(var j = 0; j < aTags.length; j ++)
				{
					if(aTags[j].getAttribute('href').match(/\/([^\/]+)$/))
					{
						if(RegExp.$1 == filename)
						{
							menus[i].style.backgroundColor = '#FC4128';
						}
					}
				}
			}
			filename = 'event.php';
		}
	}
	for(var i = 0; i < menus.length; i ++)
	{
		var aTags = menus[i].getElementsByTagName('a');
		for(var j = 0; j < aTags.length; j ++)
		{
			if(aTags[j].getAttribute('href').match(/\/([^\/]+)$/))
			{
				if(RegExp.$1 == filename)
				{
					menus[i].style.backgroundColor = menuColors[filename];
					return;
				}
			}
		}
	}
}
