(function(a){a.extend({progressBar:new function(){this.defaults={increment:2,speed:15,showText:true,width:120,boxImage:"images/progressbar.gif",barImage:{0:"images/progressbg_red.gif",30:"images/progressbg_orange.gif",70:"images/progressbg_green.gif"},height:12};this.construct=function(d,c){var b=null;var e=null;if(d!=null){if(!isNaN(d)){b=d;if(c!=null){e=c}}else{e=d}}return this.each(function(f){var o=this;if(b!=null&&this.bar!=null&&this.config!=null){this.config.tpercentage=b;if(e!=null){o.config=a.extend(this.config,e)}}else{var m=a(this);var i=a.extend({},a.progressBar.defaults,e);var p=b;if(b==null){var p=m.html().replace("%","")}m.html("");var k=document.createElement("img");var r=document.createElement("span");k.id=this.id+"_percentImage";r.id=this.id+"_percentText";k.title=p+"%";k.alt=p+"%";k.src=i.boxImage;k.width=i.width;var g=a(k);var n=a(r);this.bar=g;this.ntext=n;this.config=i;this.config.cpercentage=0;this.config.tpercentage=p?p:0;g.css("width",i.width+"px");g.css("height",i.height+"px");g.css("background-image","url("+l(this.config.tpercentage,i)+")");g.css("padding","0");g.css("margin","0");m.append(g);m.append(n)}function l(v,u){var w=u.barImage;if(typeof(u.barImage)=="object"){for(var t in u.barImage){if(v>=parseInt(t)){w=u.barImage[t]}else{break}}}return w}var i=o.config;var s=parseInt(i.cpercentage);var j=parseInt(i.tpercentage);var q=parseInt(i.increment);var k=o.bar;var r=o.ntext;var h=i.width/100;k.css("background-image","url("+l(j,i)+")");k.css("background-position",(((i.width*-1))+(j*h))+"px 50%");k.attr("alt",Math.round(j)+"%");k.attr("title",Math.round(j)+"%");if(i.showText){r.html(" "+Math.round(j)+"%")}})}}});a.fn.extend({progressBar:a.progressBar.construct})})(jQuery);