var Throbber = new Class({ initialize : function (target) { this.target = $(target); this.status = 0; this.img = document.createElement('img'); this.img.src = arguments[1] || './images/throbber.gif'; }, on : function() { if (this.status == 0) { this.target.appendChild(this.img); this.status = 1; } }, off : function() { if (this.status == 1) { try { $(this.img).remove(); } catch(x) { } this.status = 0; } }, toggle : function() { if (this.status) this.off(); else this.on(); } });