function p0401NavigationObject() {
	this.stay = {
		main : "",
		sub  : ""
	}
	this.config = {
		main : {
			normal : "p0401-main-navigation-item",
			stay   : "p0401-main-navigation-item-stay",
			self   : "p0401-sub-navigation-stay"
		},
		sub : {
			normal : "p0401-sub-navigation-item",
			stay   : "p0401-sub-navigation-item-stay",
			self   : "p0401-sub-navigation-stay"
		}
	}
	this.indexFileNames = [
		"index.htm",
		"index.html",
		"index.shtm",
		"index.shtml",
		"index.cgi",
		"index.cfm",
		"index.php",
		"default.asp",
		"Default.asp"
	]
}
p0401NavigationObject.prototype = {
	init : function() {
		var _this = this;
		if (typeof(window.addEventListener) == "function" || typeof(window.addEventListener) == "object") {
			window.addEventListener("load", function(){ _this.setStay(); }, false);
		} else if (typeof(window.attachEvent) == "function" || typeof(window.attachEvent) == "object") {
			window.attachEvent("onload", function(){ _this.setStay(); });
		} else {
			if ((typeof(window.onload) == "function" || typeof(window.onload) == "object") && window.onload) {
				var _func = window.onload;
				window.onload = function() {
					_func();
					_this.setStay();
				}
			} else {
				window.onload = function(){ _this.setStay(); };
			}
		}
	},
	setStay : function() {
		for (var i in this.stay) {
			var id = this.stay[i];
			if (!id) continue;

			var node = this.getElementById(id);
			if (!node) continue;

			var config = this.config[i];
			if (!config || !config.normal || !config.stay) continue;

			this.removeLink(node);

			var currentNode = node;
			var classNames = this.getClassNames(node);
			if (config.self) {
				classNames[classNames.length] = config.self;
			}
			this.setClassName(node, classNames.join(" "));
			if (document.body.parentNode) {
				do {
					this.convertClassName(currentNode, config.normal, config.stay);
				} while ((currentNode = currentNode.parentNode));
			} else if (document.body.parentElement) {
				do {
					this.convertClassName(currentNode, config.normal, config.stay);
				} while ((currentNode = currentNode.parentElement));
			}
		}
		return true;
	},
	removeLink : function(node) {
		if (!node) return false;
		var link = null;
		if (typeof(node.getElementsByTagName) == "function" || typeof(node.getElementsByTagName) == "object") {
			link = node.getElementsByTagName("a")[0];
		}
		if (!link) return false;
		if (typeof(link.removeAttribute) == "function" || typeof(link.removeAttribute) == "object") {
			var _indexFileNames = this.indexFileNames;
			function chopIndexFileName(url) {
				for (var i = 0, n = _indexFileNames.length; i < n; i++) {
					var offset = url.indexOf("/" + _indexFileNames[i]);
					if (offset != -1 && offset == (url.length - _indexFileNames[i].length - 1)) {
						url = url.replace(_indexFileNames[i], "");
					}
				}
				return url;
			}
			var pageurl = chopIndexFileName(location.protocol + "//" + location.hostname + ((location.port) ? ":" + location.port : "") + location.pathname);
			var href    = chopIndexFileName(link.href);
			if (pageurl == href) {
				link.removeAttribute("href");
				return true;
			} else {
				return false;
			}
		}
		return false;
	},
	convertClassName : function(node, before, after) {
		if (!node || !before || !after) return false;
		var classNames = this.getClassNames(node);
		for (var i = 0, n = classNames.length; i < n; i++) {
			if (classNames[i] == before) {
				classNames[i] = after;
			}
		}
		this.setClassName(node, classNames.join(" "));
		return true;
	},
	getClassNames : function(node) {
		if (!node) return [];
		var classNames = [];
		if (typeof(node.getAttribute) == "function" || typeof(node.getAttribute) == "object") {
			if (document.all && !window.opera) {
				var className = node.getAttribute("className") || "";
				classNames = className.split(/ +/);
			} else {
				var className = node.getAttribute("class") || "";
				classNames = className.split(/ +/);
			}
		} else if (typeof(node.className) == "string") {
			classNames = node.className.split(/ +/);
		}
		return classNames;
	},
	setClassName : function(node, className) {
		if (!node) return false;
		if (typeof(node.setAttribute) == "function" || typeof(node.setAttribute) == "object") {
			if (document.all && !window.opera) {
				node.setAttribute("className", className);
			} else {
				node.setAttribute("class", className);
			}
		} else if (typeof(node.className) == "string") {
			node.className = className;
		}
		return true;
	},
	getElementById : function(id) {
		if (!id) return null;
		var node = null;
		if (typeof(document.getElementById) == "function" || typeof(document.getElementById) == "object") {
			node = document.getElementById(id);
		} else if (typeof(document.all) == "function" || typeof(document.all) == "object") {
			var temp = document.all(id);
			if (temp.length) {
				node = temp[0];
			} else {
				node = temp;
			}
		}
		return node;
	}
}

var p0401Navigation = new p0401NavigationObject;
p0401Navigation.init();
