/** fix the first name field so it's initial capped */
function subscribe_fixFirstName(aInput) {
if (aInput.value.length > 0) {
aInput.value = aInput.value.substring(0, 1).toUpperCase() + aInput.value.substring(1);
}
}
/** return true if the email address looks valid */
function subscribe_isValidEmail(aEmail) {
if (aEmail.match(/^[.a-zA-Z0-9_-]+\@([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+)$/)) {
return true;
}
return false;
}
/** do the subscription, called when the user clicks the subscribe buton */
function subscribe_doSubscribeClick() {
var myEmail = document.getElementById('subscribe-email').value;
var myGivenname = document.getElementById('subscribe-first-name').value;
var myErrorElement = document.getElementById('subscribe-error-message');
if (!subscribe_isValidEmail(myEmail)) {
myErrorElement.innerHTML = 'This email address does not appear to be valid. Please enter an address such as yourname@example.com
';
return false;
}
else {
myErrorElement.innerHTML = 'processing...';
}
var head = document.getElementsByTagName('head').item(0);
var scriptTag = document.getElementById('subscribe-script');
if(scriptTag) head.removeChild(scriptTag);
script = document.createElement('script');
script.src = 'http://www.scientologytoday.org/subscribe/subscribe_action.vm?action=subscribe&mail=' + escape(myEmail) + '&givenname=' + escape(myGivenname) + '&cacheBreaker=' + (new Date().getTime());
script.type = 'text/javascript';
script.id = 'subscribe-script';
head.appendChild(script);
return false;
}
var myLocation = document.location + "";
var myLocationParts = myLocation.split("://");
var myDomain = myLocationParts[1].split("/")[0];
document.writeln(' ');
document.writeln('
');
document.writeln(' ');
document.writeln('
');