cname="tblcloth";
col1="#cfeefe";
col2="#f5f5f5";
col3="#ffdddd";
col4="#ffdddd";
col5="#ffdddd";
this.tables = new Array();
this.trs = {};

	// テーブル要素にイベント設定


	// マウスオーバー処理
	this.over = function(obj,row){
		if(check1(obj,row)){ highlightRow(obj,row); }
	};

	// マウスアウト処理
	this.out = function(obj,row){
		if(check1(obj,row)){ unhighlightRow(obj,row); }
	};

	// ハイライト設定on
	this.highlightRow = function(obj,row){
		if(obj){
			//obj.className = (check3(obj)) ? "over-selected" : "over";
			obj.style.backgroundColor = (check3(obj)) ? col5 : col3;
		}
	};

	// ハイライト設定off
	this.unhighlightRow = function(obj,row){
		if(obj){
			obj.style.backgroundColor = (check3(obj)) ? col4 : obj.bgcolor;
		}
	};

	// 要素存在チェック
	this.check1 = function(obj,row){
		if(!obj) return false;
		return (!(obj.className.indexOf("empty") != -1));
	}

	// 要素THチェック
	this.check2 = function(obj){
		if(!obj) return false;
		return (!(obj.tagName == "TH"));
	};

	// 要素selectedチェック
	this.check3 = function(obj){
		if(!obj) return false;
		return obj.selected;
	};


var mode  = 0;
var color = "";
var tbl = document.getElementsByTagName("table");
for (var i=0;i<tbl.length;i++){
	if(tbl[i].className && tbl[i].className==cname){ tables.push(tbl[i]); }
}
for (var i=0;i<tables.length;i++){
	tables[i].id = "_tablestripe_autoid_" + i;
	trs[tables[i].id] = tables[i].getElementsByTagName("tr");
	for (var j=0;j<trs[tables[i].id].length;j++){
		var tr = trs[tables[i].id][j];
		tr.row = j;
		if(check1(tr,j)){
			color = (mode) ? col1 : col2;
			mode = 1 - mode;
			tr.bgcolor = color;
			tr.style.backgroundColor = color;
			tr.onmouseover = function(){ over(this,this.row); }
			tr.onmouseout  = function(){ out(this,this.row); }
		}
	}
}