// JavaScript Document

//ROLLOVER
j$(function(){
    j$("img.over").mouseover(function(){
        j$(this).attr("src",j$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_over$2"))
    }).mouseout(function(){
        j$(this).attr("src",j$(this).attr("src").replace(/^(.+)_over(\.[a-z]+)$/, "$1$2"));
    }).each(function(){
        j$("<img>").attr("src",j$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_over$2"))
    })

//STAY
var url = document.URL.split('/');
j$('ul#gnaviSecond li').each(function(){
//imgタグに stayをつける
if (j$(this).hasClass(url[3])) {
    var img = j$(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');
    }else if (j$(this).hasClass(url[4])) {
    var img = j$(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');
    }
});

//年別
    j$('ul#yearNavi li').each(function(){
        var a = j$(this).children().eq(0);
        if (a.attr('href') == location.href)
            j$(this).addClass('current');
    });
    
//外部リンクに extRefを付与する
    j$("#main a[target='_blank']").addClass('extRef');
})

//縞模様のテーブル
j$(document).ready(function(){
  j$("#main div.shimaTable table").each(function(){
    j$(this).find("tr:even").addClass("even");
  });
});

// 検索文字列
jQuery(function($) {
var placeHolder = 'Google検索';
j$("input#searchTxt")
.focus(function() {
var self = j$(this);
if (self.val() === placeHolder) self.val("");
j$(this).css('color', '#333');
})
.blur(function() {
var self = j$(this);
if (self.val() === "") self.val(placeHolder);
j$(this).css('color', '#aaa');
});
});

// 検索文字列ブログ検索
jQuery(function($) {
var placeHolder2 = 'コンテンツ内検索';
j$("input.searchBox")
.focus(function() {
var self = j$(this);
if (self.val() === placeHolder2) self.val("");
j$(this).css('color', '#333');
})
.blur(function() {
var self = j$(this);
if (self.val() === "") self.val(placeHolder2);
j$(this).css('color', '#aaa');
});
});

//インライン要素の背景
j$.fn.extend({
  inlineBgFix: function() {
    if (j$.browser.msie && j$.browser.version < 8.0) {
      j$(this)
        .prepend('<span>&nbsp;</span>')
    }
  }
});

j$(function() {
  j$('a.linkIcon').inlineBgFix();
  j$('a.linkExternal').inlineBgFix();
  j$('a.linkPDF').inlineBgFix();
});


