var utils = {
	getElementsByClassName:function(argClassName,argTagName,argParent) {
	
	  var doc = argParent || document;
	  var matches = [];
	  var i,j;
	  var nodes = [];

		if (argTagName) {
			nodes = doc.getElementsByTagName(argTagName);
		} else {
			nodes = doc.getElementsByTagName('*');
		}
		var pat = new RegExp("\\b" + argClassName + "\\b");
		for (i = 0; i < nodes.length; i++) {

			if (nodes[i].className && nodes[i].className.match(pat)) {

				matches[matches.length] = nodes[i];
			}
		}
		return matches;
	}
};
var menu = {
	init:function(containerId, rowTagName, rowClassName) {
		var iurl = "http://setokenichiro.com/i/";

		var img_off = new Object();
		var img_on = new Object();

		var container = document.getElementById(containerId);

		this.rows = null;
		this.rows = utils.getElementsByClassName(rowClassName, rowTagName, container);

		for (var i = 0; i < this.rows.length; i++) {

			if (this.rows[i].className.match(/\bselected\b/)){
				continue;
			}

			var button;
			// if (document.all && document.getElementById) {

				button = this.rows[i].getElementsByTagName('img')[0];
				img_off[button.id] = new Image();
				img_off[button.id].src = iurl + button.id + ".gif";
				img_on[button.id] = new Image();
				img_on[button.id].src = iurl + button.id + "_on.gif";

				button.onmouseover = function() {
					this.src = img_on[this.id].src;
				}
				button.onmouseout = function() {
					this.src = img_off[this.id].src;
				}
			// }

		}
	}
}