// JavaScript Document
//script for running clock//
function getthedate(){
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate=dayarray[day]+", "+montharray[month]+" "+daym+ "," +year+""
document.getElementById("time").innerHTML=cdate
}
function goforit(){
setInterval("getthedate()",1000)
}
//script for redirecting to homepage if going to update the wrong way//
function notallowed() {
alert('You did not get to this page properly...You are being redirected to our homepage');
(window.location.replace('http://rechurch.org/'))
}
function done(a){
var root="/recus/?MIval=/recus/";
var page= a;
window.location.replace(root + page + ".html");
}
function err(a){
a.submit()
}
function log(a) {
document.log.type.value=a;
document.log.submit();
}
function display_on(area){
document.getElementById("dioceses").style.display="none";
document.getElementById("foundations").style.display="none";
document.getElementById("interest").style.display="none";
document.getElementById("links").style.display="none";
document.getElementById(area).style.display="inline";
}
function display_off(){
document.getElementById("dioceses").style.display="none";
document.getElementById("foundations").style.display="none";
document.getElementById("interest").style.display="none";
document.getElementById("links").style.display="none";
}
function link_hover(a) {
document.getElementById(a).style.background="#990000";
}
function link_release(a) {
document.getElementById(a).style.background="none";
}
function mass_report() {
if (document.synod.mass.checked==true) {
document.synod.MIval.value="/recus/synod_mass.html" }
else { document.synod.MIval.value="/recus/synod_reports2.html"}
}
function override() {
document.update.override.value="yes";
document.update.submit();
}
function delegate_number() {
var a = document.vitals.communicants.value;
var b = document.getElementById("delegate1");
var c = document.getElementById("delegate2");
var d = document.getElementById("delegate3");
var e = document.getElementById("alternate1");
var f = document.getElementById("alternate2");
var g = document.getElementById("alternate3");
var h = document.getElementById("message");
if (a ==13) {
b.style.display="none";
c.style.display="none";
d.style.display="none";
e.style.display="none";
f.style.display="none";
g.style.display="none";
h.style.display="block";
}
else
if (a==100) {
b.style.display="block";
c.style.display="none";
d.style.display="none";
e.style.display="block";
f.style.display="none";
g.style.display="none";
h.style.display="none";
}
else
if (a=="200") {
b.style.display="block";
c.style.display="block";
d.style.display="none";
e.style.display="block";
f.style.display="block";
g.style.display="none";
h.style.display="none";
}
else
if (a=="300") {
b.style.display="block";
c.style.display="block";
d.style.display="block";
e.style.display="block";
f.style.display="block";
g.style.display="block";
h.style.display="none";
}
}
//script for the initial state of the 'mail is same as physical' checkbox//
function mailsame() {
if (document.update.paddr1.value==document.update.maddr1.value
&& document.update.paddr2.value==document.update.maddr2.value
&& document.update.pcity.value==document.update.mcity.value
&& document.update.pstate.value==document.update.mstate.value
&& document.update.pzip.value==document.update.mzip.value){
document.update.same.checked=true;
}
}
//script for validating update form on update page//
function update_validate() {
escapeVal(document.update.notes,'
');
if (document.update.new_pwd.value != document.update.pwd_confirm.value){
alert('You did not enter the same password twice');
document.update.new_pwd.focus();
return false
}
if (document.update.church_name.value.length >50){
alert('Your church name cannot be longer than 50 characters');
document.update.church_name.focus();
return false
}
if (document.update.church_name.value.length <1){
alert('Your church name cannot be empty');
document.update.church_name.focus();
return false
}
if (document.update.paddr1.value.length >50){
alert('Line 1 of your physical address cannot be longer than 50 characters');
document.update.paddr1.focus();
return false
}
if (document.update.paddr2.value.length >50){
alert('Line 2 of your physical address cannot be longer than 50 characters');
document.update.paddr2.focus();
return false
}
if (document.update.pcity.value.length >30){
alert('Your physical city cannot be longer than 30 characters');
document.update.pcity.focus();
return false
}
if (document.update.pstate.value ==""){
var state=confirm('Are you sure you want a blank physical state?\nPress OK to Continue or\nPress Cancel to change state');
if (state == false)
{document.update.pstate.focus();
return false}
}
if (document.update.pzip.value.length >5){
alert('Your Physical Zip Code cannot be more than 5 numbers');
document.update.pzip.focus();
return false
}
if (document.update.maddr1.value.length >50){
alert('Line 1 of your mailing address cannot be longer than 50 characters');
document.update.maddr1.focus();
return false
}
if (document.update.maddr2.value.length >50){
alert('Line 2 of your mailing address cannot be longer than 50 characters');
document.update.maddr2.focus();
return false
}
if (document.update.mcity.value.length >30){
alert('Your mailing city cannot be longer than 30 characters');
document.update.mcity.focus();
return false
}
if (document.update.mstate.value ==""){
var state=confirm('Are you sure you want a blank mailing state?\nPress OK to Continue or\nPress Cancel to change state');
if (state == false)
{document.update.mstate.focus();
return false}
}
if (document.update.mzip.value.length >5){
alert('Your Mailing Zip Code cannot be more than 5 numbers');
document.update.mzip.focus();
return false
}
if (document.update.contact.value.length >50){
alert('Your Contact Name cannot be more than 50 characters');
document.update.contact.focus();
return false
}
if (document.update.email.value.length >50){
alert('Your Email Address cannot be more than 50 characters');
document.update.email.focus();
return false
}
if (document.update.web.value.length >100){
alert('Your web address cannot be more than 100 characters');
document.update.web.focus();
return false
}
if (document.update.web.value.toLowerCase().match("http")){
alert('Please, do not enter http to begin your web address');
document.update.web.focus();
return false
}
if (document.update.notes.value.length >255){
alert('Your Notes section cannot contain more than 255 characters');
document.update.notes.focus();
return false
}
return true
}
//script for validating registration page//
function vitals_validate() {
if (document.vitals.month.value.length <2|document.vitals.month.value.length >2){
alert('Please enter a 2 digit month');
document.vitals.month.focus();
return false;
}
if (document.vitals.day.value.length <2|document.vitals.day.value.length >2){
alert('Please enter a 2 digit day');
document.vitals.day.focus();
return false;
}
if (document.vitals.yr.value.length <4|document.vitals.yr.value.length >4){
alert('Please enter a 4 digit year');
document.vitals.yr.focus();
return false;
}
if (document.vitals.month.value <1|document.vitals.month.value >12){
alert('Please enter a valid month');
document.vitals.month.focus();
return false;
}
if (document.vitals.day.value <1|document.vitals.day.value >31) {
alert('Please enter a valid day');
document.vitals.day.focus();
return false;
}
if (document.vitals.month.value == '02'){
if (document.vitals.day.value >29) {
alert('Please enter a valid day for February');
document.vitals.day.focus();
return false;
}
}
if (document.vitals.baptized.value.length <1) {
alert('You must enter how many baptized members your parish has');
document.vitals.baptized.focus();
return false;
}
if (document.vitals.communicants.value.length <1){
alert('You must report how many communicant members your parish has');
document.vitals.communicants.focus();
return false;
}
if (document.vitals.confirmations.value.length <1) {
alert('You must report how many confirmations your parish had since the last Council');
document.vitals.confirmations.focus();
return false;
}
if (document.vitals.additions.value.length <1) {
alert('You must report how many additions there have been in your parish since the last Council');
document.vitals.additions.focus();
return false;
}
if (document.vitals.losses.value.length <1){
alert('You must report how many losses there have been in your parish since the last Council');
document.vitals.losses.focus();
return false;
}
if (document.vitals.income.value.length <1){
alert('You must report your income during the last Calendar Year');
document.vitals.income.focus();
return false;
}
}
function reg_validate() {
if (document.reg.type.value.length <1){
alert('You must select a Type');
document.reg.type.focus();
return false
}
if (document.reg.type.value=='Bishop' | document.reg.type.value=='Presbyter' | document.reg.type.value=='Deacon'){
if (document.reg.ss.value.length <1 | document.reg.ss.value.length >6)
{
alert('You must enter the Last 6 digits of your SSN');
document.reg.ss.focus();
return false
}
}
if (document.reg.first.value.length <1 | document.reg.first.value.length >50){
alert('You must enter a First Name');
document.reg.first.focus();
return false
}
if (document.reg.middle.value.length >1){
alert('Please enter only 1 letter for your Middle Initial');
document.reg.middle.focus();
return false
}
if (document.reg.last.value.length <1 | document.reg.last.value.length >50){
alert('You must enter a Last Name');
document.reg.last.focus();
return false
}
if (document.reg.maddr1.value.length <1 | document.reg.maddr1.value.length >50){
alert('You must enter an Address');
document.reg.maddr1.focus();
return false
}
if (document.reg.maddr2.value.length >50){
alert('You must enter an Address');
document.reg.maddr1.focus();
return false
}
if (document.reg.mcity.value.length <1){
alert('You must enter a City');
document.reg.mcity.focus();
return false
}
if (document.reg.mstate.value.length <1){
alert('You must select a State');
document.reg.mstate.focus();
return false
}
if (document.reg.mzip.value.length <5 | document.reg.mzip.value.length >5){
alert('You must enter a 5 digit Zip Code');
document.reg.mzip.focus();
return false
}
if (document.reg.acode.value.length <3 | document.reg.acode.value.length >3){
alert('You must enter a 3-digit Area Code');
document.reg.acode.focus();
return false
}
if (document.reg.exc.value.length <3 | document.reg.exc.value.length >3){
alert('You must enter a 3-digit Exchange');
document.reg.exc.focus();
return false
}
if (document.reg.pnumber.value.length <4 | document.reg.pnumber.value.length >4){
alert('You must enter 4 digits to end your Phone Number');
document.reg.pnumber.focus();
return false
}
if (document.reg.reports.value.length <1){
alert('Please select whether this person will need Council Reports');
document.reg.reports.focus();
return false
}
if (document.reg.tlunch.value.length <1){
alert('Please answer all Questions concerning Meals');
document.reg.tlunch.focus();
return false
}
if (document.reg.banquet.value.length <1){
alert('Please answer all Questions concerning Meals');
document.reg.banquet.focus();
return false
}
if (document.reg.flunch.value.length <1){
alert('Please answer all Questions concerning Meals');
document.reg.flunch.focus();
return false
}
}
function ssn(){
if (document.reg.type.value=='Bishop'| document.reg.type.value=='Presbyter' | document.reg.type.value=='Deacon')
{
document.getElementById("ssn").style.visibility='visible';
document.getElementById("ssn1").style.visibility='visible';
document.reg.ss.value='';
}
else
{
document.getElementById("ssn").style.visibility='hidden';
document.getElementById("ssn1").style.visibility='hidden';
document.reg.ss.value='na';
}
}
function office_date() {
if (document.pastors.office.value=='bishop'){
document.pastors.bishop_date.disabled=false;
document.pastors.bishop_date.value='mm/dd/yyyy';
document.pastors.presbyter_date.disabled=false;
document.pastors.presbyter_date.value='mm/dd/yyyy';
document.pastors.deacon_date.disabled=false;
document.pastors.deacon_date.value='mm/dd/yyyy';
}
if (document.pastors.office.value=='presbyter'){
document.pastors.bishop_date.disabled=true;
document.pastors.bishop_date.value='Not Applicable';
document.pastors.presbyter_date.disabled=false;
document.pastors.presbyter_date.value='mm/dd/yyyy';
document.pastors.deacon_date.disabled=false;
document.pastors.presbyter_date.value='mm/dd/yyyy';
}
if (document.pastors.office.value=='deacon'){
document.pastors.bishop_date.disabled=true;
document.pastors.bishop_date.value='Not Applicable';
document.pastors.presbyter_date.disabled=true;
document.pastors.presbyter_date.value='Not Applicable';
document.pastors.deacon_date.disabled=false;
document.pastors.deacon_date.value='mm/dd/yyyy';
}
if (document.pastors.office.value=='deaconess'){
document.pastors.bishop_date.disabled=true;
document.pastors.bishop_date.value='Not Applicable';
document.pastors.presbyter_date.disabled=true;
document.pastors.presbyter_date.value='Not Applicable';
document.pastors.deacon_date.disabled=true;
document.pastors.deacon_date.value='Not Applicable';
}
}
function parish_details(a) {
var box = "box_" + a;
var what = "detail_" + a;
if (document.getElementById(what).style.display=="none")
{
document.getElementById(what).style.display="block";
document.getElementById(box).src = "/recus/?MIval=/recus/opened_box.jpg";
}
else
{
document.getElementById(what).style.display="none";
document.getElementById(box).src = "/recus/?MIval=/recus/closed_box.jpg";
}
}
function parish_search() {
if (document.state.state.value == '')
{alert('You must select a State before Searching');
return false}
else
{document.state.submit();
}
}
function broken_link() {
alert('We have not been provided with a working address for this link');
}
//script for unencoding the notes textarea - to visually show breaks within form textarea//
function unescapeVal(notes){
for(i=0; i','%0D%0A')
}
document.update.notes.value=unescape(document.update.notes.value)
}
//script for encoding the notes textarea - formats for database entry//
function escapeVal(notes,replaceWith){
document.update.notes.value = escape(document.update.notes.value)
for(i=0; i -1){
document.update.notes.value=document.update.notes.value.replace("%0D%0A",replaceWith)
}
else if(document.update.notes.value.indexOf("%0A") > -1){
document.update.notes.value=document.update.notes.value.replace("%0A",replaceWith)
}
else if(document.update.notes.value.indexOf("%0D") > -1){
document.update.notes.value=document.update.notes.value.replace("%0D",replaceWith)
}
}
document.update.notes.value=unescape(document.update.notes.value)
}
//scripts for autoresizing height of main-content//
var iframeids=["maincontent"]
//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"
//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i