﻿$(document).ready(function() {
	var url = document.location.href.replace(/\?.*$/, '');  // remove GET query string

	// highlite current top navigation link
	var img_list = $('#top_navi > LI.item > A > IMG');
	for (var i = 0; i < img_list.length; i++) {
		var img = img_list[i];
		if (url.search(new RegExp(img.parentNode.getAttribute('href')+'$')) != -1) {
			img.className = 'highlite';
		}
	}

	// highlite current left navigation link
	var a_list = $('#left_navi A');
	for (var i = 0; i < a_list.length; i++) {
		a = a_list[i];
		if (url.search(new RegExp(a.getAttribute('href')+'$')) != -1) {
			a.className = 'highlite';
		}
	}

	// show current main graphic
	$('.main_graphic').each(function() {
		var found = false;
		jQuery.each(this.getAttribute('alt').split('|'), function() {
			if (url.search(this) != -1) {
				found = true;
			}
		});
		if (found) {
			this.style.display = 'block';
		}
	});
});
