$(function(){
    $("img.over").mouseover(function(){
        $(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_over$2"))
    }).mouseout(function(){
        $(this).attr("src",$(this).attr("src").replace(/^(.+)_over(\.[a-z]+)$/, "$1$2"));
    }).each(function(){
        $("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_over$2"))
    })
//
	$("div.pannel div:not("+$("ul.tab li a.selected").attr("href")+")").hide()
	$("ul.tab li a").click(function(){
		$("ul.tab li a").removeClass("selected")
		$(this).addClass("selected")
		$("div.pannel div").hide()
		$($(this).attr("href")).show()
		return false
	})
//
    var url = document.URL.split('/');
    $('ul#gnaviTabs li').each(function(){
    //最後のliだけpaddingを0にする
        //$("li:last-child").css("padding","0px");
    //imgタグにstayをつける
    	if ($(this).hasClass(url[3])) {
			var img = $(this).children().eq(0).children().eq(0);
			img.attr('src', img.attr('src').replace(/^(.+)(\.[a-z]+)$/, "$1_stay$2"));
			img.unbind('mouseover');
			img.unbind('mouseout');
    	}
    });

//ローカルナビゲーションに第2階層のフォルダ名をclassとして指定する
    $('ul.level02 li').each(function(){
    	var href = $(this).children().eq(0).attr('href').split('/');
		$(this).addClass(href[4]);
		if (href[4] == 'list') {
			$(this).hide();
		}
		if (href[4] == 'movabletype') {
			$(this).hide();
		}
		if (href[4] == 'compar') {
			$(this).hide();
		}
    });
    
//外部リンクにextRefを付与する
    $("#main a[target='_blank']").addClass('extRef');

})

