(function(n){n.en={};n.fn.enCounter=function(t){var i=n.extend({title:"",dataUrl:"",initialValue:5,campaignValue:-1,goalValue:100,incrementValue:20,digits:5,copyText:"",containerStyles:{},titleStyles:{},trayStyles:{},valueStyles:{},copyStyles:{}},t||{}),r=n(this);return i.dataUrl==""?r:(i.id=r.attr("id"),n.ajax({url:i.dataUrl,dataType:"jsonp",success:function(t){var u,f;if(i.campaignValue=0,!("error"in t)&&t.rows.length>0)for(u=t.rows.length;u--;)for(f=t.rows[u].columns.length;f--;)t.rows[u].columns[f].name=="participations"&&(i.campaignValue+=parseInt(t.rows[u].columns[f].value));r.each(function(t,r){n.en.renderCounter(r,i)})}}),r)};n.en.renderCounter=function(t,r){var e,u,o,f;if(r=n.en.setProgressValues(r),e=String(r.value),e.length==0)return this;for(e="        "+e,e=e.slice(-1*r.digits),u="",o="",r.id!="undefined"&&(o="#"+r.id+" "),u+='<style type="text/css">\n',u+=o+".en-widget {\n",n.each(r.containerStyles,function(n,t){u+=n+": "+t+";\n"}),u+="}\n",u+=o+".en-widget .en-title {\n",n.each(r.titleStyles,function(n,t){u+=n+": "+t+";\n"}),u+="}\n",u+=o+".en-widget .en-counter .en-counter-digit-tray {\n",n.each(r.trayStyles,function(n,t){u+=n+": "+t+";\n"}),u+="}\n",u+=o+".en-widget .en-counter .en-counter-digit-value {\n",n.each(r.valueStyles,function(n,t){u+=n+": "+t+";\n"}),("color"in r.valueStyles)||("background-color"in r.containerStyles)&&(u+="color: "+r.containerStyles["background-color"]+";\n"),("background-color"in r.valueStyles)||("color"in r.titleStyles)&&(u+="background-color: "+r.titleStyles.color+";\n"),u+="}\n",u+=o+".en-widget .en-copy {\n",n.each(r.copyStyles,function(n,t){u+=n+": "+t+";\n"}),u+="}\n",u+="<\/style>\n",n("head").append(u),f="",f+='<div class="en-widget round">',f+='<div class="en-clear"><\/div>',r.title!=""&&(f+='<p class="en-title">'+r.title+"<\/p>"),f+='<div class="en-counter">',i=0;i<e.length;i++)f+=e[i]==" "?'<div class="en-counter-digit-tray en-corner-all">&nbsp;<\/div>':'<div class="en-counter-digit-value en-corner-all">'+e[i]+"<\/div>";f+='<div class="en-clear"><\/div>';f+="<\/div>";r.copyTextValue!=""&&(f+='<p class="en-copy">'+r.copyTextValue+"<\/p>");f+="<\/div><!--en-widget-->";n(t).html(f)};n.fn.enProgressbar=function(t){var i=n.extend({title:"",dataUrl:"",initialValue:5,campaignValue:-1,goalValue:100,incrementValue:20,label:"percent",copyText:"",containerStyles:{},titleStyles:{},trayStyles:{},valueStyles:{},copyStyles:{}},t||{}),r=n(this);return i.dataUrl==""?r:(i.id=r.attr("id"),n.ajax({url:i.dataUrl,dataType:"jsonp",success:function(t){var u,f;if(i.campaignValue=0,!("error"in t)&&t.rows.length>0)for(u=t.rows.length;u--;)for(f=t.rows[u].columns.length;f--;)t.rows[u].columns[f].name=="participations"&&(i.campaignValue+=parseInt(t.rows[u].columns[f].value));r.each(function(t,r){n.en.renderProgressbar(r,i)})}}),r)};n.en.renderProgressbar=function(t,i){var r,f,u;i=n.en.setProgressValues(i);r="";f="";i.id!="undefined"&&(f="#"+i.id+" ");r+='<style type="text/css">\n';r+=f+".en-widget {\n";n.each(i.containerStyles,function(n,t){r+=n+": "+t+";\n"});r+="}\n";r+=f+".en-widget .en-title {\n";n.each(i.titleStyles,function(n,t){r+=n+": "+t+";\n"});r+="}\n";r+=f+".en-widget .en-progressbar .en-progressbar-tray {\n";n.each(i.trayStyles,function(n,t){r+=n+": "+t+";\n"});r+="}\n";r+=f+".en-widget .en-progressbar .en-progressbar-value {\n";n.each(i.valueStyles,function(n,t){r+=n+": "+t+";\n"});"color"in i.valueStyles||"background-color"in i.containerStyles&&(r+="color: "+i.containerStyles["background-color"]+";\n");"background-color"in i.valueStyles||"color"in i.titleStyles&&(r+="background-color: "+i.titleStyles.color+";\n");r+="}\n";r+=f+".en-widget .en-copy {\n";n.each(i.copyStyles,function(n,t){r+=n+": "+t+";\n"});r+="}\n";r+="<\/style>\n";n("head").append(r);i.nInitialPercent=i.percentComplete>15?15:i.percentComplete;u="";u+='<div class="en-widget round">';u+='<div class="en-clear"><\/div>';i.title!=""&&(u+='<p class="en-title">'+i.title+"<\/p>");u+='<div class="en-progressbar">';u+='<div class="en-progressbar-tray en-corner-all">';u+='<div class="en-progressbar-value en-corner-left" style="width: '+i.nInitialPercent+'%; text-align: right;">'+i.displayValue+"<\/div>";u+="<\/div><!--en-progressbar-tray-->";u+="<\/div><!--en-progressbar-->";i.copyTextValue!=""&&(u+='<p class="en-copy">'+i.copyTextValue+"<\/p>");u+="<\/div><!--en-widget-->";n(t).html(u);n(t).find(".en-progressbar-value").animate({width:i.percentComplete+"%"},{duration:1e3})};n.fn.enThermometer=function(t){var i=n.extend({title:"",dataUrl:"",initialValue:5,campaignValue:-1,goalValue:100,incrementValue:20,size:"large",color:"blue",label:"percent",metric:"totalNumberOfDonations",currency:"USD",labelGoal:"our goal",labelValue:"raised so far",copyText:"",containerStyles:{},titleStyles:{},copyStyles:{}},t||{}),r=n(this);if(i.dataUrl=="")return r;i.id=r.attr("id");switch(i.size){case"small":i.thermClass="en-therm146 en-"+i.color;i.height=135;break;case"large":i.thermClass="en-therm308 en-"+i.color;i.height=254;break;default:return r}return n.ajax({url:i.dataUrl,dataType:"jsonp",success:function(t){var u,e,f;if(i.campaignValue=0,!("error"in t)&&t.rows.length>0)for(u=t.rows.length;u--;){for(f={currency:"",totalAmountDonated:0,totalNumberOfDonations:0},e=t.rows[u].columns.length;e--;)f[t.rows[u].columns[e].name]=t.rows[u].columns[e].value;switch(i.metric){case"totalAmountDonated":f.currency==i.currency&&(i.campaignValue+=parseInt(f.totalAmountDonated));break;case"totalNumberOfDonations":i.campaignValue+=parseInt(f.totalNumberOfDonations)}}r.each(function(t,r){n.en.renderThermometer(r,i)})}}),r};n.en.renderThermometer=function(t,i){var u,f,r;i=n.en.setProgressValues(i);u="";f="";i.id!="undefined"&&(f="#"+i.id+" ");u+='<style type="text/css">\n';u+=f+".en-widget {\n";n.each(i.containerStyles,function(n,t){u+=n+": "+t+";\n"});u+="}\n";u+=f+".en-widget .en-title {\n";n.each(i.titleStyles,function(n,t){u+=n+": "+t+";\n"});u+="}\n";u+=f+".en-widget .en-copy {\n";n.each(i.copyStyles,function(n,t){u+=n+": "+t+";\n"});u+="}\n";u+="<\/style>\n";n("head").append(u);i.nInitialPercent=0;i.nInitialHeight=Math.floor(i.height-i.nInitialPercent*i.height/100);i.nFinalHeight=2+Math.floor(i.height-i.percentComplete*i.height/100);i.metric=="totalAmountDonated"&&(i.currencyCode=n.en.getCurrencyCode(i.currency),i.newGoalValue='<span class="en-currency">'+i.currencyCode+"<\/span>"+i.newGoalValue,i.label=="value"&&(i.displayValue='<span class="en-currency">'+i.currencyCode+"<\/span>"+i.displayValue));r="";r+='<div class="en-widget round">';r+='<div class="en-clear"><\/div>';i.title!=""&&(r+='<div class="en-title">'+i.title+"<\/div>");r+='<div class="'+i.thermClass+'">';r+='<div class="en-thermometer-full"><\/div>';r+='<div class="en-thermometer-empty" style="'+i.nInitialHeight+'px;"><\/div>';r+='<div class="en-thermometer-callout-goal">'+i.newGoalValue+"<\/div>";r+='<div class="en-thermometer-callout-goal-label">'+i.labelGoal+"<\/div>";r+='<div class="en-thermometer-callout-value">'+i.displayValue+"<\/div>";r+='<div class="en-thermometer-callout-value-label">'+i.labelValue+"<\/div>";r+="<\/div><!--en-thermometer-->";i.copyTextValue!=""&&(r+='<p class="en-copy">'+i.copyTextValue+"<\/p>");r+='<div class="en-clear"><\/div>';r+="<\/div><!--en-widget-->";n(t).html(r);n(t).supersleight({imgs:!1,backgrounds:!0,shim:"supersleight-shim.gif",apply_positioning:!1});n(t).find(".en-thermometer-empty").css("height",i.nInitialHeight+"px").animate({height:i.nFinalHeight+"px"},{duration:2e3})};n.fn.enRollCall=function(t){var i=n.extend({title:"",dataUrl:"",rows:5,showAmount:!0,showComments:!0,showTarget:!0,copyText:"",errorMsg:"Name, Location",containerStyles:{},titleStyles:{},rowStyles:{},copyStyles:{}},t||{}),r=n(this);return i.dataUrl==""?r:(i.id=r.attr("id"),n.ajax({url:i.dataUrl,dataType:"jsonp",success:function(t){n.en.rollCallSetRows(i,t);r.each(function(t,r){n.en.renderRollCall(r,i)})}}),r)};n.en.renderRollCall=function(t,i){var r="",f="",u,e,o;for(i.id!="undefined"&&(f="#"+i.id+" "),r+='<style type="text/css">\n',r+=f+".en-widget {\n",n.each(i.containerStyles,function(n,t){r+=n+": "+t+";\n"}),r+="}\n",r+=f+".en-widget .en-title {\n",n.each(i.titleStyles,function(n,t){r+=n+": "+t+";\n"}),r+="}\n",r+=f+".en-widget .en-rollcall .en-rollcall-row {\n",n.each(i.rowStyles,function(n,t){r+=n+": "+t+";\n"}),r+="}\n",r+=f+".en-widget .en-copy {\n",n.each(i.copyStyles,function(n,t){r+=n+": "+t+";\n"}),r+="}\n",r+="<\/style>\n",n("head").append(r),u="",u+='<div class="en-widget round">',u+='<div class="en-clear"><\/div>',i.title!=""&&(u+='<div class="en-title">'+i.title+"<\/div>"),u+='<div class="en-rollcall"><\/div><!--en-rollcall-->',i.copyText!=""&&(u+='<p class="en-copy">'+i.copyText+"<\/p>"),u+='<div class="en-clear"><\/div>',u+="<\/div><!--en-widget-->",n(t).html(u),e=0,o=Math.min(n.en.rollCallRows[i.id].length,i.rows);e<o;)n(t).find(".en-rollcall").prepend(n.en.rollCallRows[i.id][e]),e++;u+="";n(t).supersleight({imgs:!1,backgrounds:!0,shim:"supersleight-shim.gif",apply_positioning:!1});n(t).find(".en-rollcall-row").fadeIn();n.en.rollCallRows[i.id].length>i.rows&&setTimeout('$j.en.rollCallShift("'+i.id+'",'+e+");",2e3)};n.en.rollCallRows={};n.en.rollCallSetRows=function(t,r){if(n.en.rollCallRows[t.id]=[],"error"in r){n.en.rollCallRows[t.id][0]='<div class="en-rollcall-row" style="display: none;">'+t.errorMsg+"<\/div><!--"+r.error+"-->";return}if(r.rows.length==0){n.en.rollCallRows[t.id][0]='<div class="en-rollcall-row" style="display: none;">'+t.errorMsg+"<\/div>";return}for(i=r.rows.length;i--;){for(aRow={firstName:"",city:"",country:"",currency:"",amount:0,targetFName:"",targetLName:"",targetOrg:"",comments:""},j=r.rows[i].columns.length;j--;)aRow[r.rows[i].columns[j].name]=r.rows[i].columns[j].value;aRow2=[];aRow.firstName!=""&&aRow2.push('<span class="en-rollcall-name">'+aRow.firstName+"<\/span>");aRow.city!=""&&aRow2.push(aRow.city);aRow.country!=""&&aRow2.push(aRow.country);t.showAmount&&aRow.amount!=0&&(aRow.currency==""?aRow2.push(aRow.amount):(aRow.currency.toUpperCase(),sTemp=n.en.getCurrencyCode(aRow.currency),sTemp==aRow.currency?aRow2.push(aRow.amount+' <span class="en-currency">'+sTemp+"<\/span>"):aRow2.push('<span class="en-currency">'+sTemp+"<\/span> "+aRow.amount)));n.en.rollCallRows[t.id][i]='<div class="en-rollcall-row" style="display: none;">';n.en.rollCallRows[t.id][i]+=aRow2.join(", ");t.showComments&&aRow.comments!=""&&(n.en.rollCallRows[t.id][i]+='<br /><span class="en-comments">'+aRow.comments+"<\/span>");t.showTarget&&aRow.targetFName!=""&&(sTemp=aRow.targetFName,aRow.targetLName!=""&&(sTemp+=" "+aRow.targetLName),aRow.targetOrg!=""&&(sTemp+=", "+aRow.targetOrg),n.en.rollCallRows[t.id][i]+='<br /><span class="en-target">&gt; '+sTemp+"<\/span>");n.en.rollCallRows[t.id][i]+="<\/div><!--en-rollcall-row-->"}};n.en.rollCallShift=function(t,i){var r=2e3+Math.floor(Math.random()*8e3);i<n.en.rollCallRows[t].length&&(n("#"+t).find(".en-rollcall-row").last().fadeOut(500,function(){n(this).remove();n("#"+t).find(".en-rollcall").prepend(n.en.rollCallRows[t][i]);n("#"+t).find(".en-rollcall-row").first().fadeIn(500,function(){n("#"+t).supersleight({imgs:!1,backgrounds:!0,shim:"supersleight-shim.gif",apply_positioning:!1})})}),setTimeout('$j.en.rollCallShift("'+t+'",'+(i+1)+");",r))};n.en.currencyCodes={ALL:"Lek",AFN:"؋",ARS:"$j",AUD:"$j",BSD:"$j",BBD:"$j",BMD:"$j",BND:"$j",CAD:"$j",KYD:"$j",CLP:"$j",COP:"$j",XCD:"$j",SVC:"$j",FJD:"$j",GYD:"$j",HKD:"$j",LRD:"$j",MXN:"$j",NAD:"$j",NZD:"$j",SGD:"$j",SBD:"$j",SRD:"$j",TVD:"$j",USD:"$j",AWG:"ƒ",AZN:"ман",BYR:"p.",BZD:"BZ$j",BOB:"$jb",BAM:"KM",BWP:"P",BGN:"лв",BRL:"R$j",KHR:"៛",CNY:"¥",CRC:"₡",HRK:"kn",CUP:"₱",CZK:"Kč",DKK:"kr",DOP:"RD$j",EGP:"£",FKP:"£",GBP:"£",GIP:"£",GGP:"£",IMP:"£",JEP:"£",LBP:"£",SHP:"£",SYP:"£",EEK:"kr",EUR:"€",GHC:"¢",GTQ:"Q",HNL:"L",HUF:"Ft",ISK:"kr",INR:"&#x20B9;",IDR:"Rp",IRR:"﷼",ILS:"₪",JMD:"J$j",JPY:"¥",KZT:"лв",KPW:"₩",KRW:"₩",KGS:"лв",LAK:"₭",LVL:"Ls",LTL:"Lt",MKD:"ден",MYR:"RM",MUR:"₨",MNT:"₮",MZN:"MT",NPR:"₨",ANG:"ƒ",NIO:"C$j",NGN:"₦",KPW:"₩",NOK:"kr",OMR:"﷼",PKR:"₨",PAB:"B/.",PYG:"Gs",PEN:"S/.",PHP:"₱",PLN:"zł",QAR:"﷼",RON:"lei",RUB:"руб",SAR:"﷼",RSD:"Дин.",SCR:"₨",SOS:"S",ZAR:"R",KRW:"₩",LKR:"₨",SEK:"kr",CHF:"CHF",TWD:"NT$j",THB:"฿",TTD:"TT$j",TRY:"₤",TRL:"₤",UAH:"₴",UYU:"$jU",UZS:"лв",VEF:"Bs",VND:"₫",YER:"﷼",ZWD:"Z$j"};n.en.getCurrencyCode=function(t){return(t=t.toUpperCase(),n.en.currencyCodes[t])?n.en.currencyCodes[t]:t};n.en.setProgressValues=function(n){n.value=n.initialValue+n.campaignValue;n.newGoalValue=n.goalValue;n.incrementValue!=0&&n.value>n.goalValue&&(n.overflow=n.value-n.goalValue,n.newGoalValue=n.goalValue+n.incrementValue*Math.ceil(n.overflow/n.incrementValue));n.percentComplete=Math.ceil(100*n.value/n.newGoalValue);n.remainder=n.newGoalValue-n.value;n.copyTextValue=n.copyText;n.copyTextValue=n.copyTextValue.replace("{count}",n.value);n.copyTextValue=n.copyTextValue.replace("{goal}",n.newGoalValue);n.copyTextValue=n.copyTextValue.replace("{percent}",n.percentComplete);n.copyTextValue=n.copyTextValue.replace("{remainder}",n.remainder);switch(n.label){case"percent":n.displayValue=n.percentComplete+"%";break;case"value":n.displayValue=n.value;break;default:n.displayValue="&nbsp;"}return n}})(jQuery)