// $Id$
var navigation = new Object();
navigation.init = function() {
	var navRoot, k, i, node, j, items, itemNode;
	if (document.getElementById && document.getElementsByTagName) {
		var navRoots = document.getElementsByTagName("ul")
		if (navRoots) {
			for (k = 0; k < navRoots.length; k++) {
				navRoot = navRoots[k];
				if (navRoot.className == "menubar" && navRoot.childNodes) {
					for (i = 0; i < navRoot.childNodes.length; i++) {
						node = navRoot.childNodes[i];
						if (node.nodeName == "LI" || node.nodeName == "li") {
							node.style.zIndex = navRoot.childNodes.length - i;
							if (document.all) {
								if (node.className) {
									node.onmouseover = function() {this.className += " over";}
									node.onmouseout = function() {this.className = this.className.replace(" over", "");}
								} else {
									node.onmouseover = function() {this.className = "over";}
									node.onmouseout = function() {this.className = "";}
								}
								items = node.getElementsByTagName("li");
								for (j = 0; j < items.length; j++) {
									itemNode = items[j];
									if (itemNode.className) {
										itemNode.onmouseover = function() {this.className += " over";}
										itemNode.onmouseout = function() {this.className = this.className.replace(" over", "");}
									} else {
										itemNode.onmouseover = function() {this.className = "over";}
										itemNode.onmouseout = function() {this.className = "";}
									}
								}
							}
						}
					}
				}
			}
		}
		
 	}
	if (document.getElementById) {
		this.navid = this.id();
		if (!this.navid && !location.search) this.navid ="accueil";
		if (this.navid) {
			var current_link = document.getElementById("nav_menu_link-" + this.navid);
			if (current_link) {
				current_link.className = "currentLink";
				var current_menu_item = current_link.parentNode;
				if (current_menu_item) {
					var current_menu = current_menu_item.parentNode;
					var child_menus = current_menu_item.getElementsByTagName('ul');
					var menu_root = current_menu.parentNode;
					if (menu_root.nodeName == "LI" || menu_root.nodeName == "li") {
						menu_root.className = "currentHead";
						current_menu.className = "currentMenu";
						current_menu_item.className = "currentItem";
						current_menu_item.onmouseover = null;
						current_menu_item.onmouseout = null;
					} else if (child_menus.length) {
						child_menus[0].className = "currentMenu";
						current_menu_item.className = "currentHead";
					} else current_menu_item.className = "currentSingleHead";
				}
			}
		}
	}
}
navigation.onload = (window.onload) ? window.onload : function () {};
window.onload = function () {navigation.onload(); navigation.init()};
navigation.id = function () {
	if (location.pathname.match(/.*\/nav:/))  var navid = location.pathname.replace(/.*\/nav:/, "");
	else if (location.search.match(/.*navid=/))  var navid = location.search.replace(/.*navid=/, "").replace(/&.*/, "");
	return navid;
}
navigation.link = function () {
	var parameters = this.link.arguments;
	if (parameters.length == 1) return true;
	switch (parameters[1]) {
		case "popup" :
			if (parameters[3]) {
				var width = parseInt (parameters[3].replace(/.*width=/, ""));
				var height = parseInt (parameters[3].replace(/.*height=/, ""));
				var newWindow = window.open(parameters[0].href, parameters[2], parameters[3]);
				if (width && height && window.resizeTo) try {newWindow.resizeTo (width, height)} catch (e) {};
				try {newWindow.moveTo(0,0)} catch (e) {};
			} else {
				var newWindow = window.open(parameters[0].href, parameters[2]);
			}
			newWindow.focus();
			if (window.event) event.cancelBubble = true;
			return false;
		default :
	}
	return true;
}