// Google Custom Search
$(function(){
	$("#cse-search-box").attr("action","/search_result/index.html");
	$("#cse-search-box dd").prepend("<input type='hidden' name='cof' value='FORID:11' />");
});


// Block Skip
$(function(){
    $(".skip a").focus(function(){
        $(".skip p").addClass("show");
    });
    $(".skip a").blur(function(){
        $(".skip p").removeClass("show");
    });
});


// Roll Over
$(function(){
	var image_cache = new Object();
	$("img.rollover").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on; },
			function() { this.src = imgsrc; });
	});
})


// New Window Icon
$(function(){
	$("div#main a[target='_blank']").append("<img src='/images/new_win.gif' alt='新しいウィンドウで開きます' title='新しいウィンドウで開きます' width='15' height='14' class='newWin' />");
	$("div#globalNav a[target='_blank']").append("<img src='/images/new_win.gif' alt='新しいウィンドウで開きます' title='新しいウィンドウで開きます' width='15' height='14' class='newWin' />");
	$("div#localNav a[target='_blank']").append("<img src='/images/new_win.gif' alt='新しいウィンドウで開きます' title='新しいウィンドウで開きます' width='15' height='14' class='newWin' />");
	$("div#main div#banner a img.newWin").remove();
	$("div#main div.get-adobe a img.newWin").remove();
	$("body.koho div.content td.pages img.newWin").remove();
	$("body.guide div.content td.pdf img.newWin").remove();
});


// File Icon
$(function(){
	$("div#main a[href$='.pdf']").prepend("<img src='/images/pdf_icon.gif' alt='PDFファイル' width='16' height='16' class='fileIcon' />");
	$("div#main a[href$='.doc']").prepend("<img src='/images/doc_icon.gif' alt='Wordファイル' width='16' height='16' class='fileIcon' />");
	$("div#main a[href$='.docx']").prepend("<img src='/images/doc_icon.gif' alt='Wordファイル' width='16' height='16' class='fileIcon' />");
	$("div#main a[href$='.xls']").prepend("<img src='/images/xls_icon.gif' alt='Excelファイル' width='16' height='16' class='fileIcon' />");
	$("div#main a[href$='.xlsx']").prepend("<img src='/images/xls_icon.gif' alt='Excelファイル' width='16' height='16' class='fileIcon' />");
	$("div#main div#banner a img.fileIcon").remove();
});


// Accordion
$(function(){
	$("body.shitsumon div.content dd").css("display","none");
	$("body.shitsumon div.content dt").click(function(){
		if($("+ dd",this).css("display")=="none"){
			$("body.shitsumon div.content dd").slideUp("first");
			$("+ dd",this).slideDown("first");
		}
		return false;
	});
});



