function p(s) { document.write(s+"\n"); }

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function TimeStamp(pfx) {
    if(pfx == null) { pfx = "<nobr>Last modified:</nobr>" }
    document.write(pfx+" <nobr>" + document.lastModified + "</nobr>\n");
//    var 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(pfx+" <nobr>" + Date + "</nobr>\n");
}

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

////////////////// do we need this stuff???  :


function nav4GetLayerById(id) {
  return nav4FindLayer(this, id);
}

function nav4FindLayer(doc, id) {
  var i;
  var subdoc;
  var obj;
  for (i = 0; i < doc.layers.length; ++i) {
    if (doc.layers[i].id && id == doc.layers[i].id)
    return doc.layers[i];
    subdoc = doc.layers[i].document;
    obj = nav4FindLayer(subdoc, id);
    if (obj != null) {
      return obj;
      }
  return null;
  }
}

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

var at = "@";

if(document['getElementById'] == null) {
  if (navigator.family == 'ie4' && navigator.version < 5) {
    document.getElementById = new Function("id", "return document.all[id];");
    }
    else if (navigator.family == 'nn4') {
      document.getElementById = nav4GetLayerById;
    }
}
function Obj(id) {
// defines function Obj()
    return document.getElementById(id);
}

function PopUp(URL,width,height,opts) {
    var winName = "PopUp"+Math.floor(10000*Math.random());
    var win = NewWin(URL,winName,width,height,opts);
    WinFocus(win);
}
function NewWin(URL,winname,width,height,opts) {
    if(width  == null || width  == 0) { width  = 500; }
    if(height == null || height == 0) { height = .6*width; }
    if(opts   == null ) { opts   = ""; }
    if(opts   == "all") { opts = "status=1,location=1,navigation=1,toolbar=1"; }
    if(opts   != ""   ) { opts   = "," + opts; }
    if(!winname) winname = "newwin";
    // line 89
    // line 90
    // line 91
    URL += ""; winname += ""; width += 0; height += 0; opts += "";
    opts = "width="+width+", height="+height+",scrollbars,menubar,resizable"+opts;
    winname = winname.replace(/[^a-z0-9]+/gi,"_");  // IE dislikes "." in winname!
//    alert("URL=("+URL+")  winname=("+winname+")  opts=("+opts+")");
    var newwin = window.open(URL, winname, opts);
/*    win.creator = window;  // Not allowed by Firefox -- Due to security? */
    WinFocus(newwin);
    return newwin;
}
function WinFocus(win) {
//    alert("WinFocus("+win+")"); return; // DEBUG
    // 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()
    }
//    else { win.focus() }
}

function Help(content,width,height) {
    if(width  == null) { width  = "500" }
    if(height == null) { height = .6*width }
    winName = "Help"+Math.floor(10000*Math.random());
    hwin = window.open(
	    "", winName,
	    "scrollbars,menubar,resizable," +
	    "width=" + width + ",height=" + height );
    doc = hwin.document;
    doc.writeln('<HTML>\n<HEAD>\n<TITLE>Help</TITLE>');
    doc.writeln('<style>');
    doc.writeln('td, .td, p, .p, pp, .pp {');
    doc.writeln('margin-bottom:0.0001pt; margin-top:3.0pt;');
    doc.writeln('font-family:arial,sans-serif;font-size:9.0pt; }');
    doc.writeln('b9, .b9 {');
    doc.writeln('font-family:arial,sans-serif;font-size:9.0pt;');
    doc.writeln('font-weight:bold; }');
    doc.writeln('</style>');
    doc.writeln('</HEAD>');
    doc.writeln('<BODY BGCOLOR="#EFE7D0" CLASS=pp><FORM>\n');
    doc.writeln(content);
    doc.writeln('\n<HR><CENTER><SPAN class=b9>');
    doc.writeln('<INPUT TYPE=button ONCLICK="window.close()" VALUE="&nbsp;ok&nbsp;" class=b9>');
    doc.writeln('</SPAN></CENTER></FORM>\n</BODY>\n</HTML>\n');
    doc.close();
    WinFocus(hwin);
}

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

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++;
}
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 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;
}
function sb(s){
var r=/\[([0-9A-F]{2})\]/g;s=s.replace(r,'%$1');
document.write(unescape(s))}


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+"'";
	      }
	    }
	  }
	}
    }
    alert("Properties: "+s);
}

