Donation Test



function validate(aFrm) { var a;

disablePayButton(true);

// Validate the required fields.

//validateSecurityCode(aFrm.recaptcha_challenge_field.value, aFrm.recaptcha_response_field.value); //validSecurityCode=true;

if (aFrm.FirstName.value == "") { alert("Please enter a value for the \"First Name\" field."); aFrm.FirstName.focus(); disablePayButton(false); return (false); }

if (aFrm.LastName.value == "") { alert("Please enter a value for the \"Last Name\" field."); aFrm.LastName.focus(); disablePayButton(false); return (false); }

aFrm.NameOnCreditCard.value = aFrm.FirstName.value + " " + aFrm.LastName.value;

if (aFrm.Email.value == "" || !validateEmail(aFrm.Email.value)) { alert("Please enter a valid value for the \"Email Address\" field."); aFrm.Email.focus(); disablePayButton(false); return (false); }

a = document.getElementById("Amount").value.replace(new RegExp("[^0-9.]", "g"), ""); if (a == "" || a = 1 && mm = parseInt(d.getFullYear()) )) || (!(yyyy != parseInt(d.getFullYear()) || mm >= (parseInt(d.getMonth()) + 1) ))) { alert("Credit card is already expired!\nPlease use a different credit card."); aFrm.CreditCardNumber.focus(); aFm.CreditCardNumber.select(); disablePayButton(false); return (false); } } catch (ex) { alert("Please enter a valid expiration date."); aFrm.CreditCardExpirationMonth.focus(); disablePayButton(false); return (false); }

/* if(validSecurityCode == false){ alert("Security words validation failed. Please try again."); Recaptcha.focus_response_field(); disablePayButton(false); return (false); } */

return true; }

function disablePayButton(doIt) { if (doIt) { document.getElementById("submitButton").disabled = true; document.getElementById("msg").style.display = ""; document.getElementById("submitButton").src = payBtnImgDisabled.src; } else { document.getElementById("submitButton").disabled = false; document.getElementById("msg").style.display = "none"; document.getElementById("submitButton").src = payBtnImgEnabled.src; //Recapcha.reload(); } }

function getOption(listName) { var x = document.getElementById(listName); return x.options[x.selectedIndex].text; }

function validateEmail(elementValue) { var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; emailPattern = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b$/;

return emailPattern.test(elementValue); }

function validateSecurityCode(a, b){ var http = new XMLHttpRequest(); var url = "https://www.muslimamericansociety.org/donate/bos/verify.php"; var params = "a=" + a + "&b=" + b; http.open("POST", url, false);

//Send the proper header information along with the request http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes. if(http.readyState == 4 && http.status == 200) { if(http.responseText == "success"){ validSecurityCode = true; }else{ validSecurityCode = false; Recaptcha.reload(); } } }

http.send(params);

if(http.responseText == "success"){ validSecurityCode = true; }else{ validSecurityCode = false; Recaptcha.reload(); } }















First Name Last Name
Email
Phone
Address
City State            Zip

Amount

Card Number Expiration Date

 
Notes
Donate with confidence. This donation form is secure and is SSL certified.