function PopUp (URL,width,height,name) {
    if(width  == null || width  == 0) { width  = "500" }
    if(height == null || height == 0) { height = .6*width }
    if(name   == null) { name   = "PopUp" }
    win = window.open (
	    URL, name,
	    "scrollbars,menubar,resizable," + 
	    "width=" + width + ",height=" + height );
    WinFocus(win);
}
function PopUp90pct (URL,name) {
    // needs work!
    width  = .9 * window.width;
    height = .9 * window.height;
    alert("window.width="+window.width+",  width="+width); // huh???
    PopUp(URL,width,height,name);
}
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' +
	'<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 WinFocus(win) {
    // assume win.focus works, unless 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 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; 2003 NJ Assocation of the UCC.  All rights reserved'+
      '</span>\n'+
      '</td></tr></table></body></html>\n'
    );
    document.close();
}
function TimeStamp(flag) {
    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");
    if(flag==null)
    document.write("<table><tr><td height=12></td></tr></table>\n"+
		   "<hr size=1><center><span class=fineprint>\n"+
		   "<nobr>Page last modified: ");
    document.write(Date);
    if(flag==null)
    document.write("</nobr>\n</span></center>\n");
}

function RadioValue(r) {
    for (i=0;i<r.length;i++){
        if (r[i].checked)
            return r[i].value;
    }
    return "";
}
function Printable(pixdir) {
    if(pixdir == null) { pixdir = "pix" }
    document.write(
	'<table cellpadding=0 cellspacing=0 border=0 '+
	'background="'+pixdir+'/printer18x16sm.gif" bgcolor=white><tr><td><a\n'+
	'href="JavaScript:PopUp(\''+Page+'\',800,600,\'printable\')">'+
	'<img\nsrc="'+pixdir+'/nil.gif" width=18 height=16 border=0\n'+
	'alt=\'Click to pop-up a "Printer-Friendly" version\'>'+
	'</a></td></tr></table>\n');
}
function Print(pixdir) {
    if(pixdir == null) { pixdir = "pix" }
    document.write(
	'<table cellpadding=0 cellspacing=0 border=0 '+
	'background="'+pixdir+'/printer18x16sm.gif" bgcolor=white>'+
	'<tr><td><a\nhref="JavaScript:window.print()">'+
	'<img\nsrc="'+pixdir+'/nil.gif" width=18 height=16 border=0\n'+
	'alt=\'&nbsp;Click to print this frame&nbsp;\'>'+
	'</a></td></tr></table>\n');
}

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

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;
}

var atsign = "@";
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;
}


