var j = Class.extend({
	create : function(obj) {
		var img = obj.getAttribute("image");
		var name = obj.innerHTML;
		var act = obj.getAttribute("action");
		var type = obj.getAttribute("type");
		var id = obj.getAttribute("id");
		var disabled = obj.getAttribute("disable");
		var fontStyle = obj.getAttribute("fontStyle");
		var leftStyle = obj.getAttribute("leftStyle");
		var iH = "16";
		if (obj.getAttribute("w")) iH = obj.getAttribute("w");
		
		if (obj.getAttribute("mode")=="spacer") {
			var pos = obj.getAttribute("pos");
			var str = "<img src=\"images/s.gif\" width=\""+iH+"\" height=\""+iH+"\" style=\"background:transparent url("+img+".gif) no-repeat 0px "+pos+"px;\" onmouseover=\"this.style.backgroundPosition='-"+iH+"px "+pos+"px';\" onmouseout=\"this.style.backgroundPosition='0px "+pos+"px';\" onmouseup=\""+act+"\">";
			obj.innerHTML = str;
			return;
		}
		
		
		var str = "<ul style=\"margin:0 0 0 0; padding:0px; list-style-type:none; white-space:nowrap; display:inline; height:21px; cursor:default;\" ";
		if (disabled != "true") {
		str += "onmouseover=\"this.childNodes[0].style.backgroundPosition='0px -"+(iH)+"px'; this.childNodes[1].style.backgroundPosition='right -"+(iH)+"px';\" onmouseout=\"this.childNodes[0].style.backgroundPosition='0px 0px'; this.childNodes[1].style.backgroundPosition='right 0px';\" onmousedown=\"this.childNodes[0].style.backgroundPosition='0px -"+(iH*2)+"px'; this.childNodes[1].style.backgroundPosition='right -"+(iH*2)+"px';\" onmouseup=\"";
		
			if (act != null) {
				if ((act == "submit") || (act == "reset")) {
					var pNode = obj.parentNode;
					var c = 0;
					while (pNode.tagName != "FORM") {
						pNode = pNode.parentNode;
						c++;
						if (c == 100) break;
					}
					if (c != 100) {
						var tStr = "";
						tStr += "document.forms['"+pNode.name+"']";
						tStr += (act == "submit") ? ".submit()" : ".reset()";
						tStr += ";";
						if ((pNode.getAttribute("customSubmit")) && (act=="submit")) {
							str += "if ("+pNode.getAttribute("customSubmit")+") { "+tStr+" }";
						} else {
							str += tStr;
						}
					}
				} else {
					str += act;
				}
			}
			str += "\" ";
		}
		str += "><li style=\"line-height:"+(iH)+"px; height:"+(iH)+"px; padding-left:5px; display:inline;float: left; background:transparent url("+img+".gif) no-repeat 0px ";
		str += (disabled!="true") ? "0px;" : "-"+(iH*3)+"px;";
		str += (leftStyle != null) ? leftStyle : "";
		str += "\">&nbsp;</li>";
		str += "<li style=\"line-height:"+(iH)+"px; height:"+(iH)+"px; display:inline;float: left; padding-right:10px; background:transparent url("+img+".gif) no-repeat right ";
		str += (disabled!="true") ? "0px;" : "-"+(iH*3)+"px; color:#808080;";
		str += (fontStyle != null) ? fontStyle : "";
		str += "\">"+name+"</li>";
		str += "</ul>";
		if (type == "submit") {
			str += "<input type=\"image\" src=\"images/s.gif\" width=\"1\" height=\"1\" border=\"0\" style=\"border:none;\">";
		}
		obj.innerHTML = str;
	},
	
	disable : function(name) {
		
	},
	
	enable : function (name) {
		
	}
});

var button = new j();