//live mode or dev mode
if (window.location.href.indexOf("dynamic_donation_dev_2") > -1) {
var live = false;
}else{
var live = true;
}
//mail-in option
var mailInOption = 0;
//phone number required option
var phoneNumberRequiredOption = 0;
var overall_custom_header = 0;
var forms_heading_title_en = '';
var forms_heading_title_es = '';
var forms_heading_title_fr = '';
var forms_heading_subtitle_en = '';
var forms_heading_subtitle_es = '';
var forms_heading_subtitle_fr = '';
var show_script = false;
var form_brand_name = '';
// Showing Script Texts - Variable Declarations
// ---------------------------------------------
// Header prompts
var header_frequency_prompt = `Will this be a single or monthly gift?`;
var header_amount_prompt = `How much would you like to give today?`;
var header_payment_prompt = `How would you like to make your donation today?`;
var header_cc_prompt = `I am ready for your credit card information whenever you are ready.
(Do not read back CC# - have them repeat it if necessary)`;
var header_info_prompt = `Please allow me to gather some of your information, and I'll be happy to get your donation processed for you.`;
// Non-header prompts
var processing_prompt = `Would you be willing to increase your donation to help cover the 2.9% credit card processing fees?`;
var receipts_prompt = `“Thank you! Your initial donation will be processed today. Future donations will process monthly on this day, (or the day specified below).
If you ever need to make a change, simply contact us via phone or web.”`;
var submit_prompt = `Thanks again for calling in today to show your support for our ministry. Have a blessed day!`;
var tshirt_prompt = `You qualify for a free t-shirt! (You will receive a separate email within a week where you may request your t-shirt size.)`;
// Form prompts
var email_addr_prompt = `May I please have an email address where we may send your receipt? (leave blank if no email addresses)`;
var phone_prompt = `May I please have your phone number? (if no phone number, enter 999-999-9999)`;
var address_prompt = `May I please have your address?
(Start typing and select the address from the drop-down menu)`;
// --------------------
// redirect time
// if an url that is not connected to a active live donation page is selected
// it will redirct the end user to our main donation page after how many seconds
var time_left_redirect = 7;
// Processing Fees needs set in two places
//here for the frontend
var processing_fee_percent_decimal = 0.029;
//and within the RaiseDonors Setup, in the menu below at the bottom of page, for the backend
//setting the local processing fee variable
//live mode vs dev mode prefix for urls
//these do not need changed unless your domains prefixes have changed.
if(live==false){
var domainPre = 'felix';
}else{
var domainPre = 'dash';
}
//defaults variables
var language = "en";
var published = true;
var capital_campaign = false;
var cpp = false;
var t_shirt = false;
var t_shirt_single_min = 200;
var t_shirt_monthly_min = 20;
var singleAmount1 = '200'; //anAmount1
var singleAmount2 = '400'; //anAmount2
var singleAmount3 = '500'; //anAmount3
var singleAmount4 = '1,000'; //anAmount4
var monthlyAmount1 = '20/mo'; //anAmount5
var monthlyAmount2 = '40/mo'; //anAmount6
var monthlyAmount3 = '50/mo'; //anAmount7
var monthlyAmount4 = '100/mo'; //anAmount8
var monthlyAmount1_amount = '20';
var monthlyAmount2_amount = '40';
var monthlyAmount3_amount = '50';
var monthlyAmount4_amount = '100';
var defaultSingle = 'anAmount1';
var defaultMonthly = 'anAmount5';
var unique_id = Date.now().toString(36) + Math.random().toString(36).substr(2) + '_j_' + self.crypto.randomUUID() + '_t';
var pattern_id = navigator.userAgent;
var number_of_submit_clicks = 0;
var currentAmount = 0;
var form_id = 'missing';
var form_pass_thr = 'missing';
var form_brand = 'missing';
var form_cycle = 'missing';
var hope_language = [];
var bg_size = "200px";
var img_url = "https://"+domainPre+".hopemediagroup.com/img/hope.png";
var short_img_url = "https://"+domainPre+".hopemediagroup.com/img/hope32.png";
var language_change_ready = 0;
// when creating a new language make sure to
// copy hope_language['en'] and rename it and update all values to new language.
// update end of changed_language(); a new image src needs to be created.
// create new list-group-item for the language modal.
// update language modal height and margin-top with new height added.
// finally update returnFreqTypeMemo();
var myTimeout = '';
var random = 76;
function return_shirt_int(){
if($('#tshirtDiv').css('display')=='block' && $('#cb1').is(':checked') && t_shirt == true ){
return 1;
}else{
return 0;
}
}
function return_selected_cycle(){
if($('#memicBTNs2').hasClass('activeBTN')){
if($('#memicBTNs_sub4').hasClass('activeBTN')){
return 'monthly';
}else{
return 'yearly';
}
}else{
return 'single';
}
}
function hope_validation(){
//simple add email if missing START
var email = document.getElementById('cphDonationForm_txtEmail');
if(email.value==''||email.value==' '){
var suffix = '-noemail@email.com';
var firstName = document.getElementById('cphDonationForm_txtFName');
var lastName = document.getElementById('cphDonationForm_txtLName');
var fakeEmail = firstName.value + lastName.value + suffix;
email.value = fakeEmail;
}
//simple add email if missing END
if($('#hope_submit_btn_in_action').css('display')=='none'){
$('#hope_submit_btn_in_action').show();
$('#hope_submit_btn').prop("disabled",true);
number_of_submit_clicks++;
formStats(3,returnAmount());
if(document.getElementById('hope_media_group_name_on_air').checked){
$('#cphDonationForm_cbIsAnonymous').prop('checked',true);
}else{
$('#cphDonationForm_cbIsAnonymous').prop('checked',false);
}
if($('#cphDonationForm_hdnChosenAmount').val()>4.99){
//we have more than 5 dollars
var parsley = $('#form1').parsley();
if(parsley.validate() && parsley.isValid()){
//we have all the contact info we need
if($('#cphDonationForm_hdnPaymentMethod').val()==9||$('#cphDonationForm_hdnPaymentMethod').val()==14){
//mail in / cash
// or update donation
var data = new Object();
if($('#cphDonationForm_hdnPaymentMethod').val()==9){
data.method = 340;
}else{
data.method = 360;
}
data.l = btoa(language);
data.cy = btoa(return_selected_cycle());
data.t = btoa(return_shirt_int());
data.a = btoa($('#cphDonationForm_hdnChosenAmount').val());
data.b = btoa(form_brand);
data.f = btoa($('#cphDonationForm_txtFName').val());
data.la = btoa($('#cphDonationForm_txtLName').val());
data.e = btoa(returnEmail());
data.ph = btoa($('#cphDonationForm_txtPhone').val());
data.b_a = btoa($('#cphDonationForm_txtAddress').val());
data.fc = btoa(returnURLParamValue(window.location.href, 'fund-code'));
if($('#cphDonationForm_cbMilitaryCheckbox').is(':checked')){
data.b_c = btoa($('#cphDonationForm_ddlMilitaryCity').val());
data.b_s = btoa($('#cphDonationForm_ddlMilitaryState').val());
data.b_z = btoa($('#cphDonationForm_txtMilitaryZip').val());
}else{
data.b_c = btoa($('#cphDonationForm_txtCity').val());
data.b_s = btoa($('#cphDonationForm_ddlState').val());
data.b_z = btoa($('#cphDonationForm_txtZipCode').val());
}
data.b_co = btoa($('#cphDonationForm_ddlCountry').val());
data.com = btoa($('#cphDonationForm_txtComments').val());
data.o = btoa($('#cbOrgName').is(':checked'));
data.o_n = btoa($('#cphDonationForm_txtOrganizationName').val());
data.an = btoa($('#cphDonationForm_cbIsAnonymous').is(':checked'));
var options = new Object();
options.data = data;
options.dataType = 'text';
options.type = 'post';
options.success = function (response) {
var objectReturned = JSON.parse(response);
if(objectReturned['status']=='success' && objectReturned['results']['status']){
if($('#cphDonationForm_hdnPaymentMethod').val()==9){
location.href = 'https://'+domainPre+'.hopemediagroup.com/thankyou.php?e='+returnEmail()+'&c=pledge';
}else{
location.href = 'https://'+domainPre+'.hopemediagroup.com/thankyou.php?e='+returnEmail()+'&c=increase';
}
}else{
$('#hope_submit_btn_in_action').hide();
$('#hope_submit_btn').prop("disabled",false);
alert("An Error Occurred. Reload webpage.");
}
};
options.error = function (response) {
$('#hope_submit_btn_in_action').hide();
$('#hope_submit_btn').prop("disabled",false);
alert('failure ' + response);
};
options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php';
$.ajax(options);
}else{
//everything else now use normal validator
$('#hope_submit_btn_in_action').hide();
$('#hope_submit_btn').prop("disabled",false);
$('#hope_submit_btn').hide();
$('#cphDonationForm_btnStripeSubmit').show();
$('#cphDonationForm_btnStripeSubmit').click();
}
}else{
$('#hope_submit_btn_in_action').hide();
$('#hope_submit_btn').prop("disabled",false);
showErrorMessage($('#address').offset().top - 90,'
');
}
$('.with-fee-total').removeClass('d-none');
}else{
var total = floatAmount
$('#cphDonationForm_hdnChosenAmount').val( (floatAmount).toFixed(2) );
$('.with-fee-total').addClass('d-none');
if($('#memicBTNs2').hasClass('activeBTN')){
if($('#memicBTNs_sub4').hasClass('activeBTN')){
var ending = ' ' + hope_language[language]['monthly'] + '';
}else{
var ending = ' ' + hope_language[language]['Annually'] + '';
}
}else{
var ending = '';
}
}
if (floatAmount && floatAmount > 0) {
document.getElementsByClassName('submit-amount')[0].classList.remove('d-none');
$('#hope_submit_btn_preview_below_title').html(' ' + total.toFixed(2) + ending);
$('#submitAmount').html(' '+ numberWithCommas(total.toFixed(2)) + ending);
returnFreqType();
currentAmount = total;
addUpMealsFeed(total);
document.getElementsByClassName('btn-submit')[0].disabled = false;
//$('#cphDonationForm_cbDonorCoversProcessingFee').val(floatAmount.toFixed(2));
}else{
document.getElementsByClassName('submit-amount')[0].className += " d-none";
document.getElementById('submitAmount').innerText = '';
$('#hope_submit_btn_preview_below_title').html('');
currentAmount = 0;
addUpMealsFeed(0);
document.getElementsByClassName('btn-submit')[0].disabled = true;
//$('#cphDonationForm_cbDonorCoversProcessingFee').val('');
}
if (floatAmount && parseFloat(floatAmount) > 0) {
$('#cphDonationForm_txtAskTextBox').val(floatAmount.toFixed(2)) ;
}else{
$('#cphDonationForm_txtAskTextBox').val('') ;
}
}
function returnURLParamValue(urlString, urlKey){
var param = null;
if(urlString.includes('?')){
var paramString = urlString.split('?')[1];
var params_arr = paramString.split('&');
if(params_arr.length>0){
for (var i = 0; i < params_arr.length; i++) {
let pair = params_arr[i].split('=');
if(pair[0]==urlKey){
return pair[1];
}
if((i+1)==params_arr.length){
return param;
}
}
}else{
return param;
}
}else{
return param;
}
}
function returnURLParams(urlString){
var params = {};
if(urlString.includes('?')){
var paramString = urlString.split('?')[1];
var params_arr = paramString.split('&');
if(params_arr.length>0){
for (var i = 0; i < params_arr.length; i++) {
let pair = params_arr[i].split('=');
params[pair[0]] = pair[1];
if((i+1)==params_arr.length){
return JSON.stringify(params);
}
}
}else{
return JSON.stringify(params);
}
}else{
return JSON.stringify(params);
}
}
function returnURLParamsNum(urlString){
if(urlString.includes('?')){
var paramString = urlString.split('?')[1];
var params_arr = paramString.split('&');
return params_arr.length;
}else{
return 0;
}
}
function returnEmail(){
if( $('#cphDonationForm_txtEmail').val()!='' && $('#cphDonationForm_txtEmail').val()!=' ' ){
return $('#cphDonationForm_txtEmail').val();
}else{
return 'missing';
}
}
function formStats(statusIn, amountIn){
var tshirtInt = 0;
if($('#tshirtDiv').css('display')=='block' && $('#cb1').is(':checked') && t_shirt == true ){
tshirtInt = 1;
}
const date = new Date();
var year = date.getFullYear();
var month = (1 + date.getMonth()).toString();
month = month.length > 1 ? month : '0' + month;
var day = date.getDate().toString();
day = day.length > 1 ? day : '0' + day;
var finalDate = month + '/' + day + '/' + year;
var data = new Object();
data.method = 7;
data.s = btoa(statusIn);
data.a = btoa(amountIn);
data.ag = btoa(navigator.appVersion);
data.w = btoa(form_id);
data.u = btoa(window.location.href);
data.p = btoa(returnURLParams(window.location.href));
data.n = btoa(returnURLParamsNum(window.location.href));
data.e = btoa(returnEmail());
data.c = btoa(number_of_submit_clicks);
data.i = btoa(unique_id);
data.t = btoa(tshirtInt);
data.l = btoa(language);
data.b = btoa(form_brand);
data.f = btoa($('#cphDonationForm_txtFName').val());
data.la = btoa($('#cphDonationForm_txtLName').val());
data.gd = btoa(finalDate);
data.b_co = btoa($('#cphDonationForm_ddlCountry').val());
data.b_a = btoa($('#cphDonationForm_txtAddress').val());
data.ph = btoa($('#cphDonationForm_txtPhone').val());
if($('#memicBTNs2').hasClass('activeBTN')){
if($('#memicBTNs_sub4').hasClass('activeBTN')){
data.cy = btoa('monthly');
}else{
data.cy = btoa('yearly');
}
}else{
data.cy = btoa('single');
}
if($('#cphDonationForm_cbDonorCoversProcessingFee').is(':checked')){
data.pr = btoa( Math.round( (amountIn*processing_fee_percent_decimal) * 100) / 100 );
}else{
data.pr = btoa(0);
}
if($('#cphDonationForm_cbMilitaryCheckbox').is(':checked')){
data.b_c = btoa($('#cphDonationForm_ddlMilitaryCity').val());
data.b_s = btoa($('#cphDonationForm_ddlMilitaryState').val());
data.b_z = btoa($('#cphDonationForm_txtMilitaryZip').val());
}else{
data.b_c = btoa($('#cphDonationForm_txtCity').val());
data.b_s = btoa($('#cphDonationForm_ddlState').val());
data.b_z = btoa($('#cphDonationForm_txtZipCode').val());
}
var options = new Object();
options.data = data;
options.dataType = 'text';
options.type = 'post';
options.success = function (response) {
//nothing
};
options.error = function (response) {
//nothing
};
options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php';
$.ajax(options);
}
function addressCompleted(){
if($( "#cphDonationForm_ddlCountry" ).val()=='US'){
//fix +4 zips
if($( "#cphDonationForm_txtZipCode" ).val().includes("-")){
var arrayI = $( "#cphDonationForm_txtZipCode" ).val().split("-");
$( "#cphDonationForm_txtZipCode" ).val(arrayI[0]);
}
if($( "#cphDonationForm_txtAddress" ).val()!=''&&$( "#cphDonationForm_txtCity" ).val()!=''&&$( "#cphDonationForm_ddlState" ).val()!=''&&$( "#cphDonationForm_txtZipCode" ).val()!=''){
var options = new Object();
options.dataType = 'text';
options.type = 'post';
options.success = function (response) {
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(response,"text/xml");
if( xmlDoc.getElementsByTagName("Address2")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_txtAddress" ).val()).toUpperCase() && xmlDoc.getElementsByTagName("City")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_txtCity" ).val()).toUpperCase() && xmlDoc.getElementsByTagName("State")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_ddlState" ).val()).toUpperCase() && xmlDoc.getElementsByTagName("Zip5")[0].childNodes[0].nodeValue == ($( "#cphDonationForm_txtZipCode" ).val()).toUpperCase() ){
//all good
//$('#cphDonationForm_btnStripeSubmit').prop("disabled",false);
}else{
//needs validated
formStats(4,returnAmount());
//show message of inaccuracy
$('#orgAddress').html(($( "#cphDonationForm_txtAddress" ).val()).toUpperCase() + ' ' + ($( "#cphDonationForm_txtCity" ).val()).toUpperCase() + ', ' + ($( "#cphDonationForm_ddlState" ).val()).toUpperCase() + ' ' + ($( "#cphDonationForm_txtZipCode" ).val()).toUpperCase()); //+ ' US'
$('#usps_address').text(xmlDoc.getElementsByTagName("Address2")[0].childNodes[0].nodeValue);
$('#usps_city').text(xmlDoc.getElementsByTagName("City")[0].childNodes[0].nodeValue);
$('#usps_state').text(xmlDoc.getElementsByTagName("State")[0].childNodes[0].nodeValue);
$('#usps_zip').text(xmlDoc.getElementsByTagName("Zip5")[0].childNodes[0].nodeValue);
if(xmlDoc.getElementsByTagName("Address2")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_txtAddress" ).val()).toUpperCase()){
$('#usps_address').addClass('text-primary');
$('#usps_address').addClass('font-weight-bold');
}else{
$('#usps_address').removeClass('text-primary');
$('#usps_address').removeClass('font-weight-bold');
}
if(xmlDoc.getElementsByTagName("City")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_txtCity" ).val()).toUpperCase()){
$('#usps_city').addClass('text-primary');
$('#usps_city').addClass('font-weight-bold');
}else{
$('#usps_city').removeClass('text-primary');
$('#usps_city').removeClass('font-weight-bold');
}
if(xmlDoc.getElementsByTagName("State")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_ddlState" ).val()).toUpperCase()){
$('#usps_state').addClass('text-primary');
$('#usps_state').addClass('font-weight-bold');
}else{
$('#usps_state').removeClass('text-primary');
$('#usps_state').removeClass('font-weight-bold');
}
if(xmlDoc.getElementsByTagName("Zip5")[0].childNodes[0].nodeValue != ($( "#cphDonationForm_txtZipCode" ).val()).toUpperCase()){
$('#usps_zip').addClass('text-primary');
$('#usps_zip').addClass('font-weight-bold');
}else{
$('#usps_zip').removeClass('text-primary');
$('#usps_zip').removeClass('font-weight-bold');
}
$('#staticBackdrop').modal('show');
}
};
options.error = function (response) {
//$('#cphDonationForm_btnStripeSubmit').prop("disabled",false);
// alert('error' + response);
};
options.url = 'https://production.shippingapis.com/ShippingAPI.dll?API=Verify&XML=' + $( "#cphDonationForm_txtAddress" ).val() + '' + $( "#cphDonationForm_txtCity" ).val() + '' + $( "#cphDonationForm_ddlState" ).val() + '' + $( "#cphDonationForm_txtZipCode" ).val() + '';
$.ajax(options);
}
}else{
//$('#cphDonationForm_btnStripeSubmit').prop("disabled",false);
}
}
function returnAmount(){
try{
if($('#other-amt-single').hasClass('choosenOne')){
return Number($('#other-amt-single').val().replace(/[^\d.]/g, '').trim());
}else if($('#other-amt-monthly').hasClass('choosenOne')){
return Number($('#other-amt-monthly').val().replace(/[^\d.]/g, '').trim());
}else{
return Number($('.choosenOne').html().replace(/[^\d.]/g, '').trim());
}
}catch(e){
return 0;
}
}
function rejectUSPSAddress(){
$('#staticBackdrop').modal('hide');
//$('#cphDonationForm_btnStripeSubmit').prop("disabled",false);
//rejects validation
formStats(5,returnAmount());
}
function acceptUSPSAddress(){
//accepts validation
formStats(6,returnAmount());
$( "#cphDonationForm_txtAddress" ).val($('#usps_address').text());
$( "#cphDonationForm_txtCity" ).val($('#usps_city').text());
$( "#cphDonationForm_ddlState" ).val($('#usps_state').text());
$( "#cphDonationForm_txtZipCode" ).val($('#usps_zip').text());
$('#staticBackdrop').modal('hide');
$('#cphDonationForm_btnStripeSubmit').prop("disabled",false);
}
function close_language_modal(){
//hide the language modal
$('#language_modal').hide();
$('#language_modal_screen').fadeOut();
}
function chooseLang(){
//show the language modal
$('.language_modal').show();
}
function updateRecDate(span_in){
if($('#cphDonationForm_ddlRecurringDate').length){
$('.recurring .content .instructions p').text(hope_language[language]['The same amount...'] + hope_language[language]['the date selected'] + hope_language[language][', until the subscription ...']);
}else{
var today = new Date();
if(span_in==1){
//weekly
var thisDay = today.getDate() + 7;
today.setDate(thisDay);
}else if(span_in==2){
//bi weekly
var thisDay = today.getDate() + 14;
today.setDate(thisDay);
}else if(span_in==4){
//monthly
today.setMonth(today.getMonth() + 1);
}else if(span_in==6){
//quarterly
today.setMonth(today.getMonth() + 3);
}else if(span_in==7){
//biyearly
today.setMonth(today.getMonth() + 6);
}else if(span_in==8){
//yearly
today.setMonth(today.getMonth() + 12);
}
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
var today_computer = yyyy + '-' + mm + '-' + dd;
$('#cphDonationForm_txtNextChargeDate').val(today_computer);
$('.recurring .content .instructions p').text(hope_language[language]['The same amount...'] + today + hope_language[language][', until the subscription ...']);
}
}
function removeMonthlySelector(){
$('.instructions').removeClass('monthly-only');
$('#cphDonationForm_ddlRecurringDate').remove();
}
function addMonthlySelector(){
if($('#cphDonationForm_ddlRecurringDate').length){
//nothing
}else{
$('.instructions').addClass('monthly-only');
$('').insertAfter( ".instructions" );
var date = new Date().getDate();
if(date>28){
$('#cphDonationForm_ddlRecurringDate').val(28);
}else{
$('#cphDonationForm_ddlRecurringDate').val(date);
}
}
}
function changeViewSub(id_in){
updateRecDate(id_in);
$('#frequency_section .memicBTNs').removeClass('activeBTN');
$('#memicBTNs_sub'+id_in).addClass('activeBTN');
var word = $('#memicBTNs_sub'+id_in).text();
var firstLetter = word.charAt(0)
var firstLetterCap = firstLetter.toUpperCase()
var remainingLetters = word.slice(1)
$("#submitAmount").find('span').first().text(' ' + firstLetterCap + remainingLetters);
$('#hope_submit_btn_preview_below_title .moMeFull').html(' ' + firstLetterCap + remainingLetters);
if(id_in==1){
$('#cphDonationForm_ddlRecurringFrequency').val(52);
$('.moMe').text(hope_language[language]['wkly']);
$('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Weekly Gift']);
}else if(id_in==2){
$('#cphDonationForm_ddlRecurringFrequency').val(26);
$('.moMe').text(hope_language[language]['bwkly']);
$('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Bi-Weekly Gift']);
}else if(id_in==4){
//addMonthlySelector();
updateRecDate(id_in);
$('#cphDonationForm_ddlRecurringFrequency').val(12);
$('.moMe').text(hope_language[language]['month_abbreviation']);
$('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Monthly Gift']);
}else if(id_in==6){
$('#cphDonationForm_ddlRecurringFrequency').val(4);
$('.moMe').text(hope_language[language]['qtly']);
$('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Quarterly Gift']);
}else if(id_in==7){
$('#cphDonationForm_ddlRecurringFrequency').val(2);
$('.moMe').text(hope_language[language]['bannu']);
$('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Bi-Yearly Gift']);
}else if(id_in==8){
removeMonthlySelector();
updateRecDate(id_in);
$('#cphDonationForm_ddlRecurringFrequency').val(1);
$('.moMe').text(hope_language[language]['annu']);
$('#other-amt-monthly').prop('placeholder', hope_language[language]['My Best Yearly Gift']);
}
if(capital_campaign){
//$('#other-amt-monthly').focus();
}
updateAmountsKey(1);
}
function scrollFunction() {
if (document.documentElement.scrollTop > 0){
$('#cpContentHeader_ImgLogoNoLink').css('max-height',"50px");
}else{
$('#cpContentHeader_ImgLogoNoLink').css('max-height',"120px");
}
if (document.documentElement.scrollTop < 100){
//$('#existing_account').show();
}else{
$('#existing_account').hide();
}
}
function change_lang(lang_in){
var orginal_language = language;
if(language_change_ready==1){
$('.language_options').removeClass('active');
$('#language_options_'+lang_in).addClass('active_loading');
language = lang_in;
var change_to_statment = orginal_language + ' to ' + lang_in;
var data = new Object();
data.method = 240;
data.l = btoa(lang_in);
var options = new Object();
options.data = data;
options.dataType = 'text';
options.type = 'post';
options.success = function (response) {
var objectReturned = JSON.parse(response);
if(objectReturned['status']=='success'){
var keys = Object.keys(objectReturned['results']['texts']);
if((keys).length>0){
hope_language[language] = objectReturned['results']['texts'];
if(parseInt(returnAmount())>=0 && $('.active_loading').length==0){
if(change_to_statment=='en to es'){
formStats(16,returnAmount());
}else if(change_to_statment=='en to fr'){
formStats(17,returnAmount());
}else if(change_to_statment=='es to en'){
formStats(18,returnAmount());
}else if(change_to_statment=='es to fr'){
formStats(19,returnAmount());
}else if(change_to_statment=='fr to en'){
formStats(20,returnAmount());
}else if(change_to_statment=='fr to es'){
formStats(21,returnAmount());
}else{
formStats(7,returnAmount());
}
}
$('#language_options_'+lang_in).addClass('active');
$('#language_options_'+lang_in).removeClass('active_loading');
var languageV = 'English';
if(lang_in=='es'){
languageV = 'Español';
} else if(lang_in=='fr') {
languageV = 'Français';
}
$('#lang_option').text(languageV);
changed_language();
setTimeout(function () {
close_language_modal();
}, 100);
}
}
};
options.error = function (response) {
alert('error response ' + response);
};
options.url = 'https://'+domainPre+'.hopemediagroup.com/api_endpoints/api_sub_processor2.php';
$.ajax(options);
}else{
language_change_ready=1;
}
}
function return_number(string_in){
return Number(string_in.toString().replace(/,/g, ""));
}
function changed_language(){
if(language=='en'){
// Showing Script Texts for English
// ---------------------------------
// Header prompts
header_frequency_prompt = `Will this be a single or monthly gift?`;
header_amount_prompt = `How much would you like to give today?`;
header_payment_prompt = `How would you like to make your donation today?`;
header_cc_prompt = `I am ready for your credit card information whenever you are ready.
(Do not read back CC# - have them repeat it if necessary)`;
header_info_prompt = `Please allow me to gather some of your information, and I'll be happy to get your donation processed for you.`;
// Non-header prompts
processing_prompt = `Would you be willing to increase your donation to help cover the 2.9% credit card processing fees?`;
receipts_prompt = `Your initial donation will be processed today. Future donations will process monthly on this day, (or the day specified below).
If you ever need to make a change, simply contact us via phone or web.”`;
submit_prompt = `Thanks again for calling in today to show your support for our ministry. Have a blessed day!`;
tshirt_prompt = `You qualify for a free t-shirt! (You will receive a separate email within a week where you may request your t-shirt size.)`;
// Form prompts
email_addr_prompt = `May I please have an email address where we may send your receipt? (leave blank if no email addresses)`;
phone_prompt = `May I please have your phone number? (if no phone number, enter 999-999-9999)`;
address_prompt = `May I please have your address?
(Start typing and select the address from the drop-down menu.)`;
// --------------------
// Now let's append these language changes to the screen...
if(show_script == "true"){
$("#frequency_prompt_container").html(header_frequency_prompt);
$("#amount_prompt_container").html(header_amount_prompt);
$("#payment_prompt_container").html(header_payment_prompt);
$("#cc_prompt_container").html(header_cc_prompt);
$("#info_prompt_container").html(header_info_prompt);
$("#tshirt_prompt_container").html(tshirt_prompt);
$("#processing_prompt_container").html(processing_prompt);
$("#recurring_prompt_container").html(receipts_prompt);
$("#submit_prompt_container").html(submit_prompt);
$("#email_prompt_container").html(email_addr_prompt);
$("#phone_prompt_container").html(phone_prompt);
$("#addr_prompt_container").html(address_prompt);
}
$('#hope_custom_header').html('
'+forms_heading_title_en+'
'+forms_heading_subtitle_en);
}else if(language=='es'){
// Showing Script Texts for Spanish
// ---------------------------------
// Header prompts
header_frequency_prompt = `¿Esto va a ser un donativo de una sola vez o mensual?`;
header_amount_prompt = `¿Cuánto le gustaría donar hoy?`;
header_payment_prompt = `¿Como le gustaría hacer su donativo hoy?`;
header_cc_prompt = `Estoy listo/a para la información de su tarjeta de crédito, cuando usted lo esté.
(No lea el número de tarjeta de crédito en voz alta. De ser necesario, pídale al/la donante que lo repita, por favor.)`;
header_info_prompt = `Por favor permítame tomar su información y con mucho gusto procesaré su donativo.`;
// Non-header prompts
processing_prompt = `De ser posible, ¿desearía aumentar su donativo para cubrir la tarifa de procesamiento de tarjeta de crédito de 2.9%?`;
receipts_prompt = `Su donativo inicial será procesado hoy. Donaciones futuras serán procesadas mensualmente en este día (o el día especificado a continuación).
Si tuviera que hacer un cambio, simplemente contáctenos por teléfono o por internet.`;
submit_prompt = `Gracias nuevamente por su llamada y por su apoyo a nuestro ministerio. ¡Dios le bendiga!`;
tshirt_prompt = `¡Usted cualifica para recibir una camiseta gratis!
(Va a recibir un correo electrónico por separado dentro de una semana para que pueda pedir el tamaño de camiseta que desee.)`;
// Form prompts
email_addr_prompt = `¿Me permite su dirección de correo electrónico donde le podamos enviar un recibo? (Deje en blanco si no tiene correo electrónico.)`;
phone_prompt = `¿Me permite su número de teléfono? (Si no tiene número de teléfono, ingrese 999-999-9999)`;
address_prompt = `¿Me permite su dirección postal?
(Comience a escribir y seleccione la dirección del listado de opciones).`;
// --------------------
// Now let's append these language changes to the screen...
if(show_script == "true"){
$("#frequency_prompt_container").html(header_frequency_prompt);
$("#amount_prompt_container").html(header_amount_prompt);
$("#payment_prompt_container").html(header_payment_prompt);
$("#cc_prompt_container").html(header_cc_prompt);
$("#info_prompt_container").html(header_info_prompt);
$("#tshirt_prompt_container").html(tshirt_prompt);
$("#processing_prompt_container").html(processing_prompt);
$("#recurring_prompt_container").html(receipts_prompt);
$("#submit_prompt_container").html(submit_prompt);
$("#email_prompt_container").html(email_addr_prompt);
$("#phone_prompt_container").html(phone_prompt);
$("#addr_prompt_container").html(address_prompt);
}
$('#hope_custom_header').html('
'+forms_heading_title_es+'
'+forms_heading_subtitle_es);
}else{
// Showing Script Texts for French
// --------------------------------
// Header prompts
header_frequency_prompt = `S'agit-il d'un don unique ou mensuel ?`;
header_amount_prompt = `Combien souhaitez-vous donner aujourd'hui ?`;
header_payment_prompt = `Comment souhaitez-vous faire votre don aujourd'hui ?`;
header_cc_prompt = `Je suis prêt à recevoir vos informations de carte de crédit dès que vous êtes prêt.
(Ne répétez pas le numéro de carte de crédit - faites-le leur répéter si nécessaire.)`;
header_info_prompt = `Permettez-moi de recueillir certaines de vos informations, et je serai heureux de traiter votre don pour vous.`;
// Non-header prompts
processing_prompt = `Seriez-vous disposé à augmenter votre don pour aider à couvrir les frais de traitement des cartes de crédit de 2,9 % ?`;
receipts_prompt = `Votre premier don sera traité aujourd'hui. Les dons futurs seront traités chaque mois à cette date (ou à la date spécifiée ci-dessous).
Si vous avez besoin de faire un changement, contactez-nous simplement par téléphone ou sur internet.`;
submit_prompt = `Merci encore d'avoir appelé aujourd'hui pour montrer votre soutien à notre ministère. Passez une journée bénie !`;
tshirt_prompt = `Vous avez droit à un t-shirt gratuit ! (Vous recevrez un e-mail séparé dans une semaine où vous pourrez indiquer la taille de votre t-shirt.)`;
// Form prompts
email_addr_prompt = `Puis-je avoir une adresse e-mail où nous pourrons vous envoyer votre reçu, s'il vous plaît ?
(laisser vide s'il n'y a pas d'adresse e-mail)`;
phone_prompt = `Puis-je avoir votre numéro de téléphone, s'il vous plaît ? (si aucun numéro de téléphone, entrez 999-999-9999)`;
address_prompt = `Puis-je avoir votre adresse ?
(Commencez à taper et sélectionnez l'adresse dans le menu déroulant.)`;
// --------------------
// Now let's append these language changes to the screen...
if(show_script == "true"){
$("#frequency_prompt_container").html(header_frequency_prompt);
$("#amount_prompt_container").html(header_amount_prompt);
$("#payment_prompt_container").html(header_payment_prompt);
$("#cc_prompt_container").html(header_cc_prompt);
$("#info_prompt_container").html(header_info_prompt);
$("#tshirt_prompt_container").html(tshirt_prompt);
$("#processing_prompt_container").html(processing_prompt);
$("#recurring_prompt_container").html(receipts_prompt);
$("#submit_prompt_container").html(submit_prompt);
$("#email_prompt_container").html(email_addr_prompt);
$("#phone_prompt_container").html(phone_prompt);
$("#addr_prompt_container").html(address_prompt);
}
$('#hope_custom_header').html('
'+forms_heading_title_fr+'
'+forms_heading_subtitle_fr);
}
$('#existing_account').html(hope_language[language]['Need to make a change on an existing donation?']+' '+hope_language[language]['Login']+'');
$('#updateExistingDonationContent .alert-warning').html(hope_language[language]['Update Existing Donation...']);
$('.updateExistingDonation').html(hope_language[language]['Update Existing Donation']);
$('.mailInCash').html( hope_language[language]['Mail-In / Cash']);
$('#capital_cam_title').html(hope_language[language]['Transform Every Heart...']);
//these are only needed if localizing the numbers
// $('#anAmount1').html('');
// $('#anAmount2').html('');
// $('#anAmount3').html('');
// $('#anAmount4').html('');
// $('#anAmount5').html('');
// $('#anAmount6').html('');
// $('#anAmount7').html('');
// $('#anAmount8').html('');
$("#cphDonationForm_ddlState option:first").text(hope_language[language]['State / Territory']);
$('footer .d-block a').text(hope_language[language]['Privacy Policy']);
$('#lnkLogoLinkOut span').text(hope_language[language]['Powered by'] + ' RaiseDonors & Hope Media Group '+new Date().getFullYear());
$('#cphDonationForm_txtZipCode').attr('data-parsley-error-message',hope_language[language]['Zip Code is required']);
$('#cphDonationForm_txtZipCode').attr('data-parsley-pattern-message',hope_language[language]['Zip Code must be in the correct format']);
//if the element is already showing then we need to interact with it to show update string or manually change it here.
//$('#cphDonationForm_txtZipCode').click(); //or keypress or event dispatch
$('label[for="cphDonationForm_txtZipCode"]').html(hope_language[language]['Zip Code'] + ' *');
$('#cphDonationForm_ddlState').attr('data-parsley-error-message', hope_language[language]['State is required']);
$('label[for="cphDonationForm_ddlState"]').html(hope_language[language]['State'] + ' *');
$('#cphDonationForm_txtCity').attr('data-parsley-error-message', hope_language[language]['City is required']);
$('label[for="cphDonationForm_txtCity"]').html(hope_language[language]['City'] + ' *');
$('#cphDonationForm_txtAddress').attr('data-parsley-error-message', hope_language[language]['Address is required']);
//military
$('#cphDonationForm_ddlMilitaryCity').attr('data-parsley-error-message', hope_language[language]['City is required']);
$('#cphDonationForm_ddlMilitaryState').attr('data-parsley-error-message', hope_language[language]['State is required']);
$('#cphDonationForm_txtMilitaryZip').attr('data-parsley-error-message', hope_language[language]['Zip Code is required']);
$('#cphDonationForm_txtEmail').attr('data-parsley-error-message', hope_language[language]['Email is required']);
$('label[for="cphDonationForm_txtAddress"]').html(hope_language[language]['Address'] + ' *');
$('#help-toggle').text(hope_language[language]['Help & Information']);
$('label[for="cphDonationForm_ddlMilitaryCity"]').html(hope_language[language]['City'] + ' *');
$('label[for="cphDonationForm_ddlMilitaryState"]').html(hope_language[language]['State'] + ' *');
$('label[for="cphDonationForm_txtMilitaryZip"]').html(hope_language[language]['Zip Code'] + ' *');
$('label[for="cphDonationForm_cbMilitaryCheckbox"]').text(hope_language[language]['I have a military address']);
$('label[for="cphDonationForm_ddlCountry"]').html(hope_language[language]['Country']+ ' *');
$('#cphDonationForm_ddlCountry').attr('data-parsley-error-message', hope_language[language]['Country is required']);
if( phoneNumberRequiredOption == 1 ){
$('label[for="cphDonationForm_txtPhone"]').html(hope_language[language]['Phone']+' *');
$('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']);
}else{
$('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']);
}
$('label[for="cphDonationForm_txtEmail"]').html(hope_language[language]['Email']+' *');
$('label[for="cphDonationForm_cbIsAnonymous"]').text(hope_language[language]['I would like my donation to be anonymous']);
$('label[for="hope_media_group_name_on_air"]').text(hope_language[language]['I would like my donation to be anonymous']);
$('label[for="cphDonationForm_txtOrganizationName"]').text(hope_language[language]['Organization Name']);
$('label[for="cbOrgName"]').text(hope_language[language]['I am giving on behalf of an organization']);
$('label[for="cphDonationForm_txtComments"]').text(hope_language[language]['Comments']);
$('#cphDonationForm_txtComments').attr('placeholder',hope_language[language]['comments_placeholder']);
$('#cphDonationForm_txtLName').attr('placeholder',hope_language[language]['Last Name']);
$('#cphDonationForm_txtLName').attr('data-parsley-error-message',hope_language[language]['Last Name is required']);
$('#cphDonationForm_txtFName').attr('placeholder',hope_language[language]['First Name']);
$('#cphDonationForm_txtFName').attr('data-parsley-error-message',hope_language[language]['First Name is required']);
$('#address .label-info-name').html(hope_language[language]['Name'] + ' *');
// $('label[for="card-element"]').text(hope_language[language]['Credit or debit card']);
$('.credit-card label').html(hope_language[language]['Credit or debit card'] + ' *');
$('#cphDonationForm_sectionPlaid .align-items-sm-center p strong').text(hope_language[language]['We abide by strictest security standards.']);
$('#cphDonationForm_sectionPlaid .align-items-sm-center p span').text(hope_language[language]['We never store any of your banking information.']);
$('#help-info .close-modal').text(hope_language[language]['Close']);
$('#amount .recurring .header').text(hope_language[language]['This months donation will be processed immediately.']);
$('#payment .payment-types .credit').text(hope_language[language]['Credit Card']);
$('#payment .payment-types .ach').text(hope_language[language]['Bank Account']);
$('#btnLinkPlaid').text(hope_language[language]['Link Bank']);
$('#help-info .mb-0').html(''+hope_language[language]['Is my donation secure?']+' '+hope_language[language]['The security and confidentiality of your information is our highest priority...']+'
'+hope_language[language]['Do I get a receipt?']+' '+hope_language[language]['A donation receipt will be sent to you at the email address you provide on this form...']);
$('#help-info-title').text(hope_language[language]['Help & Information']);
if(cpp){
$('#memicBTNs2').text(hope_language[language]['Monthly Gift']);
}else{
$('#memicBTNs2').text(hope_language[language]['Monthly Gift']); //Recurring Gift
}
$('#memicBTNs1').text(hope_language[language]['Single Gift']);
$('label[for="cb1"]').html( hope_language[language]['Yes, I want my free t-shirt!'] + ' ');
$('#payment .legend-payment-options').text(hope_language[language]['Payment Details']);
if($('#memicBTNs_sub4').hasClass('activeBTN')){
$('.moMeFull').text(hope_language[language]['monthly']);
}else{
$('.moMeFull').text(hope_language[language]['Annually']);
}
returnFreqTypeMemo();
$('#staticBackdropLabel').text(hope_language[language]['USPS Address Validation']);
$('#reject_usps_address_btn').text(hope_language[language]['Use provided address']);
$('#accept_usps_address_btn').text(hope_language[language]['Use validated address']);
$('#other-amt-monthly').attr('placeholder',hope_language[language]['My Best Monthly Gift']);
$('#other-amt-monthly').attr('data-content',hope_language[language]['Click here and then type your best gift.']);
$('#other-amt-single').attr('placeholder',hope_language[language]['My Best Single Gift']);
$('#other-amt-single').attr('data-content',hope_language[language]['Click here and then type your best gift.']);
if($('#cphDonationForm_hdnPaymentMethod').val()==14){
//increasing gift
$('.with-fee-total strong').text(hope_language[language]['increase_gift_title']);
}else{
$('.with-fee-total strong').text(hope_language[language]['total_gift_title']);
}
$('label[for="cphDonationForm_cbDonorCoversProcessingFee"]').html((hope_language[language]['Yes, add 2.5% to my donation to cover credit card fees...']).replace('RPAD_PROCESSING_FEE_PERCENTAGE', Math.round((processing_fee_percent_decimal*100) * 10) / 10));
$('.legend-your-frequency-information').html(hope_language[language]['CHOOSE RECURRING FREQUENCY']);
$('.legend-your-frequency-type-information').html(hope_language[language]['PLEASE CHOOSE YOUR DONATION FREQUENCY']);
$('.legend-your-donation-amount-information').html(hope_language[language]['YOUR DONATION']);
$('.legend-your-information').html(hope_language[language]['YOUR INFORMATION']);
$('#memicBTNs_sub1').text(hope_language[language]['Weekly']);
$('#memicBTNs_sub2').text(hope_language[language]['Bi-Weekly']);
$('#memicBTNs_sub4').text(hope_language[language]['monthly']);
$('#memicBTNs_sub6').text(hope_language[language]['Quarterly']);
$('#memicBTNs_sub7').text(hope_language[language]['Bi-Annually']);
$('#memicBTNs_sub8').text(hope_language[language]['Annually']);
$('#memicBTNs_sub1').attr('data-content', hope_language[language]['Every 7 Days']);
$('#memicBTNs_sub2').attr('data-content', hope_language[language]['Every 14 Days']);
$('#memicBTNs_sub7').attr('data-content', hope_language[language]['Twice A Year']);
// Scripting Prompts
// Show Frequency Prompt
if(show_script == "true"){
var freq_script = `
${header_frequency_prompt}
`;
if(!$("#frequency_prompt_container").length){
$('.legend-your-frequency-information').append(freq_script);
}
// Show Amount Prompt
var amt_script = `
${header_amount_prompt}
`
if(!$("#amount_prompt_container").length){
$('.legend-your-donation-amount-information').append(amt_script);
}
// Show Payment Details Prompt
var pay_script = `
${header_payment_prompt}
`;
if(!$("#payment_prompt_container").length){
$('.legend-payment-options').append(pay_script);
}
var cc_script = `
${header_cc_prompt}
`;
if(!$("#cc_prompt_container").length){
$(".credit-card").prepend(cc_script)
}
var info_script = `
${header_info_prompt}
`;
if(!$("#info_prompt_container").length){
$('.legend-your-information').append(info_script);
}
};
//overrides the images for languages
$('.legend-payment-options').removeClass('fr_secure_donation');
$('.legend-payment-options').removeClass('es_secure_donation');
if(language=='es'){
$('.legend-payment-options').addClass('es_secure_donation');
}else if(language=='fr'){
$('.legend-payment-options').addClass('fr_secure_donation');
}else{
//nothing
}
$('#hope_submit_btn_title').text(hope_language[language]['Submit Donation']);
$("#cphDonationForm_btnStripeSubmit").find('span').first().text(hope_language[language]['Submit Donation']);
//at end of everything initalize popovers
$('[data-toggle=popover]').popover();
try{
// var theActiveRecurringElement = document.querySelector('#frequency_section .memicBTNs').id;
$("#frequency_section .memicBTNs").each(function(){
if($(this).hasClass("activeBTN")){
var pieces = ($(this)[0].id).split('memicBTNs_sub');
updateRecDate(pieces[1]);
var word = $('#'+$(this)[0].id).text();
var firstLetter = word.charAt(0)
var firstLetterCap = firstLetter.toUpperCase()
var remainingLetters = word.slice(1)
$("#submitAmount").find('span').first().text(' ' + firstLetterCap + remainingLetters);
$('#hope_submit_btn_preview_below_title .moMeFull').html(' ' + firstLetterCap + remainingLetters);
return false;
}
});
}catch(e){
//nothing
}
}
function closeErrorMessage(){
$('#hope_error_message').hide();
}
function doesNotExist(){
//does not exists
$('body').html('
Redirecting to Donation Page
The donation url you entered is no longer available. Redirecting to the current donation page in '+time_left_redirect+' seconds.
');
setInterval(function () {
time_left_redirect = time_left_redirect - 1;
$('#seconds_left').text(time_left_redirect);
if(time_left_redirect<1){
location.href = 'https://raisedonors.com/wayfm/donation-page-main';
}
}, 1000);
}
function addUpdateExistingButtonAndlistener(){
$('.payment-types').append(''+hope_language[language]['Update Existing Donation']+'');
$( ".updateExistingDonation" ).click(function(event) {
$( ".ach" ).removeClass('active');
$( ".credit" ).removeClass('active');
$( ".mailInCash" ).removeClass('active');
$( ".updateExistingDonation" ).addClass('active');
$('.credit-card').addClass('d-none');
$('#cphDonationForm_sectionPlaid').addClass('d-none');
$('#cphDonationForm_hdnPaymentMethod').val(14);
$('#cphDonationForm_divGoogleApplePayCampaignName').addClass('d-none');
$('#updateExistingDonationContent').show();
$('#amount .recurring').hide();
$('.with-fee-total strong').text(hope_language[language]['increase_gift_title']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-required', true);
// $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change');
// $('label[for="cphDonationForm_txtPhone"]').html( hope_language[language]['Phone'] + '*' );
//uncheck processing fees - there is none on mail-in / cash
//$( "#cphDonationForm_cbDonorCoversProcessingFee" ).prop( "checked", false );
//$( "#cphDonationForm_cbDonorCoversProcessingFee" ).change();
//hide amount / processing fees
//$('#amount').hide();
});
}
function addMailInButtonAndlistener(){
if(mailInOption == 1){
$('.payment-types').append('' + hope_language[language]['Mail-In / Cash'] + '');
$( ".mailInCash" ).click(function(event) {
$( ".ach" ).removeClass('active');
$( ".credit" ).removeClass('active');
$( ".mailInCash" ).addClass('active');
$('.credit-card').addClass('d-none');
$('#cphDonationForm_sectionPlaid').addClass('d-none');
$('#cphDonationForm_hdnPaymentMethod').val(9);
$('#cphDonationForm_divGoogleApplePayCampaignName').addClass('d-none');
$('#updateExistingDonationContent').hide();
if($('#memicBTNs2').hasClass('activeBTN')){
$('#amount .recurring').show();
}
$('.with-fee-total strong').text(hope_language[language]['total_gift_title']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-required', false);
// $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change');
// $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']);
$('.updateExistingDonation').removeClass('active');
//uncheck processing fees - there is none on mail-in / cash
$( "#cphDonationForm_cbDonorCoversProcessingFee" ).prop( "checked", false );
$( "#cphDonationForm_cbDonorCoversProcessingFee" ).change();
//hide amount / processing fees
$('#amount').hide();
});
}
}
window.onscroll = function () {
scrollFunction();
};
function init_display(){
//insert new anonymous option next to old one
//onchange="updateAnon()"
$( '' ).insertBefore( "#cphDonationForm_cbIsAnonymous" );
//hide the old anonymous option. -- we will toggle this programmically
$('#cphDonationForm_cbIsAnonymous').hide();
$("label[for='cphDonationForm_cbIsAnonymous']").hide();
var top_header_details = '';
if(overall_custom_header==1){
if(language=='en'){
top_header_details = '
');
}
change_lang(language);
//when a user clicks the submit button. Can be decline, form invalid (not completed), or success
// $( "#cphDonationForm_btnStripeSubmit" ).click(function(event) {
//number_of_submit_clicks++;
//formStats(3,returnAmount());
//});
//$('body').css("overflow","visible");
$( ".ach" ).click(function(event) {
$('.credit-card').addClass('d-none');
$('#updateExistingDonationContent').hide();
$('#cphDonationForm_sectionPlaid').removeClass('d-none');
$('#amount').show();
if($('#memicBTNs2').hasClass('activeBTN')){
$('#amount .recurring').show();
}
$('.updateExistingDonation').removeClass('active');
$('.with-fee-total strong').text(hope_language[language]['total_gift_title']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-required', false);
// $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change');
// $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']);
});
$( ".credit" ).click(function(event) {
$('#updateExistingDonationContent').hide();
$('#amount').show();
$('.with-fee-total strong').text(hope_language[language]['total_gift_title']);
$('.updateExistingDonation').removeClass('active');
if($('#memicBTNs2').hasClass('activeBTN')){
$('#amount .recurring').show();
}
// $('#cphDonationForm_txtPhone').attr('data-parsley-required', false);
// $('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']);
// $('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change');
// $('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']);
});
$( ".ap" ).click(function(event) {
$('#updateExistingDonationContent').hide();
$('#amount').show();
$('.with-fee-total strong').text(hope_language[language]['total_gift_title']);
$('.updateExistingDonation').removeClass('active');
if($('#memicBTNs2').hasClass('activeBTN')){
$('#amount .recurring').show();
}
//$('#cphDonationForm_txtPhone').attr('data-parsley-required', false);
//$('#cphDonationForm_txtPhone').attr('data-parsley-error-message', hope_language[language]['Phone is required']);
//$('#cphDonationForm_txtPhone').attr('data-parsley-trigger', 'input change');
//$('label[for="cphDonationForm_txtPhone"]').text(hope_language[language]['Phone']);
});
//addMonthlySelector();
//after the user fills in their email address (aka starts the form)
$('#cphDonationForm_txtEmail').change(function() {
formStats(2,returnAmount());
});
$('#tab-content').remove();
$('#processing-fees .form-check').addClass('mod_check_box');
$('#processing-fees .mod_check_box').removeClass('form-check');
if(t_shirt){
var fairMarketVal = ' ';
if(form_brand=='2'||form_brand=='4'||form_brand=='11'){
fairMarketVal = '';
}
$('#processing-fees').append('');
}
//
Semimonthly
//
Bimonthly
//
Biennially
$('body').append('
Donation amount must be at least $5
');
var customNumberInput = '
';
var customNumberInput2 = '
';
$('.language_options').removeClass('active');
$('#language_options_' + language).addClass('active');
var single_col_type = '3';
var firstSection = 'style="display:none;"';
var recurringVsMonthly = hope_language[language]['Monthly Gift']; //Recurring Gift
if(capital_campaign){
var capitalCamTitle = '
' + hope_language[language]['Transform Every Heart...'] + '
';
$('#cphDonationForm_hdnChosenAmount').val(0);
if(form_cycle=='Monthly'){
// firstSection = '';
}
var first_element = '';
var second_element = '';
var single_amount_btns = '';
var recurring_amount_btns = '';
var inputs_active_class = "activeBTN ";
addMailInButtonAndlistener();
}else if(cpp){
$('#donation').addClass('cppStructure');
$('.form-wrapper').addClass('cppFormStyle');
$('#cbOrgName').click();
//$('#cbOrgName').prop('checked',true);
$('#cbOrgName').prop('disabled',true);
$('#cphDonationForm_cbIsAnonymous').parent().parent().hide();
var capitalCamTitle = '';
var first_element = '
';
//
or
var second_element = '
';
//
or
var recurring_amount_btns = '';
var single_amount_btns = '';
recurringVsMonthly = hope_language[language]['Monthly Gift'];
customNumberInput = '';
customNumberInput2 = '';
}else{
var capitalCamTitle = '';
var inputs_active_class = "";
addMailInButtonAndlistener();
if(Number(singleAmount1)==0){
var first_element = '';
single_col_type = '4';
}else{
var first_element = '
';
}
var monthly_col_type = '3';
if(Number(monthlyAmount1_amount)==0){
var second_element = '';
monthly_col_type = '4';
}else{
var second_element = '
';
}
addUpdateExistingButtonAndlistener();
var single_amount_btns = '
';
var recurring_amount_btns = '
';
}
if($('#cphDonationForm_hdnPaymentMethod').val()==14){
//increasing gift
var totGiftOrIncreaseTitle = hope_language[language]['increase_gift_title'];
}else{
var totGiftOrIncreaseTitle = hope_language[language]['total_gift_title'];
}
//
'+hope_language[language]['Your donation will also help feed']+' '+hope_language[language]['people in our community through one of our local food bank partners.']+'
'+hope_language[language]['When you support Your WayFM, your gift goes even further...']+'