function tomButton(ctl) { var obj = this; this.id = ctl.getAttribute("id2"); this.div = ctl.getElementsByTagName("div")[0]; this.spans = ctl.getElementsByTagName("span"); ctl.onmouseover = function(){obj.toggle(1);} ctl.onmouseout = function(){obj.toggle(0);} ctl.onmousedown = function(){obj.click();} ctl.onmouseup = function() { obj.toggle(0); raiseevent(obj,"Click",""); } this.ctl = ctl; this.fn = this.ctl.onmouseup; } tomButton.prototype.toggle = function(cod) { this.spans[0].className = "bgL"+cod; this.spans[1].className = "Inh"+cod; this.spans[4].className = "bgR"+cod; if(cod==0) { this.div.style.left = "0px"; this.div.style.top = "0px"; } } tomButton.prototype.click = function(cod) { this.div.style.left = "1px"; this.div.style.top = "1px"; this.spans[0].className = "bgLClick"; this.spans[1].className = "InhClick"; this.spans[4].className = "bgRClick"; } tomButton.prototype.setAction = function(fn) { var obj = this; var nu = function() { obj.fn(); fn(); } this.ctl.onmouseup = nu; }