window.onload = function() {
	// currentpage.js
	// copyright (C) phpspot.org
	
	// active page's style.color
	var current_color = '#000000';
	// active page's style.fontWeight
	var current_fontWeight = 'bold';
	// active page's style.textDecoration
	var current_textDecoration = 'none';
	
	// directoryIndex page setting
	var defaultpages = ['index.html','index.htm','index.php','index.asp','default.htm'];
	
	//----------------------------------------------------------------------------------
	
	var anchors = document.getElementsByTagName('a');
	var nowurl  = location.href.split('?');
	var ichijiUrl = String(nowurl);
	var ichijiNum = ichijiUrl.match('sectionalpages');
	var ichijiNum2 = ichijiUrl.match('mokujilist');
	for (i in anchors) {
		var anchor = anchors[i];
		var anchor_href = anchor.href;
		if (anchor.className) {
			var classNameArray = anchor.className.split(' ');
			var classNameStyle = anchor.className;
			//if (anchor.className == 'currentpage' && anchor_href != undefined) {
			if (classNameStyle.match('currentpage') && anchor_href != undefined) {
				anchor_href = anchor_href.split('?');
				var is_current = 0;
				for (j in defaultpages) {
					var defaultpage = defaultpages[j];
					var tmp = nowurl[0]+defaultpage;
					if (anchor_href[0] == tmp) {
						is_current = 1;
					}
				}
				if (anchor_href[0] == nowurl[0]) {
					is_current = 1;
				}
				if (is_current) {
					anchor.style.color = current_color;
					if (classNameStyle.match('sub')) {
						anchor.style.background = 'url(/newsite/newimages/menuBgOnSub2.gif) no-repeat';
					} else {
						anchor.style.background = 'url(/newsite/newimages/menuBgOn2.gif) no-repeat';
					}
					anchor.style.fontWeight = current_fontWeight;
					anchor.style.textDecoration = current_textDecoration;
					anchor.href = '#?';
				}
				if (String(anchor.href).match('sectional') && ichijiNum == "sectionalpages" && classNameStyle.match('sub') && !String(anchor.href).match('standardization')) {
						anchor.style.background = 'url(/newsite/newimages/menuBgOnSub2.gif) no-repeat';
				}
				if (String(anchor.href).match('mokuji') && ichijiNum2 == "mokujilist" && classNameStyle.match('sub')) {
						anchor.style.background = 'url(/newsite/newimages/menuBgOnSub2.gif) no-repeat';
				}
			}
		}
	}
}
