function addClass(element,value) {
	if (!element.className) {
		element.className = value;
	} else {
		newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
	}
}


function highlightCells() {
	var cells = document.getElementsByTagName("td");
	for (var i=0; i<cells.length; i++) {
		cells[i].oldClassName = cells[i].className;
		cells[i].onmouseover = function() {
			addClass(this,"highlight");
		}
		cells[i].onmouseout = function() {
			this.className = this.oldClassName;
		}
	}

	var cells = document.getElementsByTagName("th");
	for (var i=0; i<cells.length; i++) {
		cells[i].oldClassName = cells[i].className;
		cells[i].onmouseover = function() {
			addClass(this,"highlight");
		}
		cells[i].onmouseout = function() {
			this.className = this.oldClassName;
		}
	}

}	// highlightCells() end


function highlightRows() {
	var rows = document.getElementsByTagName("tr");
	for (var i=0; i<rows.length; i++) {
		rows[i].oldClassName = rows[i].className;
		rows[i].onmouseover = function() {
			addClass(this,"highlight");
		}
		rows[i].onmouseout = function() {
			this.className = this.oldClassName;
		}
	}
}	 // highlightRows() end


function stripeTables() {
	var tables = document.getElementsByTagName("table");
	
	for (var i=0; i<tables.length; i++) {
		var odd = false;
		var rows = tables[i].getElementsByTagName("tr");
		for (var j=0; j<rows.length; j++) {
			if (odd == true) {
				addClass(rows[j],"odd");
				odd = false;
			} else {
				odd = true;
			}
		}	// for[j] end
	}	// for[i] end
}	// stripeTables() end

/*
window.onload = function(){
	if (!document.getElementsByTagName) return false;

	stripeTables();		// セル・行ホバー色換えの後にするとマウスアウトのときに行の色が消える
	highlightCells();
	highlightRows();
}	// window.onload end
*/
/*
if (window.addEventListener) {	// NG:IE
    window.addEventListener("load", tableintialize, false);
   }
if (window.attachEvent) {	// NG:Fx
    window.attachEvent("onload", tableintialize);
   }
*/
function tableintialize(){
	if (!document.getElementsByTagName) return false;

	stripeTables();		// セル・行ホバー色換えの後にするとマウスアウトのときに行の色が消える
	highlightCells();
	highlightRows();
}	// intialize() end
