(function(d){function f(a){d(a).addClass("progressbar");d(a).html('<div class="progressbar-text"></div><div class="progressbar-value">&nbsp;</div>');return d(a)}function e(a,b){var c=d.data(a,"progressbar").options;var h=d.data(a,"progressbar").bar;if(b){c.width=b}h._outerWidth(c.width);h.find("div.progressbar-text").width(h.width())}d.fn.progressbar=function(b,c){if(typeof b=="string"){var a=d.fn.progressbar.methods[b];if(a){return a(this,c)}}b=b||{};return this.each(function(){var h=d.data(this,"progressbar");if(h){d.extend(h.options,b)}else{h=d.data(this,"progressbar",{options:d.extend({},d.fn.progressbar.defaults,d.fn.progressbar.parseOptions(this),b),bar:f(this)})}d(this).progressbar("setValue",h.options.value);e(this)})};d.fn._outerWidth=function(a){return this.each(function(){if(!d.boxModel&&d.browser.msie){d(this).width(a)}else{d(this).width(a-(d(this).outerWidth()-d(this).width()))}})};d.fn.progressbar.methods={options:function(a){return d.data(a[0],"progressbar").options},resize:function(a,b){return a.each(function(){e(this,b)})},getValue:function(a){return d.data(a[0],"progressbar").options.value},setValue:function(a,b){if(b<0){b=0}if(b>100){b=100}return a.each(function(){var c=d.data(this,"progressbar").options;var i=c.text.replace(/{value}/,b);var j=c.value;c.value=b;d(this).find("div.progressbar-value").width(b+"%");d(this).find("div.progressbar-text").html(i);if(j!=b){c.onChange.call(this,b,j)}})}};d.fn.progressbar.parseOptions=function(a){var b=d(a);return{width:(parseInt(a.style.width)||undefined),value:(b.attr("value")?parseInt(b.attr("value")):undefined),text:b.attr("text")}};d.fn.progressbar.defaults={width:"auto",value:0,text:"{value}%",onChange:function(a,b){}}})(jQuery);