// Block Skip

$(function(){
	$(".skip a").focus(function(){
		$(this).addClass("show");
	});
	$(".skip a").blur(function(){
		$(this).removeClass("show");
	});
});


// Google Custom Search

$(function(){
	$("#cse-search-box").attr("action","/search-result/");
	$("#cse-search-box div.searchBox").prepend("<input type='hidden' name='cof' value='FORID:11' />");
});


$(function(){
	$("input#searchWord").val("検索ワードを入力").css("color","#a8a8a8").one("focus",function(){
		$(this).val("").css("color","#000");
	}).blur(function(){
		if($(this).val()==""){
			$(this).val("検索ワードを入力").css("color","#a8a8a8").one("focus",function(){
				$(this).val("").css("color","#000");
			});
		}
	});
});


// Dropdown Menu (for Keyboad Focus)

$(function(){
	$("#generalNav a").focus(function(){
		$(this).next("ul").addClass("show");
	});
	$("#generalNav a").blur(function(){
		$(this).next("ul").removeClass("show");
	});
	$("ul.subNav a").focus(function(){
		$(this).closest("ul").addClass("show");
	});
	$("ul.subNav a").blur(function(){
		$(this).closest("ul").removeClass("show");
	});
});


// New Window Icon

$(function(){
	$("div#homeContent a[target='_blank'], div#content a[target='_blank'], ul#generalNav a[target='_blank']").append("<img src='/images/new_win.gif' alt='新しいウィンドウで開きます' title='新しいウィンドウで開きます' width='15' height='14' class='newWin' />");

	$("div.getAdobe a img.newWin, body.mailForm ul#generalNav a img.newWin").remove();

	$("body.mailForm ul#generalNav a[target='_blank']").append("<img src='/www.dozen.ed.jp/images/new_win.gif' alt='新しいウィンドウで開きます' title='新しいウィンドウで開きます' width='15' height='14' class='newWin' />");
});


// File Icon

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

	$("div.pamphlet a img.fileIcon").remove();
});


// Form

$(function(){
	$(":input.inputField").css("background","#edf4fc").focus(function(){
		$(this).css("background","#fff");
	}).blur(function(){
		$(this).css("background","#edf4fc");
	});
});

$(function(){
	$("textarea.ask").val("聴きたいことがあれば内容をご入力ください").css("color","#666").one("focus",function(){
		$(this).val("").css("color","#000");
	}).blur(function(){
		if($(this).val()==""){
			$(this).val("聴きたいことがあれば内容をご入力ください").css("color","#666").one("focus",function(){
				$(this).val("").css("color","#000");
			});
		}
	});
});



