var curPage=1,donationListLoaded=false,charityListLoaded=false,listWriter=new GivingPageListWriterStrategy();function init(){}function changeTab(c){var a=new Array(3);a[0]=c=="1"?"on":"off";a[1]=c=="2"?"on":"off";a[2]=c=="3"?"on":"off";for(var b=1;b<3;b++){document.getElementById("img"+b+"_l").src="/images/tab"+a[b-1]+"left.gif";document.getElementById("tab"+b+"_c").className="tab"+a[b-1];document.getElementById("img"+b+"_r").src="/images/tab"+a[b-1]+"right.gif"}document.getElementById("divContentPage"+curPage).style.display="none";document.getElementById("divContentPage"+c).style.display="block";curPage=c}function unload(){donListPre=null}function setProgIndicator(a){if(!document.getElementById("thermometerFull")){return}if(a!=0){var b=$("#thermometerEmpty").width();a=Math.round((a*0.01*b));$("#thermometerFull").animate({width:a.toString()},{duration:2000,queue:true,easing:"swing"})}}function getAmountRaisedPercent(){var c,b,a;c=$("#spanGoalAmount").text();b=$("#spanAmountRaised").text();c=jQuery.trim(c);b=jQuery.trim(b);if(c==null||b==null||c=="$"||b=="$"){a=0}else{c=parseInt(c,10);b=parseInt(b,10);a=((b/c)*100);a=(a>100)?100:a}setProgIndicator(a)}function getCharities(){var a=[];if(charityListLoaded==true){return}a.push("gpID="+$("#hidPageID").val());a.push("languageID="+language);jQueryCallWrapperREST("/GivingPages/GivingPage.aspx/getCharityList",a,getCharities_Success,getCharities_Error,null)}function getCharities_Success(b,a){if(b==null||b==""){alert("Could not retrieve list of charities")}listWriter.outputCharityList(b.d,false)}function getCharities_Error(a){alert(a.responseText)}function getDonations(){var a=[];if(donationListLoaded==true){changeTab("2");return}a.push("gpID="+$("#hidPageID").val());a.push("displayDonations="+$("#hidDisplayDonations").val());a.push("languageID="+language);jQueryCallWrapperREST("/GivingPages/GivingPage.aspx/getDonationDetails",a,getDonations_Success,getDonations_Error,null)}function getDonations_Success(b,a){if(b==null||b==""){alert("Could not retrieve list of donations")}listWriter.outputDonationList(b.d)}function getDonations_Error(a){alert(a.responseText)}function doDonate(b,a){var c="/GivingPages/GivingPageDonate.aspx?cID="+b+"&gpID="+a;window.location.href=c}function showCPDialog(){var a=$("#divCharityInfo");a.dialog({bgiframe:true,height:215,width:380,modal:true,autoOpen:false,close:function(b,c){}});a.dialog("open")}function convertPMLinks(){var c=new RegExp("(?:(?:https?|ftp|file)://|www.|ftp.)[-A-Z0-9+&@#/%=~_|$?!:,.]*[A-Z0-9+&@#/%=~_|$amp;]*","gim"),b=new RegExp("https?://","gi"),e,d,a;e=$("#personalMessage").html();d=e.match(c);if(d==null||d.length==0){return}for(a=0;a<d.length;a++){e=e.replace(d[a],'<a href="http://'+d[a].replace(b,"")+'" target="_blank">'+d[a]+"</a>")}$("#personalMessage").html(e)}function isAdminAccessed(){if("1"==$("#hidAdminAccessed").val()){return true}return false}function Ajax_Error(a){alert(a.responseText)}function drClick(){$(".active-selected").addClass("highlight-selected").removeClass("active-selected");$(".highlight-donated").addClass("active-donated").removeClass("highlight-donated")}function scClick(){$(".active-donated").addClass("highlight-donated").removeClass("active-donated");$(".highlight-selected").addClass("active-selected").removeClass("highlight-selected")}$(document).ready(function(){getCharities();setTimeout(getAmountRaisedPercent,500);convertPMLinks()});
