/* ================================================== */
/* NDL Search　アクセシビリティ対応javascript         */
/* accessibility.js                                   */
/* 【注意】必ずjquery-1.4.2.min.jsの後に実行すること  */
/*                                                    */
/*                                                    */
/* 来歴---------------------------------------------- */
/* 2011/07/06　新規作成                               */
/*                                                    */
/* ================================================== */


/* 初期処理：onload時処理定義　引数：なし　返り値：なし */
$(document).ready(function(){

	// ツールチップ定義
	$('.popup-guidance a').hover(
		function(){

			$(this).parents("td").css("z-index","100");		// IE6バグ対策
			this.tmpchar = $(this).siblings("img").attr("alt");	// 一時的にtitle属性の中身を退避
			$(this).after(
				'<span class="popup-guidance_container">'
					+ '<span class="popup-guidance_header">&nbsp;</span>'
					+ '<span class="popup-guidance_contents">' + this.tmpchar + '</span>'
				+'</span>'
			);

			// アイコンの位置によって表示方向を調整
			if($(window).width() - $(this).offset().left > $("span.popup-guidance_container").width() + 48){
				$('span.popup-guidance_container').css({ left: $(this).width() - 48 })
			}else{

				$('span.popup-guidance_container').css({ left: $(this).width() + 48 - $("span.popup-guidance_container").width() })
				$('span.popup-guidance_header').addClass("left");

			}

			$('span.popup-guidance_container').slideDown("fast");
			
		},
		function(){
			$(this).parents("td").css("z-index","0");		// IE6バグ対策
			$(this).siblings("span.popup-guidance_container").remove();
			$(this).attr("tmpchar", "");
		}
	);



});




