/*********************************************************************
 *
 * </english/tech/kd/js_v2/script.js>
 *
 * 更新日: 2009/12/04
 * 
 * ===================================================================
 *
 *  このJavScriptの動作には、以下のjsファイルが必要です。
 *
 *     - jquery.js (1.2.6)
 *     - jquery.equalheights.js (2.0)
 *     - jquery.preload.js (1.0.7)
 *
 *********************************************************************/

/*  Document.onLoad
---------------------------------------------------------- */

$(function(){
	// Block Element Click
	$("div#main div.link_box")
	.not(".no_link")
	.hover(
		function(){ $(this).addClass("hover");
					$(this).find("img").attr("src", function(i) {
						this.src = this.src.replace("_off.","_on.");
						});
					},
		function(){ $(this).removeClass("hover");
					$(this).find("img").attr("src", function(i) {
						this.src = this.src.replace("_on.","_off.");
						});
					}
	).click(
		function(){
			if($(this).find("a.popup").length) {
				if($(this).find("a.popup").attr("rel")) {
					thisStatus = windowStatus[$(this).attr("rel")];
					thisWindowName = $(this).attr("rel");
				} else {
					thisStatus = windowStatus["size740"];
					thisWindowName = "size740";
				}
				windowOpen($(this).find("a.popup").attr("href"), thisWindowName, thisStatus);
				return false;
			} else {
				if($(this).find("p.image a").length) { location.href = $(this).find("p.image a").attr("href"); }
				else if($(this).find("h3 a").length) { location.href = $(this).find("h3 a").attr("href"); }
			}
		}
	);
	$("div#main div.column4").equalHeights();

	if($('link[rel=prev]').length) {
		prevLink = $('link[rel=prev]').attr("href");
		$("div#bnav ul.kd li.back em").wrap('<a href="' + prevLink + '"></a>');
	}
	else {
		$("div#bnav ul.kd li.back").css("visibility","hidden");
	}
	if($('link[rel=next]').length) {
		nextLink = $('link[rel=next]').attr("href");
		$("div#bnav ul.kd li.next em").wrap('<a href="' + nextLink + '"></a>');
	}
	else {
		$("div#bnav ul.kd li.next").css("visibility","hidden");
	}
});

