(function(d){function f(a){var b=d.data(a,"linkbutton").options;d(a).empty();d(a).addClass("l-btn");if(b.id){d(a).attr("id",b.id)}else{d(a).removeAttr("id")}if(b.plain){d(a).addClass("l-btn-plain")}else{d(a).removeClass("l-btn-plain")}if(b.text){d(a).html(b.text).wrapInner('<span class="l-btn-left"><span class="l-btn-text"></span></span>');if(b.iconCls){d(a).find(".l-btn-text").addClass(b.iconCls).css("padding-left","20px")}}else{d(a).html("&nbsp;").wrapInner('<span class="l-btn-left"><span class="l-btn-text"><span class="l-btn-empty"></span></span></span>');if(b.iconCls){d(a).find(".l-btn-empty").addClass(b.iconCls)}}d(a).unbind(".linkbutton").bind("focus.linkbutton",function(){if(!b.disabled){d(this).find("span.l-btn-text").addClass("l-btn-focus")}}).bind("blur.linkbutton",function(){d(this).find("span.l-btn-text").removeClass("l-btn-focus")});e(a,b.disabled)}function e(a,b){var c=d.data(a,"linkbutton");if(b){c.options.disabled=true;var h=d(a).attr("href");if(h){c.href=h;d(a).attr("href","javascript:void(0)")}if(a.onclick){c.onclick=a.onclick;a.onclick=null}d(a).addClass("l-btn-disabled")}else{c.options.disabled=false;if(c.href){d(a).attr("href",c.href)}if(c.onclick){a.onclick=c.onclick}d(a).removeClass("l-btn-disabled")}}d.fn.linkbutton=function(b,a){if(typeof b=="string"){return d.fn.linkbutton.methods[b](this,a)}b=b||{};return this.each(function(){var c=d.data(this,"linkbutton");if(c){d.extend(c.options,b)}else{d.data(this,"linkbutton",{options:d.extend({},d.fn.linkbutton.defaults,d.fn.linkbutton.parseOptions(this),b)});d(this).removeAttr("disabled")}f(this)})};d.fn.linkbutton.methods={options:function(a){return d.data(a[0],"linkbutton").options},enable:function(a){return a.each(function(){e(this,false)})},disable:function(a){return a.each(function(){e(this,true)})}};d.fn.linkbutton.parseOptions=function(b){var a=d(b);return{id:a.attr("id"),disabled:(a.attr("disabled")?true:undefined),plain:(a.attr("plain")?a.attr("plain")=="true":undefined),text:d.trim(a.html()),iconCls:(a.attr("icon")||a.attr("iconCls"))}};d.fn.linkbutton.defaults={id:null,disabled:false,plain:false,text:"",iconCls:null}})(jQuery);