function loadframes() {
    var loc = location+"";
    var page = loc.replace(/.*pages[/]/,"pages/");
    if(loc == page) page = page.replace(/.*[/]/,"");
//    alert("loadframes: page="+page);
    if (top == self) {
        var s = 'index.html?page='+page;
	if(page.match(/[/]/)) s = "../"+s;
//	alert("Settiong location = "+s);
	location = s;
    }
}

function checkframes(fm) {
    var cf  = fm.src+"";
    var loc = location+"";
    cf      = cf.replace(/#.*/,"");
    loc     = loc.replace(/#.*/,"");
//    alert("cf = "+cf+"\nloc="+loc);
    if(cf.match(/home.html/) && loc.match(/home.html/)) return;
    if(!cf.match(/home.html/)) return;
    if(loc.match(/page=[^ ]/) && cf.match(/home.html/)) {
	var page = loc.replace(/.*page=/,"");
//	alert("page = "+page);
	loc = loc.replace(/[?].*/,"");
//	alert("NEW loc="+loc);
//	location = loc;
//	alert("NEW fm.src="+page);
	fm.src = page;
//	Obj('contentframe').src = page;
    } else {
	loc = loc.replace(/[#?].*/,"");
//	alert("location = "+location+"\n NEW loc="+loc);
	if(loc != location) location= loc;
    }
}
function showprops(el) {
    var s = "";
    var n;        
    var i=0;
    for(n in el) {
        var v = el[n]+"";                
        var nv = n+"="+v;
        if(!v.match(/function|[A-Z][A-Z][A-Z]/)) {
          if(!n.match(/[A-Z][A-Z][A-Z]/)) {
            if(1 || nv.match(/color/i)) {    
              if(v != "") {
                if((++i)%2 == 0)
                  s += "\n";
                else
                  s += ", ";
                s += n+"='"+v+"'";
              }
            }
          }
        }
    }
    return s;
//    alert("Properties: "+s);
}


//////////////////////////////////////////////////////


function Obj(Id) { return document.getElementById(Id); }

function PopUp (URL,width,height) {
    if(width  == null) { width  = "500" }
    if(height == null) { height = .6*width }
    win = window.open (
	    URL, "PopUp",
	    "scrollbars,menubar,resizable," + 
	    "width=" + width + ",height=" + height );
    WinFocus(win);
}
function WinFocus(win) {
    // assume win.focus works, unless its a broken old msoft browser
    if ( (navigator.appName.search (/^microsoft/i) == -1) ||
         (navigator.appName == "Microsoft Internet Explorer" &&
          navigator.appVersion.indexOf("Windows", 0) != -1   &&
          navigator.appVersion.substring(0,1) >= 4) ) {
		win.focus()
    }
}
function Help(content,width,height) {
    if(width  == null) { width  = "500" }
    if(height == null) { height = .6*width }
    iwin = window.open (
            "", "Help",
            "scrollbars,menubar,resizable," +
            "width=" + width + ",height=" + height );
    doc = iwin.document;
    doc.writeln('<html>\n<head>\n<title>Help</title>\n' +
//        '<SCRIPT LANGUAGE="JavaScript" SRC="scripts.js" ></SCRIPT>\n' +
//        '<LINK REL=StyleSheet TYPE="text/css" HREF="styles.css" >\n' +
	'<style>\n' +
	'pp, .pp { font-size:9pt; font-family: arial, sans-serif;\n' +
	'color: #002000; margin-top:6pt; margin-bottom:.0001pt; }\n' +
	'</style>\n' +
	'</head>\n<body bgcolor="#EFE7D0" peachpuff class=pp>\n' + content +
	'\n<hr><form><center>' +
	'<input type=button onclick="window.close()" value="&nbsp;ok&nbsp;">' +
	'</center></form>\n</body>\n</html>');
    doc.close();
    WinFocus(iwin);
}
function RadioValue(r) {
    for (i=0;i<r.length;i++){
        if (r[i].checked)
            return r[i].value;
    }
    return "";
}
function clearall(choice) {
    for (i=0;i<choice.length;i++){
        choice[i].checked = false;
    }
    return false;
}
function checkall(choice) {
    for (i=0;i<choice.length;i++){
        choice[i].checked = true;
    }
    return false;
}

function FinePrint(pixdir) {
    if(pixdir == null) { pixdir = "pix" }
    document.write( 
      '<hr>\n'+
      '<a href="#_top">'+
      '<img src="' + pixdir + '/ptr-up.gif" border=0 width=16 height=9></a>\n'+
      '<br><span style="font-family:arial narrow,helvetica narrow,'+
      'sans-serif;font-size:9pt;color:#889888;'+
      'margin-top:0pt;margin-bottom:.0001pt">\n'
    );
    TimeStamp();
    document.write( 
      '<br>\n'+
      'Copyright &copy; 2001 Christ Church, Summit NJ.  All rights reserved'+
      '</span>\n'+
      '</td></tr></table></body></html>\n'
    );
    document.close();
}
function TimeStamp(pfx) {
    if(pfx == null) { pfx = "Page last modified: " }
    Date = " " + document.lastModified;
    Date = Date.replace(/([A-Z][a-z]{2})[a-z]*/g,"$1");
    Date = Date.replace(/:\d\d($|[^\d:])/g,"$1");
    Date = Date.replace(/\//g," / ");
    Date = Date.replace(/ 0/g," ");
    Date = Date.replace(/ ([0-9]+:)/," &nbsp;-&nbsp; $1");
    document.write("<nobr>" + pfx + Date + "</nobr>\n");
}


var clickCount = 1;
function PreviousPage() {
    // alert("clickCount =" + clickCount); // debug
    if (clickCount > 1) history.go(-clickCount); else history.back();
    // Usage: <a href="#xxx" onClick="cc()">xxx</a> etc. ...
    //        [ <a href="JavaScript: PreviousPage()">back</a> ]
}
function cc() {
    clickCount++;
}

var holdmailto, listmailto, nchosenmailto, maxallowedmailto;
function mto(who,where,dom,show,opt,ux) {
    if(opt  == null) opt  = "";
    if(dom  == null) dom  = "";
    if(show == null) show = "";
    if(ux   == null) ux   = "";
    if(dom.match(/^(pbz|bet|rqh|arg|tbi|hf)$/)) {
	dom   = rt(dom);
	who   = rt(who);
	where = rt(where);
	show  = rt(show);
	ux    = rt(ux);
    }
    if(dom != ""   ) dom = "."+dom;
    var em = who+"@"+where+dom;
    if(show == ""  ) show = em;
    if(opt != ""   ) opt = " "+opt;
//    ux = "(ux:"+ux+")"; // DEBUG
    var s= '<'+'a hr'+'ef="mai'+'lto'+':'+em+ux+'"'+opt+'>'+show+'</a>';
    document.write(s);
//    alert(s);
}
var abc = "abcdefghijklm@.- nopqrstuvwxyz#:=,".split("");
var nbc = new Object();
for(var i=0; i<34; i++) nbc[abc[i]] = i;
function rt(s) {
    var y = "";
    for(var i=0; i<s.length; i++) {
        var C = s.substr(i,1);
        var c = C.toLowerCase();
        var x = abc[(nbc[c]+17)%34];
        if(c != C) x = x.toUpperCase();
        if(x != "" && x != null) y += x
        else  y += C;
    }
    return y;
}
var at = "@";
function sb(s){
var r=/\[([0-9A-F]{2})\]/g;s=s.replace(r,'%$1');
document.write(unescape(s))}             
