/*************************************************************
 * fbl/common/js/common.js
 * (C) 2009 enn
 *
 * Author: SEKI, Shintaro
 * Date  : 2009/10/21
 *
 ** NOTE *****************************************************
 * Using jQuery 1.3.2
*************************************************************/
/*
 * img.swapimg
 *
 * クラスにswapimgを指定すると後に"_o"を付けた画像と入れ替える。
 */
$(document).ready(function() {
	$("img.swapimg").each(function() {
		// get file name
		var t = this.src.match(/(.*)\.(\w+)$/);
		var swapSrc = t[1] + "_o." + t[2];
		// pre load
		var swapImg = new Image();
		swapImg.src = swapSrc;
		// register event
		var obj = $(this);
		obj.hover(
			function() {
				this.src = swapSrc;
			},
			function() {
				this.src = t[0];
			}
		);
	});
});

/*
 * ColumnColor
 *
 * tableの列全体の色を変える
 * sel    : tableに付けたclass, id
 * color  : 色
 * column : 列
 */
var ColumnColor = function(sel, color, column) {
	// 徹底的に限定的にしないと内部のテーブルまで影響が及んでしまう
	$("table" + sel + " > tbody > tr > :nth-child("+column+")").each(function() {
		if (this.tagName != "BR") {
			$(this).css("background-color", color);
		}
	});
}


