/********************************************** Blackbaud Design Custom JavaScript *********************************************** Site: donate.sunnybrook.ca Author: Ben Wong Created: April 2011 BBNC: 6.10 https://donate.sunnybrook.ca/general-donation *********** CHANGE LOG ************************ * 12/09/10 - Includes option to remove newsletters * eCard Donation Form Customization **********************************************/ function givingLevelsCheck(){ /* * Check if the "One-Time" or "Monthly" giving levels are checked. */ if(!window.location.href.match('edit=')){ formID = $("table[id$='tblAmount']").attr("id").split("_")[0]; if(document.getElementById(formID+"_rdoGiftType_1").checked){ //Recurring Gift $("#"+formID+"_tblAmount tr").each(function(i, val){ if(i>2 && i < 7 ){ $(val).hide();} else{ $(val).show();} }); } else{ $("#"+formID+"_tblAmount tr").each(function(i, val){ if(i<3){ $(val).hide();} else{ $(val).show();} }); } } }; function donationTypeCheck(){ if($("input[id$='chkCorporate']:checked").length > 0){ //alert("Corporate!"); $("#corporateRadioButton").attr("checked", "checked"); } else{ $("#individualRadioButton").attr("checked", "checked"); } } function cardTypeCheck(){ /* * If Send a Tribute Card is checked, see which type of card was chosen */ var cardType = location.hash.substring(1); if($("tr[id$=trECardsData]").length > 0){ //Show eCard Section $("#eCardsSection").show(); hideTributeType(); $("#"+cardType+"RadioButton").attr("checked", "checked"); if(cardType=="eCard"){ hideECardTemplates("Paper"); eCardFields(); if(!userLoggedIn()){ tributeSenderInformation();} else{ var eAddress = $("#"+formID+"_DonationCapture1_txtEmail").val(); //if(eAddress != ""){ $("#"+formID+"_gvSenderInfo_ctl02_txtEmail").val(eAddress);} if(eAddress != ""){ $("#"+formID+"_gvSenderInfo_txtEmail_0").val(eAddress);} } } else { hideECardTemplates("eCard"); paperCardFields(); if(!userLoggedIn()){ tributeSenderInformation();} else{ var eAddress = $("#"+formID+"_DonationCapture1_txtEmail").val(); //if(eAddress != ""){ $("#"+formID+"_gvSenderInfo_ctl02_txtEmail").val(eAddress);} if(eAddress != ""){ $("#"+formID+"_gvSenderInfo_txtEmail_0").val(eAddress);} } } //Check tribute type tributeTypeCheck(); relabelTributeNames(); skipToECardsSection(); } else if(cardType=="noCard"){ $("#"+cardType+"RadioButton").attr("checked", "checked"); if($("#honorRadioButton:checked").length > 0 || $("#memoryRadioButton:checked").length > 0) { $("#eCardsSection").show(); //Show Tribute Information noCardFields(); } skipToECardsSection(); } } function skipToECardsSection(){ //check if error messages are shown. If not, then jump to the eCardsSection. var jumpPosition = $("#eCardsSection").offset(); var errorMessage = $("#"+formID+"_ValidationSummary1 ul").length; if(errorMessage == 0){ window.scrollTo(jumpPosition.left, jumpPosition.top); } } function tributeTypeCheck(){ //if a tribute type is selected, check the radio button var tributeType = $("#"+formID+"_ddlTribute option:selected").val(); if(tributeType==126){ $("#honorRadioButton").attr("checked", "checked"); relabelTributeNames(); $("#eCardsSection").show(); } else if(tributeType==125){ $("#memoryRadioButton").attr("checked", "checked"); relabelTributeNames(); $("#eCardsSection").show(); } else if(tributeType==0){ $("#generalRadioButton").attr("checked", "checked"); $("#eCardsSection").hide(); } } function hideECardTemplates(hideCardType){ if($("input[name='cardType']:checked").length > 0){ $("div[id$='ECardTemplates'] table[title~='"+hideCardType+"']").hide(); } } /* * Arrange fields when the eCard option is selected */ function eCardFields(){ $("#"+formID+"_lnkAddRecipient").hide(); //hide multiple recipient fields $("#"+formID+"_lblPrintPreviewHeading").parent().hide(); $("th:contains('Name:')", "#"+formID+"_lblECardRecipientHeading").parent().addClass(); //createRecipientInfoTable(); hideSenderInfo(); // Hide the sender information, this is prepopulated moveTributeFields("#"+formID+"_divSender"); // Move the tribute fields into the eCard section $("#"+formID+"_rbSend").attr("checked", "checked"); // Check the Send radio button $("#"+formID+"_rbPrint").hide(); // Hide the "Do Not Send" input $("#"+formID+"_rbPrint + label").hide(); // Hide the "Do Not Send" label $("#"+formID+"_chkSendCopyToSelf").siblings('label').html('Send me a copy of each email.'); } function createRecipientInfoTable(){ /* Reformat the Name and Email Address fields for the Recipient */ var tableStructure = "<table id='RecipientInformationTable'><tr><td class='BBFieldCaption DonationFieldCaption'><label>Name</label></td><td></td></tr><tr><td class='BBFieldCaption DonationFieldCaption'><label>Email Address</label></td><td class='BBFieldControlCell DonationFieldControlCell'></td></tr></table>"; } function noCardFields(){ //Create row for Tribute Fields $(".loader").hide(); $("#eCardsSection").append("<tr><td id='TributeInformationCell' colspan='2'><a id='noCard' name='noCard'></a></td></tr>"); moveTributeFields("#noCard"); } /* * Arrange fields when the paper card is selected */ function paperCardFields(){ /* * Move address fields from the Tribute section up to the eCard section */ $("div[id$='divRecipients']").prepend("<table id='TributeCardFields'></table>"); var fullNameTr = $("tr[id$='trAcknowledgeeName']"); var firstNameTr = $("#"+formID+"_trAcknowledgeeFirstName"); var lastNameTr = $("#"+formID+"_trAcknowledgeeLastName"); var addressTr = $("#"+formID+"_AddressCtl_lbl_addrline").parent(); var cityTr = $("td[id^='"+formID+"_AddressCtl_lbl_city']").parent(); var postalTr = $("td[id^='"+formID+"_AddressCtl_lbl_zip']").parent(); var provinceTr = $("td[id^='"+formID+"_AddressCtl_lbl_zip']").parent().prev(); var countryTr = $("#"+formID+"_AddressCtl_lbl_country").parent(); $("#TributeCardFields").append(fullNameTr); $("#TributeCardFields").append(firstNameTr); $("#TributeCardFields").append(lastNameTr); $("#TributeCardFields").append(addressTr); $("#TributeCardFields").append(cityTr); $("#TributeCardFields").append(provinceTr); $("#TributeCardFields").append(countryTr); $("#TributeCardFields").append(postalTr); moveTributeFields("#"+formID+"_divSender"); tributeRecipientName(); $("#"+formID+"_rbPrint").attr("checked", "checked"); // Preselect "Do Not Send" $("#"+formID+"_rbPrint").parent().hide(); // Hide Send Options $("#"+formID+"_lblOptionsHeading").parent().hide(); $("#"+formID+"_lblPrintPreviewHeading").parent().hide(); hideSenderInfo(); //Hide Sender Info, this information is prepopulated $("input[id$='txtEmail']", "div[id$='divRecipients']").hide(); //Hide Recipient Email Address $("th:contains('Email Address:')", "div[id$='divRecipients']").parent().hide(); //Relabel Choose eCard Template Relabel("Choose your eCard", "Choose your Paper Card", "span"); //Hide Recipient Name, First Name and Last Name $("input[id$='txtName']", "table[id$='gvRecipientInfo']").parent().parent().parent().hide(); $("#"+formID+"_gvRecipientInfo_ctl02_txtFirstName").parent().parent ().parent().hide(); $("#"+formID+"_gvRecipientInfo_ctl02_txtLastName").parent().parent( ).parent().hide(); //Hide Add another recipient $("#"+formID+"_lnkAddRecipient").hide(); var submitButtonRow = $("#"+formID+"_btnNext").parent().parent(); $(".DonationFooterText").parent().before(submitButtonRow); } function hideSenderInfo(){ $("#"+formID+"_divSender").hide(); $("#"+formID+"_lblECardSenderHeading").parent().hide(); } function hideTributeType(){ $("#"+formID+"_trTributeDesc").hide(); } function moveTributeFields(destination){ var tributeFirstName = $("#"+formID+"_trTributeFirstName"); var tributeLastName = $("#"+formID+"_trTributeLastName"); var tributeType = $("#"+formID+"_trTributeDesc"); var tributeDescription = $("#"+formID+"_trTributeDesc2"); //Create Table to insert tribute fields $(destination).after("<div class='DonationECardSectionSeparator'><span id='TributeInformation_lblECardRecipientHeading'>Tribute information</span></div><div class='DonationECardSectionBody'><table id='TributeeFields'></table></div>"); $("#TributeeFields").append(tributeFirstName); $("#TributeeFields").append(tributeLastName); $("#TributeeFields").append(tributeType); $("#TributeeFields").append(tributeDescription); //tributeName.show(); tributeFirstName.show(); tributeLastName.show(); tributeDescription.show(); } function tributeRecipientName(){ $("#"+formID+"_txtTributeAcknFullName").blur(function(){ var recipientName = $(this).val(); $("input[id$='txtName']", "table[id$='gvRecipientInfo']").val(recipientName); }); } function userLoggedIn(){ var senderName = ""; //if($("#"+formID+"_gvSenderInfo_ctl02_txtName").length > 0){ if($("#"+formID+"_gvSenderInfo_txtLastName_0").length > 0){ //senderName = $("#"+formID+"_gvSenderInfo_ctl02_txtName").val(); senderName = $("#"+formID+"_gvSenderInfo_txtLastName_0").val(); } //else if($("#"+formID+"_gvSenderInfo_ctl02_txtFirstName").length > 0){ else if($("#"+formID+"_gvSenderInfo_txtFirstName_0").length > 0){ senderName = $("#"+formID+"_gvSenderInfo_txtFirstName_0").val(); } if(senderName != "") return true; else return false; } function tributeSenderInformation(){ //Populate the sender's information if user is not logged in var firstName = $("#"+formID+"_DonationCapture1_txtFirstName").val(); var lastName = $("#"+formID+"_DonationCapture1_txtLastName").val(); //$("#"+formID+"_gvSenderInfo_ctl02_txtFirstName").val(firstName); //$("#"+formID+"_gvSenderInfo_ctl02_txtLastName").val(lastName); $("#"+formID+"_gvSenderInfo_txtFirstName_0").val(firstName); $("#"+formID+"_gvSenderInfo_txtLastName_0").val(lastName); //If first name and last name are combined: //if($("#"+formID+"_gvSenderInfo_ctl02_txtName").length > 0){ // $("#"+formID+"_gvSenderInfo_ctl02_txtName").val(firstName+" "+lastName); //} var emailAddress = $("#"+formID+"_DonationCapture1_txtEmail").val(); if(emailAddress != ""){ $("#"+formID+"_gvSenderInfo_txtEmail_0").val(emailAddress);} } function relabelTributeNames(){ if($("#honorRadioButton:checked").length > 0){ Relabel("First name:", "First Name of Honouree:", "#"+formID+"_lblTributeFirstName"); Relabel("Last name:", "Last Name of Honouree:", "#"+formID+"_lblTributeLastName"); } else if($("#memoryRadioButton:checked").length > 0){ Relabel("First name:", "First Name of Deceased", "#"+formID+"_lblTributeFirstName"); Relabel("Last name:", "Last Name of Deceased", "#"+formID+"_lblTributeLastName"); } } function Relabel(_old,_new,_element){ var selector = $(_element+':contains("'+_old+'")'); selector.each(function(){ if ($(this).html() == _old) { // replace text in element var selHTML = $(this).html().replace(_old,_new); $(this).html(selHTML); // replace validation text var thisRow = $(this).parent().parent(); if (thisRow.children('.BBFormRequiredFieldMarker').length > 0) { var span = $(this).parent().next().children('span'); var alertID = span.attr('id'); $('body').append('<script>'+alertID+'.errormessage = "'+_new+' Required";</script>'); } } }); } (function($){ $.fn.CustomDonationForm = function(vars){ /* ******************************************** Plugin Variables ******************************************** */ callerElement = $(this); givingLevelsTBodyId = (vars.givingLevelsTBodyId != undefined) ? vars.givingLevelsTBodyId : $("tbody[id$='TB_pnlDonation']").attr("id"); givingLevelsAmountTableId = (vars.givingLevelsAmountTableId != undefined) ? vars.givingLevelsAmountTableId : $("table[id$='tblAmount']").attr("id"); additionalInformationTrId = (vars.additionalInformationTrId != undefined) ? vars.additionalInformationTrId : $("tr[id$='trAdditInformation']").attr("id"); commentsTrId = (vars.commentsTrId != undefined) ? vars.commentsTrId : $("tr[id$='trComments']").attr("id"); paymentInformationTBodyId = (vars.paymentInformationTBodyId != undefined) ? vars.paymentInformationTBodyId : $("tbody[id$='tbdyPaymentInfo']").attr("id"); giftTypeTrId = (vars.giftTypeTrId != undefined) ? vars.giftTypeTrId : $("tr[id$='trGiftType']").attr("id"); recurrenceTrId = (vars.recurrenceTrId != undefined) ? vars.recurrenceTrId : $("tr[id$='trRecurrence']").attr("id"); givingLevelsTr = $("#"+givingLevelsAmountTableId).parent().parent(); creditCardTr = $("label[id$='lblCCType']").parent().parent(); oneTimeRadioButtonId = (vars.oneTimeRadioButtonId != undefined) ? vars.oneTimeRadioButtonId : $("input[value$='OneTime']").attr("id"); recurringRadioButtonId = (vars.recurringRadioButtonId != undefined) ? vars.recurringRadioButtonId : $("input[value$='Recurring']").attr("id"); corporateTrId = (vars.corporateTrId != undefined) ? vars.corporateTrId : $("tr[id$='trCorporate']").attr("id"); sourceTrId = (vars.sourceTrId != undefined) ? vars.sourceTrId : $("tr[id$='trSource']").attr("id"); newsletterLabelId = (vars.newsletterLabelId != undefined)? vars.newsletterLabelId : $("label[id$='lblLgnCtl566']").attr("id"); hasNewsletter = false; newsletterRow = ""; formID = givingLevelsAmountTableId.split("_")[0]; if(newsletterLabelId != undefined){ hasNewsletter = true; newsletterRow = $("#"+newsletterLabelId).parent().parent(); } eCardCheckbox = ""; if($("#trECardsHeading").length > 0){ eCardCheckbox = $("input[id$='chkSendAnECard']")[0]; } designationTrId = (vars.designationTrId != undefined) ? vars.designationTrId : $("tr[id$='trDesignation']").attr("id"); /************************** | Custom Text Variables ***************************/ donationFooterText = (vars.donationFooterText != undefined) ? vars.donationFooterText : "Your donation will be processed."; radioCaption = (vars.radioButtonCaption != undefined) ? vars.radioButtonCaption : "Donation Type:"; individualLabel = (vars.individualLabel != undefined) ? vars.individualLabel : "Individual"; corporateLabel = (vars.corporateLabel != undefined) ? vars.corporateLabel : "Corporate"; helpLinkText = (vars.helpLinkText != undefined) ? vars.helpLinkText : "Where is my Card Security Code?"; newsletterText = (vars.newsletterText != undefined) ? vars.newsletterText : "Yes, I would like to receive Your Health Matters, Sunnybrook's e-newsletter."; tributeCaption = (vars.tributeCaption != undefined) ? vars.tributeCaption : "I'm making a..."; generalLabel = (vars.generalLabel != undefined) ? vars.generalLabel : "General Donation"; honorLabel = (vars.honorLabel != undefined) ? vars.honorLabel : "Donation In Honour"; memoryLabel = (vars.memoryLabel != undefined) ? vars.memoryLabel : "Donation In Memory"; tributeCardCaption = (vars.tributeCardCaption != undefined) ? vars.tributeCardCaption : "I would like to..."; eCardLabel = (vars.eCardLabel != undefined) ? vars.eCardLabel : "Send an eCard"; paperLabel = (vars.paperLabel != undefined) ? vars.paperLabel : "Mail a Paper Card"; noCardLabel = (vars.noCardLabel != undefined) ? vars.noCardLabel : "Opt out of a card"; donationCaptureTable = callerElement.find("tbody.DonationCaptureFormTable")[0]; numberOfRecurringGivingLevels = (vars.numberOfRecurringGivingLevels != undefined) ? vars.numberOfRecurringGivingLevels : 3; isRecurringGift = new Boolean(); numberOfGivingLevels = $("#"+givingLevelsAmountTableId+" tr").length; //donationTypeSelectList = $("#"+commentsTrId).next().find(".LoginFormSelectList")[0]; individualRadioButton =""; corporateRadioButton=""; radioButtonRow=""; /* ******************************************** Plugin Functions ******************************************** */ /*--------------------------------------------------------------------| Move Functions -----------------------------------------------------------------------*/ //Move Billing Information function moveBillingInformation(){ $(callerElement).prepend(donationCaptureTable); } function moveDonationType(){ var donationTypeRow = $("#"+commentsTrId).next()[0]; $(donationCaptureTable).children("tr:first").after(donationTypeRow) ; $(donationTypeRow).hide(); } function moveCorporate(){ //Move the Corporate check box row var corporateRow = $("#"+corporateTrId)[0]; $(donationCaptureTable).children("tr:first").after(corporateRow); $(corporateRow).hide(); } //Move Comments function moveComments(){ var commentsRow = $("#"+commentsTrId)[0]; $(donationCaptureTable).append(commentsRow); } function moveNewsletterOption(){ $(donationCaptureTable).append(newsletterRow); } function moveSource(){ var sourceRow = $("#"+sourceTrId)[0]; $(donationCaptureTable).append(sourceRow); } function moveRecurringGifts(){ var giftTypeRow = $("#"+giftTypeTrId)[0]; var recurrenceRow = $("#"+recurrenceTrId)[0]; $("#"+givingLevelsTBodyId).prepend(recurrenceRow).prepend(giftTypeR ow); } function movePaymentInformation(){ var paymentInfo = $("#"+paymentInformationTBodyId)[0]; $("#"+givingLevelsTBodyId).after(paymentInfo); } function moveDesignation(){ var designationTBody = $("#"+designationTrId).parent(); $("#"+givingLevelsTBodyId).after(designationTBody); } function moveCountryRow(){ var countryRow = $("#"+formID+"_DonationCapture1_AddressCtl_lblCountry").parent().parent() ; var provRow = $("label[id$='lblPhone']").parent().parent().prev(); $(countryRow).insertBefore(provRow); } function moveCreditCardRow(){ var cardNameRow = $("label[id$='lblCardHoldersName']").parent().parent(); $(creditCardTr).insertBefore(cardNameRow); } function moveValidationMessage(){ var validationRow = $("div.DonationValidationSummary").parent().parent(); $(donationCaptureTable).prepend(validationRow); } function moveTributeHeading(){ $("span[id$='lblTributeHeading']").html("Donation Type"); var tributeHeadingTr = $("span[id$='lblTributeHeading']").parent().parent(); var validationRow = $("div.DonationValidationSummary").parent().parent(); $(validationRow).after(tributeHeadingTr); } function moveECardsHeading(){ /* * Move the eCard section below the donation capture table */ $("label[for$='chkSendAnECard']").html("Send a Card"); var eCardHeadingTr = $("#trECardsHeading")[0]; $(donationCaptureTable).after("<tbody id='eCardsSection' />"); $("#eCardsSection").append(eCardHeadingTr); } function moveECardsSection(){ var eCardSection = $("tr[id$=trECardsData]")[0]; $("#eCardsSection").append(eCardSection); } /*--------------------------------------------------------------------| Hide Functions -----------------------------------------------------------------------*/ function hidePaymentInformationHeader(){ $("#"+paymentInformationTBodyId+" tr:first").hide(); } function hideAdditionalInformationHeader(){ $("#"+additionalInformationTrId).hide(); } function hideGivingLevels(){ givingLevelsTr.hide(); //uncheck radio buttons $("#"+oneTimeRadioButtonId).removeAttr("checked"); $("#"+recurringRadioButtonId).removeAttr("checked"); } function hideNewsletterElements(){ $(newsletterRow).find("td.taLeft").css("padding-bottom", "15px"); var noTrRow = $(newsletterRow).find("tr")[1]; $(noTrRow).hide(); $("#"+newsletterLabelId).hide(); } function hideTributeCardCheckBox(){ $(eCardCheckbox).hide(); } function hideTributeSection(){ $("#"+formID+"_trTributeName").hide(); $("#"+formID+"_trTributeFirstName").hide(); $("#"+formID+"_trTributeLastName").hide(); $("#"+formID+"_trTributeDesc").hide(); $("#"+formID+"_trTributeDesc2").hide(); } function hideMailSection(){ $("#"+formID+"_chkAcknowledge").parent().parent().parent().hide(); $("#"+formID+"_lblPhoneCaption").parent().parent().hide(); $("#"+formID+"_txtTributeAcknEmail").parent().parent().parent().hid e(); } /*--------------------------------------------------------------------| Create/Modify Functions -----------------------------------------------------------------------*/ function addFooterText(){ var footerHTML = "<tbody><tr><td class='DonationFooterText' colSpan='3'>"+donationFooterText+"<br /><span class='DonationFooterSubText'>You only need to click Submit Donation once.</span></td></tr></tbody>"; $(callerElement).append(footerHTML); } function changeSecurityCodeHelpLink(){ var helpLink = $("a[id$='lnkcsc_help']"); helpLink.css("padding-left", "6px"); helpLink.html(helpLinkText); } function expiryDateMonthYear(){ $("select[id$='cboMonth'] option:first").html("Month"); $("select[id$='cboYear'] option:first").html("Year"); } function newsletterSignUpText(){ //hide the label var yesLabel = $(newsletterRow).find(".LoginFormCheckList label")[0]; $(yesLabel).html(newsletterText); } function createEcardJumpLinks(){ $(donationCaptureTable).after("<tbody><tr><td colspan='3'><a id='eCard' name='eCard'></a><a id='paper' name='paper'></a><a id='noCard' name='noCard'></a></td></tr></tbody>"); } function createRadioButtons(theCaption, indLabel, corpLabel){ individualRadioButton = "<div class='radioButton'><input id='individualRadioButton' type='radio' name='donationType' value='individualGift' /><label for='individualRadioButton'>"+indLabel+"</label></div>"; corporateRadioButton = "<div class='radioButton'><input id='corporateRadioButton' type='radio' name='donationType' value='corporateGift' /><label for='corporateRadioButton'>"+corpLabel+"</label></div>"; radioButtonRow = "<tr><td class='BBFieldCaption DonationFieldCaption' style='vertical-align: top; padding-top: 3px;'><label>"+theCaption+"</label></td><td class='BBFieldControlCell DonationFieldControlCell'>"+corporateRadioButton+individualRadioButton+"< /td></tr>"; $(donationCaptureTable).children("tr:first").after(radioButtonRow); $("#corporateRadioButton").click(function(){ $("#individualRadioButton").removeAttr("checked"); $("input[id$='chkCorporate']").attr("checked", "checked"); //$("option[value='Individual']").removeAttr("selected"); //$("option[value='Corporate']").attr("selected", "selected"); setTimeout("__doPostBack(\'"+formID+"$chkCorporate\',\'\')", 0); }); $("#individualRadioButton").click(function(){ //$("#corporateRadioButton").removeAttr("checked"); $("input[id$='chkCorporate']").removeAttr("checked"); //$("option[value='Corporate']").removeAttr("selected"); //$("option[value='Individual']").attr("selected", "selected"); setTimeout("__doPostBack(\'"+formID+"$chkCorporate\',\'\')", 0); }); } function createTributeRadioButtons(theCaption, generalLabel, honorLabel, memoryLabel){ var generalRadioButton = "<div class='radioButton'><input id='generalRadioButton' checked='checked' type='radio' name='tributeType' value='generalGift' /><label for='generalRadioButton'>"+generalLabel+"</label></div>"; var honorRadioButton = "<div class='radioButton'><input id='honorRadioButton' type='radio' name='tributeType' value='honorGift' /><label for='honorRadioButton'>"+honorLabel+"</label></div>"; var memoryRadioButton = "<div class='radioButton'><input id='memoryRadioButton' type='radio' name='tributeType' value='memoryGift' /><label for='memoryRadioButton'>"+memoryLabel+"</label></div>"; var tributeRadioButtonRow = "<tr><td class='BBFieldCaption DonationFieldCaption' style='vertical-align: top; padding-top: 3px;'><label>"+theCaption+"</label></td><td class='BBFieldControlCell DonationFieldControlCell'>"+generalRadioButton+honorRadioButton+memoryRad ioButton+"</td></tr>"; var tributeHeadingTr = $("span[id$='lblTributeHeading']").parent().parent(); $(tributeHeadingTr).after(tributeRadioButtonRow); $("#generalRadioButton").click(function(){ $("#eCardsSection").hide(); $("#"+formID+"_ddlTribute option").removeAttr("selected"); if($("#"+formID+"_chkSendAnECard:checked").length > 0){ $("#"+formID+"_chkSendAnECard").removeAttr("checked"); setTimeout("__doPostBack(\'"+formID+"$chkSendAnECard\',\'\')", 0) } }); $("#honorRadioButton").click(function(){ $("#eCardsSection").show(); //Check the Tribute Type box $("#"+formID+"_ddlTribute option[value='126']").attr("selected", "selected"); if($("#"+formID+"_trECardsData:visible") || $("#TributeInformationCell:visible")){ Relabel("First Name of Deceased:", "First Name of Honouree:", "#"+formID+"_lblTributeFirstName"); Relabel("Last Name of Deceased:", "Last Name of Honouree:", "#"+formID+"_lblTributeLastName"); } }); $("#memoryRadioButton").click(function(){ $("#eCardsSection").show(); $("#"+formID+"_ddlTribute option[value='125']").attr("selected", "selected"); if($("#"+formID+"_trECardsData:visible") || $("#TributeInformationCell:visible")){ Relabel("First Name of Honouree:","First Name of Deceased:", "#"+formID+"_lblTributeFirstName"); Relabel("Last Name of Honouree:", "Last Name of Deceased:", "#"+formID+"_lblTributeLastName"); } }); } function createCardRadioButtons(theCaption, eCardLabel, paperLabel){ var eCardRadioButton = "<div class='radioButton'><input id='eCardRadioButton' type='radio' name='cardType' value='eCard' /><label for='eCardRadioButton'>"+eCardLabel+"</label></div>"; var paperRadioButton = "<div class='radioButton'><input id='paperRadioButton' type='radio' name='cardType' value='Paper' /><label for='paperRadioButton'>"+paperLabel+"</label></div>"; var noCardRadioButton = "<div class='radioButton'><input id='noCardRadioButton' type='radio' name='cardType' value='noCard' /><label for='noCardRadioButton'>"+noCardLabel+"</label></div>"; var cardRadioButtonRow = "<tr><td class='BBFieldCaption DonationFieldCaption' style='vertical-align: top; padding-top: 3px;'><label>"+theCaption+"</label></td><td class='BBFieldControlCell DonationFieldControlCell'>"+eCardRadioButton+paperRadioButton+noCardRadio Button+"</td></tr>"; $("#trECardsHeading").after(cardRadioButtonRow); $("#eCardRadioButton").click(function(){ //Show loader view.image?id=1301 if($(".loaderBar").length == 0) $("#noCardRadioButton").parent().after("<div class='loaderBar' style='padding-top:20px;'><img src='view.image?id=1301' /></div>"); $(eCardCheckbox).attr("checked", "checked"); if (!location.hash.substring(1)) window.location.href = window.location.href + '#eCard'; else window.location.href = window.location.href.replace(/#(.*?)$/,'#eCard'); //Uncheck Mail a Letter $("input[id$='chkAcknowledge']").removeAttr("checked"); setTimeout("__doPostBack(\'"+formID+"$chkSendAnECard\',\'\')", 0) }); $("#paperRadioButton").click(function(){ $(eCardCheckbox).attr("checked", "checked"); if($(".loaderBar").length == 0) $("#noCardRadioButton").parent().after("<div class='loaderBar' style='padding-top:20px;'><img src='view.image?id=1301' /></div>"); if (!location.hash.substring(1)) window.location.href = window.location.href + '#paper'; else window.location.href = window.location.href.replace(/#(.*?)$/,'#paper'); //Check Mail a Letter on my behalf $("input[id$='chkAcknowledge']").attr("checked", "checked"); setTimeout("__doPostBack(\'"+formID+"$chkSendAnECard\',\'\')", 0) }); $("#noCardRadioButton").click(function(){ $(eCardCheckbox).removeAttr("checked"); if($(".loaderBar").length == 0) $("#noCardRadioButton").parent().after("<div class='loaderBar' style='padding-top:20px;'><img src='view.image?id=1301' /></div>"); if (!location.hash.substring(1)){ window.location.href = window.location.href + '#noCard'; noCardFields(); } else{ window.location.href = window.location.href.replace(/#(.*?)$/,'#noCard'); setTimeout("__doPostBack(\'"+formID+"$chkSendAnECard\',\'\')", 0); } }); } function donateSubmitLoader(){ $("#"+formID+"_btnNext").click(function(){ if($(".loaderBar").length == 0) $("#"+formID+"_btnNext").after("<div class='loaderBar' style='paddingtop:20px;'><img src='view.image?id=1301' /></div>"); }); } /*--------------------------------------------------------------------| Events -----------------------------------------------------------------------*/ $("#"+recurringRadioButtonId).click(function(){ if(!isRecurringGift) isRecurringGift = true; givingLevelsTr.show(); }); $("#"+oneTimeRadioButtonId).click(function(){ if(isRecurringGift) isRecurringGift = false; givingLevelsTr.show(); }); function updateGivingLevels(){ if(isRecurringGift){ //Recurring Gift $("#"+givingLevelsAmountTableId+" tr").each(function(i, val){ if(i>(numberOfRecurringGivingLevels 1) && i < (numberOfGivingLevels - 2) ){ $(val).hide();} else{ $(val).show();} }); } else{ $("#"+givingLevelsAmountTableId+" tr").each(function(i, val){ if(i<numberOfRecurringGivingLevels){ $(val).hide();} else{ $(val).show();} }); } } function init(){ moveBillingInformation(); createRadioButtons(radioCaption, individualLabel, corporateLabel); /*moveDonationType();*/ moveCorporate(); moveComments(); moveValidationMessage(); if(hasNewsletter){ moveNewsletterOption(); newsletterSignUpText(); hideNewsletterElements(); } /* Check if Tributes have been enabled */ if($("span[id$='lblTributeHeading']").length > 0){ moveTributeHeading(); } createTributeRadioButtons(tributeCaption, generalLabel, honorLabel, memoryLabel); moveECardsHeading(); moveECardsSection(); createCardRadioButtons(tributeCardCaption, eCardLabel, paperLabel); hideTributeCardCheckBox(); hideTributeSection(); hideMailSection(); moveCountryRow(); moveRecurringGifts(); movePaymentInformation(); moveCreditCardRow(); changeSecurityCodeHelpLink(); hidePaymentInformationHeader(); hideAdditionalInformationHeader(); expiryDateMonthYear() //moveDesignation(); //moveSource(); addFooterText(); //createEcardJumpLinks(); if($("#"+recurringRadioButtonId).attr("checked")== "checked"){ isRecurringGift = true;} else{ isRecurringGift = false;} updateGivingLevels(); $(callerElement).show(); donateSubmitLoader(); } init(); //hideGivingLevels(); return this; }// end Plugin })(jQuery);