$(function(){
	var url = location.href.split('#')[0];
	var current = url.split('/')[3];
	var dir = [
		'/feature/',
		'/lineup/',
		'/mechanism/',
		'/case/',
		'/voice/',
		'/faq/'
	];
	
	jQuery.each(dir, function(i) {
		if(url.indexOf(this) != -1){
			$('#navi_'+ (i+1) +' a').addClass('current');
		}
	});
	
	$('#globalnavi dl').hover(
		function(){$('dd', this).show()},
		function(){$('dd', this).hide()}
	)
	
	$('img.rollover').hover(
		function(){$(this).css('opacity', 0.6)},
		function(){$(this).css('opacity', 1.0)}
	)

	$('img.change').hover(
		function(){$(this).attr('src',$(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1_on$2'))},
		function(){$(this).attr('src',$(this).attr('src').replace(/^(.+)_on(\.[a-z]+)$/, '$1$2'))}
	).each(function(){
		$('<img>').attr('src',$(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1_on$2'))
	})

	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target || $('[name=' + this.hash.slice(1) +']');
			if (target.length) {
				$('html,body').animate({ scrollTop: target.position().top }, 'slow');
				return false;
			}
		}
	});

});

function getPath() {
	var path;
	var file = 'shared/js/common.js';
	var script = document.getElementsByTagName('script');
	
	for (var i = 0, ix = script.length; i < ix; i++) {
		if (script[i].src && script[i].src.indexOf(file) >= 0) {
			path = script[i].src.split(file)[0];
			break;
		}
	}
	return path;
}


function openWin(url,name,op) {
  window.open(url,name,op);
}

