/* AWCoding Back-End created by AWNetwork, Inc., Version 3.0.9, Bars Script, Copyright 2009 all rights reserved */
function CreateBar(c,b,d,a,g,e,f){if(f){switch(d){case 1:PB_1=new JS_BRAMUS.jsProgressBar($(b),a,{animate:g,showText:true,barid:c,boxImage:home_bars+"awcoding/images/bar/percentImage2_"+e+".png",barImage:Array(home_bars+"awcoding/images/bar/percentImage2_back4.png",home_bars+"awcoding/images/bar/percentImage2_back3.png",home_bars+"awcoding/images/bar/percentImage2_back2.png",home_bars+"awcoding/images/bar/percentImage2_back1.png")});break;case 2:PB_2=new JS_BRAMUS.jsProgressBar($(b),a,{animate:g,showText:true,barid:c,width:400,boxImage:home_bars+"awcoding/images/bar/percentImage3_"+e+".png",barImage:Array(home_bars+"awcoding/images/bar/percentImage3_back4.png",home_bars+"awcoding/images/bar/percentImage3_back3.png",home_bars+"awcoding/images/bar/percentImage3_back2.png",home_bars+"awcoding/images/bar/percentImage3_back1.png"),height:20});break;case 3:PB_3=new JS_BRAMUS.jsProgressBar($(b),a,{animate:g,showText:true,barid:c,boxImage:home_bars+"awcoding/images/bar/percentImage4_"+e+".png",barImage:Array(home_bars+"awcoding/images/bar/percentImage4_back4.png",home_bars+"awcoding/images/bar/percentImage4_back3.png",home_bars+"awcoding/images/bar/percentImage4_back2.png",home_bars+"awcoding/images/bar/percentImage4_back1.png")});break}}else{switch(d){case 1:PB_1=new JS_BRAMUS.jsProgressBar($(b),a,{animate:g,showText:true,barid:c,boxImage:"awcoding/images/bar/percentImage2_"+e+".png",barImage:Array("awcoding/images/bar/percentImage2_back4.png","awcoding/images/bar/percentImage2_back3.png","awcoding/images/bar/percentImage2_back2.png","awcoding/images/bar/percentImage2_back1.png")});break;case 2:PB_2=new JS_BRAMUS.jsProgressBar($(b),a,{animate:g,showText:true,barid:c,width:400,boxImage:"awcoding/images/bar/percentImage3_"+e+".png",barImage:Array("awcoding/images/bar/percentImage3_back4.png","awcoding/images/bar/percentImage3_back3.png","awcoding/images/bar/percentImage3_back2.png","awcoding/images/bar/percentImage3_back1.png"),height:20});break;case 3:PB_3=new JS_BRAMUS.jsProgressBar($(b),a,{animate:g,showText:true,barid:c,boxImage:"awcoding/images/bar/percentImage4_"+e+".png",barImage:Array("awcoding/images/bar/percentImage4_back4.png","awcoding/images/bar/percentImage4_back3.png","awcoding/images/bar/percentImage4_back2.png","awcoding/images/bar/percentImage4_back1.png")});break}}}document.observe("dom:loaded",function(){if(enhancedBars.module==true){for(i=0;i<bar_count;i++){CreateBar(bar_data[i][0],bar_data[i][1],bar_data[i][2],bar_data[i][3],bar_data[i][4],bar_data[i][5],bar_data[i][6])}}if(enhancedBars.sidebar==true){for(i=0;i<sidebar_count;i++){CreateBar(sidebar_data[i][0],sidebar_data[i][1],sidebar_data[i][2],sidebar_data[i][3],sidebar_data[i][4],sidebar_data[i][5],sidebar_data[i][6])}}if(enhancedBars.centerbar==true){for(i=0;i<centerbar_count;i++){CreateBar(centerbar_data[i][0],centerbar_data[i][1],centerbar_data[i][2],centerbar_data[i][3],centerbar_data[i][4],centerbar_data[i][5],centerbar_data[i][6])}}},false);var defaultOptions={animate:true,showText:true,width:120,boxImage:"awcoding/images/bar/percentImage.png",barImage:"awcoding/images/bar/percentImage_back.png",height:12,barid:null,onTick:function(a){return true}};if(!JS_BRAMUS){var JS_BRAMUS=new Object()}JS_BRAMUS.jsProgressBar=Class.create();JS_BRAMUS.jsProgressBar.prototype={el:null,id:null,percentage:null,options:null,initialPos:null,initialPerc:null,pxPerPercent:null,backIndex:null,numPreloaded:null,running:null,queue:false,initialize:function(c,a,b){this.options=Object.clone(defaultOptions);Object.extend(this.options,b||{});this.el=$(c);this.id=$(c).id;this.percentage=0;this.backIndex=0;this.numPreloaded=0;this.running=false;this.queue=Array();this.imgWidth=this.options.width*2;this.initialPos=this.options.width*(-1);this.pxPerPercent=this.options.width/100;this.initialPerc=a;if(this.options.barImage.constructor!=Array){this.options.barImage=Array(this.options.barImage)}this.initVisuals()},initVisuals:function(){$(this.el).update('<a href="'+home_bars+'awc_ds.php?do=donation&id='+this.options.barid+'"><img border="0" id="'+this.id+'_percentImage" src="'+this.options.boxImage+'" alt="0%" style="width: '+this.options.width+"px; height: "+this.options.height+"px; background-position: "+this.initialPos+"px 50%; background-image: url("+this.options.barImage[this.backIndex]+'); padding: 0; margin: 0;" class="percentImage" /></a>'+((this.options.showText==true)?' <span id="'+this.id+'_percentText" class="percentText">0%</span>':""));this.setPercentage(this.initialPerc)},setPercentage:function(b,a){if(a){this.percentage=(this.queue.length!=0)?this.queue[0]:b;this.timer=null;this.queue=[];setTimeout(function(){this.setPercentage(b)}.bind(this),10)}else{this.queue.push(b);if(this.running==false){this.processQueue()}}},processQueue:function(){if(this.queue.length>0){this.running=true;this.processQueueEntry(this.queue[0])}else{return}},processQueueEntry:function(b){var a=this.percentage;if((b.toString().substring(0,1)=="+")||(b.toString().substring(0,1)=="-")){b=a+parseInt(b)}if(b<0){b=0}if(b>100){b=100}if(this.options.animate==false){this.queue.splice(0,1);this._setBgPosition(b);if(!this.options.onTick(this)){return}this.running=false;this.processQueue();return}if(b!=a){if(a<b){newPercentage=a+1}else{newPercentage=a-1}callTick=true}else{newPercentage=a;callTick=false}this._setBgPosition(newPercentage);if(callTick&&!this.options.onTick(this)){return}if(a!=newPercentage){this.timer=setTimeout(function(){this.processQueueEntry(b)}.bind(this),10)}else{this.queue.splice(0,1);this.running=false;this.timer=null;this.processQueue();return}},getPercentage:function(a){return this.percentage},_setBgPosition:function(a){$(this.id+"_percentImage").style.backgroundPosition=(this.initialPos+(a*this.pxPerPercent))+"px 50%";var b=Math.floor((a-1)/(100/this.options.barImage.length));if((b!=this.backIndex)&&(this.options.barImage[b]!=undefined)){$(this.id+"_percentImage").style.backgroundImage="url("+this.options.barImage[b]+")"}this.backIndex=b;$(this.id+"_percentImage").alt=a+"%";$(this.id+"_percentImage").title=a+"%";if(this.options.showText==true){$(this.id+"_percentText").update(""+a+"%")}this.percentage=a}};JS_BRAMUS.jsProgressBarHandler=Class.create();JS_BRAMUS.jsProgressBarHandler.prototype={pbArray:new Array(),initialize:function(){$$("span.progressBar").each(function(a){this.pbArray[a.id]=new JS_BRAMUS.jsProgressBar(a,parseInt(a.innerHTML.replace("%","")))}.bind(this))},setPercentage:function(c,a,b){this.pbArray[c].setPercentage(a,b)},getPercentage:function(a){return this.pbArray[a].getPercentage()}};