/*
 * ------------------------------------------------
 * navi.js
 * 
 * ĄDepending library 
 * 
 * jquery-1.2.1.pack.js @see http://jquery.com/
 *  
 * Version: 1.0.0  
 * Copyright (c) 2007 WiZ All Right Reserved.
 * ------------------------------------------------
 */

$(
	function() {
		var flowMappings = [
			{ id: "business_model.html",		name: "nv_business_model"},
			{ id: "philosophy.html",			name: "nv_company_pilosophy"},
			{ id: "history.html",				name: "nv_company_history"},
			{ id: "organization.html", 			name: "nv_company_organizational_chart"},
			{ id: "company_outline.html",		name: "nv_company_outline"},
			{ id: "group_outline.html",			name: "nv_group_outline"},
			{ id: "map.html",					name: "nv_office_guidance_map"},
			{ id: "message.html",				name: "nv_president_message"},
			{ id: "site_map.html",				name: "nv_site_map"},
			{ id: "index.html",					name: "nv_top"}
		]

		var links = $("ul#primaryNavi li a");
		var images = $("ul#primaryNavi li a img");
		pattern = new RegExp(document.location.href, "g");
		for (i = 0; i < links.length; i++) {
			for (x = 0; x < flowMappings.length; x++) {
				if (links[i].href.match(pattern) != null) {
					images[i].src = images[i].src.replace(/(\.gif|\.jpg|\.png)/, "_f2" + "$1");
					images[i].setAttribute("class", "currently");
					images[i].className = "currently";
					break;
				}
			}
		}


		$("img[@class=primary]")
		.mouseover(
			function () {
				this.src = this.src.replace(/(\.gif|\.jpg|\.png)/, "_f2" + "$1");
			}
		)

		.mouseout(
			function () {
				this.src = this.src.replace(/^(.+)_f2(.[a-z]+)$/, "$1$2");
			}
		);
	}
);