(function($){ $.fn.btn = function(){ var btn = this.data("_self"); if(btn){ return btn; }; this.init = function(){ var obj = $(this); var id=$(this).attr('id')||"gen"+Math.random(); var bntStr=[ '', '', '', '', '
 ', '', ' 
' ]; var bnt = $(bntStr.join('')).btn(); bnt._click = eval(obj.attr("onclick")); bnt.enable(); if(obj.attr("disabled")) bnt.disable(); else bnt.enable(); $(this).replaceWith(bnt); bnt.data("_self", bnt); return bnt; }; this.enable = function(){ this.removeClass("z-btn-dsb"); this.click(this._click); }; this.disable = function(){ this.addClass("z-btn-dsb"); this.unbind("hover"); this.unbind("click"); }; return this; }; $(function(){ $("input[class='phoenix']").each(function(){ $(this).btn().init(); }); }); })(jQuery);