

var mi_url;

var debug1 = 1;

var s_pricol = "Private Collection";
var s_pricom = "Private Commission";
var s_percol = "Personal Collection";
var s_gift   = "Given as Gift";

var textarea_n = "textarea16";


var dw_count  = 0;
var wBR_count = 0;
var wB_count = 0;

var sP_count  = 0;
var eP_count  = 0;
var sDIV_count = 0;
var eDIV_count = 0;
var sTR_count = 0;
var eTR_count = 0;
var sTD_count = 0;
var eTD_count = 0;
var sFONT_count = 0;
var eFONT_count = 0;


// *********************************************************************

function dump_html_counts() {
  if (1) {
	wBR('navigator ' + navigator.appName);
    wBR('DIV ' + sDIV_count + ' ' + eDIV_count);
    wBR('P ' + sP_count + ' ' + eP_count);
    wBR('TR ' + sTR_count + ' ' + eTR_count);
    wBR('TD ' + sTD_count + ' ' + eTD_count);
    wBR('FONT ' + sFONT_count + ' ' + eFONT_count);
  }
}

// *********************************************************************

function dw(s) {
  document.writeln(s);
  dw_count++;
}

// *********************************************************************

function wBR(s) {
  if (s != null) dw(s);
  dw("<BR>");
  wBR_count++;
}

// *********************************************************************

function wB(s) {
  dw("<B>" + s + "</B>");
  wB_count++;
}

// *********************************************************************

function sP(s) {
  dw("<P " + s + ">");
  sP_count++;
}

// *********************************************************************

function eP() {
  dw("</P>");
  eP_count++;
}

// *********************************************************************

function sDIV(s) {
  dw("<DIV " + s + ">");
  sDIV_count++;
}

// *********************************************************************

function eDIV() {
  dw("</DIV>");
  eDIV_count++;
}

// *********************************************************************

function sTR(s) {

  if (s == null) s=' ';

  dw("<TR " + s + ">");
  sTR_count++;
}

// *********************************************************************

function eTR() {
//dw("<TD>zzz</TD>");
  dw("</TR>");
  eTR_count++;
}

// *********************************************************************

function sTD(s) {

  if (s == null) s=' ';

  dw("<TD " + s + ">");
  sTD_count++;
}

// *********************************************************************

function eTD() {
  dw("</TD>");
  eTD_count++;
}

// *********************************************************************

function sFONT(s) {
  dw("<FONT " + s + ">");
  sFONT_count++;
}

// *********************************************************************

function eFONT() {
  dw("</FONT>");
  eFONT_count++;
}

// *********************************************************************

function xx(s) {
 var i = 0;
 var t = '';
 
 if (1) {
   return "&nbsp;spladd(' " + s + " ');";
 } else { 
   while (i <= s.length) {
     t=t + '&nbsp;' + s.substring(i,i+1);
     i+=1;
   }
 }
 return t;
}

// *********************************************************************

var ddd = !false;

function showDebug() {
  if (ddd) return;
  window.top.debugWindow =
      window.open("",
                  "Debug",
                  "left=0,top=0,width=700,height=700,scrollbars=yes,"
                  +"status=yes,resizable=yes");
  window.top.debugWindow.opener = self;
  window.top.debugWindow.document.open();
  var m="<HTML><HEAD><TITLE>Debug Window</TITLE></HEAD><BODY>";
  window.top.debugWindow.document.write(m);
}

// *********************************************************************

function debug(text) {
  if (ddd) return; 
 
  if (window.top.debugWindow && ! window.top.debugWindow.closed) {
    window.top.debugWindow.document.write(text);
  }
}

// *********************************************************************

function d2(text) {
  d(text + '<BR>');
}

// *********************************************************************

var spl = new Array();

function spladd(l) {

  var a = l.split(" ");
  var i = 0;

  while (i < a.length) {

    var s = a[i];
    if (s.length > 0) {
      //dw('adding ' + s);
      spl.push(s);
    }
    i+=1;
  }
}

// *********************************************************************

var ww = new Array();

function addw(w) {

 if (w.length < 1) return;

 // w = w.toLowerCase();
  var i = 0;
  while (i < spl.length) {
    if (spl[i] == w) {
      return;
    }
    i+=1;
  }

  var i = 0;
  while (i < ww.length) {
    if (ww[i] == w) {
      return;
    }
    i+=1;
  }
  ww.push(w);
}

// *********************************************************************

function sp(text) {

  if (text != null) { 
    // dw('<BR>t=' + text);
 
    var t = text.toLowerCase();

    var i=0;
    while (i < 6) {
      t=t.replace("<p>"," ");
      t=t.replace("</p>"," ");
      t=t.replace("<br>"," ");

      t=t.replace("&lsquo;s"," ");
      t=t.replace("&rsquo;s"," ");
      t=t.replace("nbsp"," ");


      t=t.replace("="," ");
      t=t.replace("&"," ");
      t=t.replace("\/"," ");
      t=t.replace("/"," ");
      t=t.replace("."," ");
      t=t.replace(","," ");
      t=t.replace(":"," ");
      t=t.replace(";"," ");
      t=t.replace("!"," ");
      t=t.replace("#"," ");
      t=t.replace("~"," ");
      t=t.replace('"',' ');
      t=t.replace("'"," ");
      t=t.replace("-"," ");
      t=t.replace("+"," ");
      t=t.replace("?"," ");

      t=t.replace("("," ");
      t=t.replace(")"," ");
      t=t.replace("<"," ");
      t=t.replace(">"," ");
      i+=1;
    }
 
     if (0) {   
      dw("<BR>text=" + text);
      dw("<BR>t=" + t);
    }
    var w=t.split(" ");

    var i=0;
    while (i < w.length)
    {
      // dw("<BR>&nbsp;&nbsp;w='" + w[i] + "'");  
      addw(w[i]);
      i+=1;
    }
  }
}

// *********************************************************************

function hideDebug() {
  if (ddd) return;
  if (window.top.debugWindow && ! window.top.debugWindow.closed) {
    window.top.debugWindow.close();
    window.top.debugWindow = null;
  }
}

// *********************************************************************

function toggleDebug() {
  //if (ddd) return;
  if (document.getElementById("debugOn").checked) {
    ddd = false;
    showDebug();
    d2("Check box checked, switched on debug");
    document.getElementById("checkboxLabel").innerHTML = "The debug window is <b>on</b>";
  } else {
    d2("Check box unchecked, switching off debug");
    hideDebug();
    ddd = true;
    document.getElementById("checkboxLabel").innerHTML = "The debug window is <b>off</b>";
  }
}

// ******************************************************************************************************************************* 

  var xc      = -1;

  var xSleep  = xc--;
  var xDup    = xc--;
  var xPrint  = xc--;
  var xDebug  = xc--;
  var xRand   = xc--;
  var xPic1   = xc--;
  var xPic2   = xc--;
  var xBreak  = xc--;
  var xAdd    = xc--;
  var xSub    = xc--;
  var xMovPic = xc--;

  var xMax    = xc + 1;

  var xNames = new Array();

  xNames[xSleep] = 'xSleep';
  xNames[xDup  ] = 'xDup';
  xNames[xPrint] = 'xPrint';
  xNames[xDebug] = 'xDebug';
  xNames[xRand ] = 'xRand';
  xNames[xPic1 ] = 'xPic1';
  xNames[xPic2 ] = 'xPic2';
  xNames[xBreak] = 'xBreak';
  xNames[xAdd  ] = 'xAdd'; 
  xNames[xSub  ] = 'xSub';
  xNames[xMovPic]= 'xMovPic';

  for (i=-1;i >= xMax ;i--) {
    if (xNames[i] == null) {
       alert('xnames at ' + i);
    }
  }

  var cSpell = cAll + 1;

  cNames[cSpell]    ='Spell Checking';

// ******************************************************************************************************************************* 

// ******************************************************************************************************************************* 
  
var tic = 0;

// ******************************************************************************************************************************* 

var clocksize=75

// ******************************************************************************************************************************* 

var schedList = new Array();

var sched_running = !false;

// ******************************************************************************************************************************* 

function toggleSched() {
  if (document.getElementById("SchedOn").checked) {
    sched_running=true;
    d2("Check box checked, sched is running");
    document.getElementById("schedOnMsg").innerHTML = "The sched is <b>running</b>";
  } else {
    d2("Check box unchecked, sched has been stopped");
    sched_running=false;
    document.getElementById("schedOnMsg").innerHTML = "The sched has been <b>stopped</b>";
  }
}

// ******************************************************************************************************************************* 

function sched() {

  tic++;

  if (tic == 5000) {tic=0;}

  if (tic > 200) {toggleSched();}

  document.getElementById('TIC').firstChild.nodeValue = tic;

  if ((tic % 5) == 0) d2("tic=" + tic);

  if (tic >= 1) {
    if (sched_running) if ((tic % 1) == 0) {
      d2('n=' + schedList.length);
      var i;
      for (i=0;i < schedList.length;i++) {
        d2('schedList[' + i+']');
        schedList[i].ex();
      }
      d2('done');
    } else {
      if ((tic % 10) == 0) d2("sched=" + sched_running);
    }
  }
}

// ******************************************************************************************************************************* 

function updatePointers() {

  var now = new Date();
	
  secondsPointer.style.rotation = now.getSeconds() *  6; 
  minutesPointer.style.rotation = now.getMinutes() *  6 + now.getSeconds() / 10;
  hoursPointer.style.rotation   = now.getHours()   * 30 + now.getMinutes() /  2;
}

// ******************************************************************************************************************************* 

if (0)
if (document.all&&window.print){
  window.attachEvent("onload", initVMLClock);
  window.attachEvent("onresize", resizeObjects);
}

// ******************************************************************************************************************************* 

function initVMLClock() {
  resizeObjects();
  updatePointers();
  window.setInterval("updatePointers()", 1000);
  window.setInterval("sched()", 1000);
}

// ******************************************************************************************************************************* 

function resizeObjects() {

  var size = Math.min(clocksize, clocksize);

  clock.style.pixelWidth = size - 2*(size * 0.045);
  clock.style.pixelHeight = size - 2*(size * 0.045);
	
  clock.childNodes.item(0).childNodes.item(0).weight = size * 0.01;

  secondsPointer.childNodes.item(0).childNodes.item(0).weight = size * 0.001;
  minutesPointer.childNodes.item(0).childNodes.item(0).weight = size * 0.002;
  hoursPointer.childNodes.item(0).childNodes.item(0).weight = size * 0.004;	
}

// ******************************************************************************************************************************* 

function toggle(sId) {

  var el = document.getElementById(sId);
	
  el.style.display = (el.style.display == "none") ? "block" : "none";
}

// ******************************************************************************************************************************* 

var woodList = new Array();

function woodType(common,latin,picture,info,caption) {

  this.common=common;
  this.latin=latin;
  this.picture=picture;
  this.info=info;
  this.caption=caption;
  this.id = woodList.length;

  woodList.push(this);
  
  this.link = function() {
    return '<a class=l1 target="woodinfo" href=' + this.info + '><b>' + this.common + '</b> (<i>' + this.latin + '</i>)' + '</a>' ;// '<img src=' + this.picture + ' height=20>';
  }
}
    
// ******************************************************************************************************************************* 

var african_mahogany = new woodType
                (
                  'African Mahogany',
                  'Khaya ivorensis',
                  'http://www.kjpselecthardwoods.com/images/hardwood%20small%20pics/khaya.gif',
                  'http://www.kjpselecthardwoods.com/wood%20pages/african%20mahogany.htm'
                );
                
var bloodwood = new woodType
                (
                  'Bloodwood',
                  'Brosimum rubescens',
                  'http://www.kjpselecthardwoods.com/images/hardwood%20small%20pics/bloodwood.gif',
                  'http://www.kjpselecthardwoods.com/wood%20pages/bloodwood.htm'
                );

var jatoba = new woodType
                (
                  'Jatoba',
                  'Hymenaea courbaril',
                  'http://www.kjpselecthardwoods.com/images/hardwood%20small%20pics/jatoba.gif',
                  'http://www.kjpselecthardwoods.com/wood%20pages/jatoba.htm'
                );
         
var spanish_cedar = new woodType
                (
                  'Spanish Cedar',
                  'Cedrela odorata',
                  'http://www.kjpselecthardwoods.com/images/hardwood%20small%20pics/spanish-cedar.gif',
                  'http://www.kjpselecthardwoods.com/wood%20pages/spanish%20cedar.htm'
                )
                
                
// ******************************************************************************************************************************* 

var pictureList = new Array();

function pictureType(title,url,caption) {

  this.title=title;
  this.url=url;
  this.caption=caption;
  this.id = pictureList.length;
  //this,dim = dim;

//  if (this.dim = null) {
 //   this.dim = 'width= 200';
 // }

  pictureList.push(this);

  d2("picture: id=" + this.id + " title=" + this.title + " u=" +this.url + " cap=" + this.caption);
  
  this.dump = function() {
    for (i=0;i < pictureList.length;i++) {
      d("picture " + i);
    }
  }
}

// ******************************************************************************************************************************* 

function randi(min,max) {
  var i=Math.random();
  var v = i * (max - min) + 1 + min;
  d('i= ',i,' v= ',v);
  return Math.floor (v)
}

// ******************************************************************************************************************************* 

function sleepms(millis) 
{
  date = new Date();
  var curDate = null;

  do { var curDate = new Date(); } 
  while (curDate-date < millis);
} 

// ******************************************************************************************************************************* 

var do_grow = 0;
var mover = "";
var mout  = "";

function grow_image (image_name,n,max,delay) {

  var x = document.images[image_name];

  if (do_grow >= 1) do_grow++;
  
  // window.status = "over " + do_grow;
  
  if (do_grow >= 0) {

    if (x.height < max) {

      if (do_grow > 30)
      if (x.height < 100) {
        x.height += n;
      } else {
        x.height += n;
      }
      var cmd = "grow_image('" + image_name + "'," + n + "," + max + "," + delay + ")"; 
   // x.alt = cmd;
      setTimeout(cmd,delay);
    }
  } else {
     setTimeout(mover,delay);
  }
} 

// ******************************************************************************************************************************* 

function image_on (image_name,pic_name) {

  var x = document.images[image_name];

  var i = x.src.indexOf(pic_name);
  x.alt = x.src + " - " + pic_name + " " + i;

  do_grow = 1;

  if (i == -1) {
    x.height=100;
    x.src=pic_name;
    x.border=30 - 30;
    grow_image(image_name,15,500,50);
  } else { 
  //grow_image(image_name,15,500,50);
  }

  //window.status = "over";
}

// ******************************************************************************************************************************* 

function image_off (image_name,pic_name) 
{ 
  //
  window.status = "out " + do_grow; 
  if (do_grow < 30) {
    do_grow = 0;
  }
}

// ******************************************************************************************************************************* 

function MasterPageType (title) {

  this.title=title;

  this.cclass = -1;

  this.project= new Array();
  
  // *************************************************************************

  this.menuItem0 = function(s,f,n) {
    document.write("<a class=\"menulinks\"");
    document.write ("href=" + f + ".html#top>" + s + "</a><span class='linksdivider'></span>");
    if (this.x != null) {
      dw(this.x);
    }
  }

  // *************************************************************************

  this.menuItem = function(s,f,n,cclass) {

    var xx = "";
    
    if (cclass == this.cclass) {
      document.write("<A class=\"menulinks\"");
      xx = "&#8594;&nbsp;&nbsp;";
    } else {
      document.write("<A class=\"menulinks1\"");
    }

    document.write ("href=" + url1 + f + ".html#top>" + xx +  s + "ERROR </A><span class='linksdivider'></span>");
    document.write

    if (this.x != null) {
      dw(this.x);
    }
  }

  // *************************************************************************

  this.menuItem2 = function(s,f,n,cclass,target) {

    var xx = "";
    var yy = "";

    if (target != null) {
      target = " target= " + target 
    } else {
      target = " ";
    }
    
    if (cclass == this.cclass) {
      document.write("<A class=\"menulinks\"");
      xx = "<FONT SIZE=+1>&#8594;&nbsp;";
      xx = "<FONT SIZE=+1>";
      yy = "</FONT>";
    } else {
      document.write("<A class=\"menulinks1\"");
    }

    document.write ("href=" + f + target + ">" + xx +  s + yy + "</A><span class='linksdivider'></span>");
    document.write

    if (this.x != null) {
      dw(this.x);
    }
  }

  // *************************************************************************

  this.menu = function(n,x) {

    this.x = x;

    if (this.x == null) {
      x="xxx";
    }

    if (parseInt(n) == NaN) {
      n=10;
    }

    if (n == 0) {
      n=20;
    }

    for (i=0;i < n;i++) {
     
      dw("<HR>");

      sFONT("SIZE=+1");
      wB("Projects");
      eFONT();
      dw("<BR><BR>");

      add_mi(n);
      dw("<BR>");
      MasterPage.menuItem2("All Projects",mi_url + "&title=All&class=cAll"          ,n,cAll    );
      MasterPage.menuItem2("Spell Check" ,mi_url + "&title=Spell%20Check&class=cSpell"        ,n,cSpell,"spellcheck");

      wBR();
      dw("<HR>");

      sFONT("SIZE=+1");
      wB("Links");
      eFONT();
      dw("<BR><BR>");
     
      MasterPage.menuItem0("Home&nbsp;/&nbsp;FTAG" ,"http://ftag.org/index", n);  

      MasterPage.menuItem0("Woodworking" ,"http://ftag.org/richardscott/woodwork/woodwork"      ,n);
      MasterPage.menuItem0("Woodturning" ,"http://ftag.org/richardscott/woodturning/woodturning",n);
      MasterPage.menuItem0("Workshop"    ,"http://ftag.org/richardscott/workshop/workshop"      ,n);
      MasterPage.menuItem0("Photography" ,"http://ftag.org/richardscott/photography/photography",n);
      MasterPage.menuItem0("Painting"    ,"http://ftag.org/richardscott/painting/painting"      ,n);
      MasterPage.menuItem0("Plants"      ,"http://ftag.org/richardscott/plants/plants"          ,n);  
      wBR();

      MasterPage.menuItem0("Contacts"     ,"http://ftag.org/contacts"  ,n);
      dw("<A HREF='http://ftag.org:2082/frontend/x/index.html' target='_blank' >Login</A>");
      dw(this.x);
      dw("<A HREF='http://dictionary.reference.com/search?q=richard'>Dictonary</A>");
      dw(this.x);
      dw("<A HREF='http://thesaurus.reference.com/search?q=richard'>Thesaurus</A>");
      dw(this.x);
      dw("<A HREF='http://ftag.org/computer/web_hints.html' target= '_ftag' >Web Hints</A>");
      dw(this.x);

      dw("<BR><BR><BR>");
    }
  }

  // *************************************************************************

  this.lmenu = function() {
    this.menu(1,"<! l >");

    x99();
  }

  // *************************************************************************

  this.pmenu = function() {
    sDIV("class='linksarea'");
    this.menu(1,"<BR>");
    eDIV();
  }

  // *************************************************************************

  this.show_project = function(cclass) {

    for (i=0;i < 2;i++) {
      wBR();
    }

    dw("<A NAME='TOP2'");
    wBR();
    wBR(); 
    sP("CLASS=black50");
    dw(cNames[cclass]); 
    dw("<HR WIDTH=800 COLOR=BLACK ALIGN=LEFT>");      
    eP();

    wBR();
    dw("<P CLASS=BLACK20> Summary </P>");
   
    dw("<UL><TABLE width='130%'>");

    var c = cMax + 10;
    var p;
    for (p=0; p < this.project.length;p++) 
    {  
      pp=this.project[p];

      if ((cclass == pp.cclass) | (cclass == cAll)) {

        sTR("VALIGN='TOP'");

        if (c != pp.cclass) {
          c=pp.cclass;
          sTD("COLSPAN=3 CLASS=BLACK20");
          dw("<HR>");
          wB(cNames[c]);
          eTD();
          eTR();
        }
          
        // blank first field
        sTD("valign='top'");
        dw("&nbsp;");
        eTD();

        // dump title of project
        sTD("width='40%' VALIGN='TOP' CLASS='linkitem'");
        
        //dw("<A HREF='#P" + p + "'>" + pp.title );
        if (pp.marker == null) {
          dw("<A HREF='#P" + p + "'>");
        } else { 
          dw("<A HREF='#" + pp.marker + "'>");
        }
        dw(pp.title);

        if (pp.age < 90) {
          wBR();
          dw("<FONT COLOR=RED SIZE=+3>NEW</FONT>");
        } else if (pp.age < 180) {
          wBR();
          dw("<FONT COLOR=BLUE SIZE=+2>NEWish</FONT>");
        }

        dw("</A>");

        eTD();
        
        var vv = pp.view[0];
        
        sTD();
        if (pp.marker == null) {
          dw("<A HREF='#P" + p + "'>");
        } else { 
          dw("<A HREF='#" + pp.marker + "'>");
        }

        //fix error I suspect a ' in the alt string effects ie but not ff
        if (0) dw("<IMG border=0" 
           + " SRC="     + vv.pic_t.url 
           + " width= "  + 50 
           + " alt= '"   + pp.title + '\n' 
           + " title : " + vv.title + "\n"   
           + " date :  " + pp.date + "\n"
           + " Age : "   + pp.age + " days\n"      
           + "\n"
           + "Click left mouse button to go to project.\n" 
           + "'>"
        );

        if (1) dw("<IMG class='gallery' border=0" 
           + " SRC=" + vv.pic_t.url 
           + " alt= '"   + 'xx' + "' " 
           + " width= " + 50 
        );

        dw("</A>");
        eTD();

        //dw('<TD> eTR </TD>');
        eTR();
      }  
    }   
     
    sTR();
    sTD("COLSPAN=3");
    dw("<HR>");
    eTR();

    dw("</TABLE></UL>");

    var image_num = 0;
    var pclass = cAll;
  
    //dw("<FONT COLOR=gray10>"); 
 
    for (p=0; p < this.project.length;p++) {

      pp=this.project[p];

      if ((cclass == pp.cclass) | (cclass == cAll)) 
      {
     
        // display the name of the project category and put a thick line underneath if it is different from the previous project.
        if (pclass != pp.cclass) {   
          sP("CLASS=black50"); 
          dw(cNames[pp.cclass]);
          dw("<HR width=150% size=14 noshade=true color='#55ff55'>");
          eP(); 
        }

        // place a marker based as pn where n is an integer.
        dw("<A NAME='P" + p + "'>");

        if (pp.marker != null) {  
          dw("<A NAME='" + pp.marker + "'>");
        }

        // display the project title and a medium blue line underneath.
        sP("class=black20"); 
        wB(pp.title);
        dw("<HR ALIGN='LEFT' WIDTH='130%' SIZE='10' NOSHADE=Y COLOR='#5555fff'>");
        eP();


        sDIV("CLASS=pj");
        dw("<B>Date:</B> " + pp.date);
        wBR();

        var t = pp.age / 365;
        wBR("<B>Age:</B> " + pp.age + " days (" + t.toFixed(1) + " years) ");
        if (pp.status != null) {
          wBR("<B>Status:</B> " + pp.status);
        }
        eDIV();       

        if (1) {
          sP();
          dw("<HR ALIGN='LEFT' WIDTH='130%' SIZE='3' NOSHADE=Y COLOR='#050505'>");
          eP();
        }

        
        sDIV("CLASS='pj'"); 
        //sFONT("COLOR=BLACK"); 
        for (t=0;t < pp.text.length;t++) {
          dw(pp.text[t]);
        }     
        //eFONT();   
        sP();
        eP();
        eDIV();
     

     
        var image_name = "image_" + image_num;

        var td = 0;
        var v;
        for (v=0;v < pp.view.length;v++) 
        {
          var vv = pp.view[v];
          dw("<TABLE WIDTH='100%' COLOR=WHITE>");
          sTR("valign=top");
         
          var ii;
          for (ii=0;ii < 2;ii++)
          {
           
            td = v & 1;

            if (ii == td) 
            {
              mover = " onMouseOver=\"image_on('" + image_name + "\','" + vv.pic_l.url + "')\"";
              mout  = " onMouseOut=\"image_off('" + image_name + "\','" + vv.pic_l.url + "')\"";

              mover = " onmouseover=\"this.style.MozOpacity=1;this.filters.alpha.opacity=100\"";
              mout  = " onmouseout=\"this.style.MozOpacity=0.4;this.filters.alpha.opacity=40\"";

              mover = "";
              mout= "";
 
              sTD();
              dw("<A HREF=http://www.ftag.org/cgi-bin/gen_viewimage2.pl?&u=" + vv.pic_l.url + "&title=" + vv.title.replace(/ /g,"%20") + "&h=450&t=8000>");
              dw("<IMG class='gallery' border=0" 
                 + mover 
                 + mout 
                 + " SRC=" + vv.pic_t.url 
                 + " " + vv.dim 
                 + " alt= '" + pp.title + '\n' 
                 + vv.title + "\n" 
                 + "status " + pp.status + "\n"
                 + "status " + vv.status + "\n"
                 + "dim "    + vv.dim + "\n"
                 + "large "  + vv.pic_l.url + "\n"
                 + "thumb "  + vv.pic_t.url + "\n"
                 + "\n"
                 + "Click left mouse button to enlarge in new window.\n" 
                 + "Note: window will close automaticaly after a few seconds\n"
                 + "'>");    
                 dw("</A>");

              eTD();
            } else {
              sTD();

              var t;

              sDIV("CLASS=black20");
              dw(vv.title);
              eDIV();

              if (1) dw("<HR>");

              if (1) { 
                dw("<P ALIGN=RIGHT><FONT SIZE='-1'><A HREF=" + vv.pic_l.url + " class='l1' target='view' >click to view picture</A></FONT></P>");
              }

              if (vv.status != null) {
                dw("<BR> <B>Status: " + vv.status + "</B>");
              }

              //  print the text for the image
              sDIV("CLASS='pj'");
              for (t=0;t < vv.text.length;t++) {
                dw(vv.text[t]);
              } 
              eDIV();
 
              if (vv.thumb == vv.large) {
                sDIV("xCLASS=R5 CLASS='pj'");
                dw("<BR>Note: thumb and large images are the same.");
                eDIV();
              }

              if (0) {
                dw("<P></P>");
                var u;
                var url = vv.pic_l.url;
                for (u=0;u < 1;u++) {            
                  dw("[<A HREF=" + url + "target='view' >view picture</A>]");
                  url=vv.pic_t.url;
                }
              }
     
              for (t=0;t < 10;t++) {
                dw("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
              }
 
              eTD(); 
            }
          }

          eTR();
          dw("</TABLE>");
          pclass = pp.cclass;
        }  

        image_num++;

        dw("<P CLASS= gray10>");
     // dw("Place mouse over image to view in more detail.");  
     // dw("<BR>Click left button while mouse is on image to view in full within the window.");

     // dw("<p>image_name= " + image_name);
     // dw("<P><img border=0 alt= \"" + image_name + "\" name=\"" + image_name + "\" xsrc=\"images/selectanimage1.gif\" height=0 border=0>");

     // document.images[image_name].visibility="hidden";

        if (0) {
          sP("<P CLASS=gray10");   
          dw("<A HREF='#TOP' CLASS=linkitem>");   
            dw("<img border=0 alt= \" back to top \" src=\"http://www.ftag.org/images/b1/button-u.gif\">");
          dw("</A>");
          eP();
        }
      }     
    }






    if (cclass == cSpell) {

      add_all_words();

      dw("<FONT COLOR=BLACK>"); 
      for (p=0; p < this.project.length;p++) {

        pp=this.project[p];

        sp(pp.title);
        sp(pp.date);
        sp(pp.status);
    
        for (t=0;t < pp.text.length;t++) {
          sp(pp.text[t]);
        }           

        var v;
        for (v=0;v < pp.view.length;v++) 
        {
          var vv = pp.view[v];
          
          sp(vv.title);
          sp(vv.status);
              
          for (t=0;t < vv.text.length;t++) {
            sp(vv.text[t]);
          }
          pclass = pp.cclass;
        }       
      } 
   
      dw("<P></P>");
      dw("<h1> Unknown Spelling list<br></h1><HR>");
      ww.sort();
      var i = 0;
      if (1) while (i < ww.length) {

        if (i>0) {
 
          var br = 0;
 
          if (ww[i].substring(0,3) != ww[i-1].substring(0,3) ) { br = 1;}

          if (ww[i].substring(0,1) != ww[i-1].substring(0,1) ) { br = 2;}

          if (br > 0) {
            dw("<br>");
            if (br == 2) {
              dw("<BR>");
            }
          }          
        }
        dw(xx(ww[i]));
        dw('<br>');
        i+=1;
      }

      dw("<H1> Spelling list</H1><HR>");
      spl.sort();
      var i = 0;

      dw('<BR><BR>function add_all_words() {<BR><BR><BR><BR><BR><BR>');

      if (1) while (i < spl.length) {

        if (i>0) {
 
          var br = 0;
  
          if (spl[i].substring(0,3) != spl[i-1].substring(0,3) ) { br = 1;}
 
          if (spl[i].substring(0,1) != spl[i-1].substring(0,1) ) { br = 2;}
            
          if (br > 0) {
            dw("<br>");
            if (br == 2) {
              dw("// ------------------------- <BR><BR>");
            }
          }          
        }

        dw(xx(spl[i]));
        dw('<BR>');
        i+=1;
      }


      dw('<BR><BR>}<BR>');
      dw("</FONT>"); 
    }
    

    sP("CLASS=gray10");
      dw("End of Page");   
      dw("<A NAME='bottom'>");
    eP();

    for (i=0;i<30;i++) {
      wBR();
    }

    dump_html_counts();
  
     
    if (0) for (property in MasterPage) document.write(property+' has the value '+ MasterPage[property]+'<BR>');
stayTopLeft();
  }  

// *********************************
// *********************************

  this.show = function() {
      

    var cclass = -9;
    var toc = 0;

    var xxxr=0;
    var xxxc=-1;

    var p;
    for (p=0; p < this.project.length;p++) {
 
      xxxc++;
      if (xxxc > 4) {
        xxxr++;
        xxxc=0;
      }

      pp=this.project[p];

      if (cclass != pp.cclass) {
        dw("<P CLASS=B20>" + cNames[pp.cclass]); 
        dw("<HR CLASS=B14 WIDTH=1200 ALIGN=LEFT>");     

        if (toc % 2 == 1) {
          toc++;
        }

        var tocr = toc >> 1;
        cclass = pp.cclass;
        document.getElementById('ID_c'+tocr).firstChild.nodeValue=cNames[pp.cclass] + ":";
      }

      var tocid = "tocid" + toc++;

      document.getElementById(tocid).firstChild.nodeValue=pp.title;
     
      dw("<A NAME='" + tocid + "'>");
      dw("<BR><BR>");
      dw("<TABLE WIDTH='80%'>");
      dw("<TR><TD>" + pp.title);
      dw("<TR><TD xWIDTH='40%'>");
      dw("<TR><TD COLSPAN=" + pp.view.length+1 + "><HR ALIGN='LEFT' WIDTH='100%' ROWSPAN=3>");
      dw("<TR><TD CLASS=f10>" + pp.date);
      dw("<TR><TD VALIGN='TOP'>");
      dw("<DIV CLASS=f9>");
      for (t=0;t < pp.text.length;t++) {
        dw(pp.text[t]);
      }   
      dw("</DIV>");

      pp.slideShow = new threadType('ss' + p,'xxx');
      //var r= randi(1,10);

      var v;
      for (v=0;v < pp.view.length;v++) {
        var vv = pp.view[v];
        dw("<TD>");    
        
        pp.slideShow.add_cmds([xxxr,xxxc,picBlack1.id,xPic2,3,6,xRand,xSleep]);
        pp.slideShow.add_cmds([xxxr,xxxc,0,10,xRand,xPic2,3,6,xRand,xSleep]);
        pp.slideShow.add_cmds([xxxr,xxxc,vv.pic_t.id,xPic2,4,xSleep]);
  
        dw("<A HREF=" + vv.pic_l.url + ">");
        dw("<IMG SRC=" + vv.pic_t.url + " height= " + 100 + " alt= '" 
            + vv.pic_t.url + '\n' + pp.title + '\n' + vv.title + pp.status + vv.status + "\nClick to enlarge' " + ">")    
        dw("</A>");

        if (vv.thumb == vv.large) {
          dw("<P CLASS=R5>Need Thumb</P>");
        }
      }  
      dw("</TABLE>");
      pp.slideShow.sleep=2*p % 6;
      schedList.push(pp.slideShow);
    }
  }  
}
 
var MasterPage;

// ******************************************************************************************************************************* 

function d(s) {
  debug(s);
}

function wx(n) {

  if (n >= 0) {
    debug(n);
  } else {
    if (xNames[n] != null) {
      debug(xNames[n]);
    } else {
      debug('wx??=');
      debug(n);
    }
  }
  debug(",");
}

function wxa(t) {
  debug('<br>&nbsp;&nbsp;&nbsp;&nbsp;');
  for (i=0;i < t.length;i++) { 
    wx(t[i]);
    if (t[i] == xBreak) {
      debug('<br>&nbsp;&nbsp;&nbsp;&nbsp;'); 
    }
  }
  debug('<BR>')
}


function days_since(date) {
  // xxx

  var d = date;

  
  d=d.replace("0s","0");
  d=d.replace("/"," ");
  d=d.replace("~"," ");  

  var a = d.split(" ");

//  dw('date= ' + date + " = " + d + '<BR>');
  var i = 0;
  var dd = 0;
  var yyyy = 1970;
  while (i < a.length) {

    var s = a[i];
    if (s.length > 0) {
    //dw('date? ' + s +'<BR>');
      if (!isNaN(s)) {
         yyyy=s * 1;
      }

      if (s == 'January') {
        dd = 0*31;
      }
      if (s == 'February') {
        dd = 1*31;
      }
      if (s == 'March') {
        dd = 2*31;
      }
      if (s == 'April') {
        dd = 3*31;
      }
      if (s == 'May') {
        dd = 4*31;
      }
      if (s == 'June') {
        dd = 5*31;
      }
      if (s == 'July') {
        dd = 6*31;
      }
      if (s == 'August') {
        dd = 7*31;
      }
      if (s == 'September') {
        dd = 8*31;
      }
      if (s == 'October') {
        dd = 9*31;
      }
      if (s == 'November') {
        dd = 10*31;
      }
      if (s == 'December') {
        dd = 11*31;
      }      
      

      if (s == 'Winter') {
        dd = 1*31;
      }
      if (s == 'Spring') {
        dd = 4*31;
      }
      if (s == 'Summer') {
        dd = 7*31;
      }
      if (s == 'Fall') {
        dd = 10*31;
      }
    }
    i+=1;
  }

  //dw("dd= " + dd + " yyyy= " + yyyy + "<BR>");
  var age = dd + 365*(yyyy - 1970);

  var today = new Date();

  //return age;

  
  age = (today.getFullYear()-1970)*365 + (today.getMonth()*31) - age;

  if (age < 0) {
    age = 0;
  }

  return age;
}

// ******************************************************************************************************************************* 

function threadType(title,addr) {

  this.title = title;
  this.addr  = addr;

  this.stack = new Array();

  for (i=0;i < 100;i++) {
    this.stack[i] = 0;
  }
  this.tos = 0;

  this.cmds = new Array();

  this.pc = 0;
  this.sleep = 0;
  
  this.add_cmds = function(t) {
    d(this.title);
    d(": adding cmds: ");
    
    for (i=0;i < t.length;i++) {
      this.cmds.push(t[i]);
    };
    wxa(t);
    d('<BR>');
  }

  this.dump = function() {
    d(this.title + ": dump " + this.cmds.length);
    wxa(this.cmds);
  } 

  this.pop = function() {
    this.tos--;
    var x = this.stack[this.tos];
    return x;
  } 
  
  this.push = function(x) {
    this.stack[this.tos++] = x;
  } 

  this.ex = function() {

    if (this.sleep > 0) {
      d2('sleeping ' + this.sleep);
      this.sleep--;
      return;
    } else {
      this.sleep = 0;
    }

    d2('ex ' + this.title);
    d2('pc=' + this.pc);

    for (i=0;i < 100;i++) {
      d('pc=' + this.pc + " ");

      var c = this.cmds[this.pc];

      wx(c);
      d2('  ');

      this.pc++;
      this.pc = this.pc % this.cmds.length;

      if (c >= 0) {
        this.push(c);
      } else {

        if (c == xBreak) {
          this.tos = 0;
          return;
        } else if (c == xSleep) {
          var p1 = this.pop();
          if (p1 > 0) {
            this.sleep = p1 - 1;
            return;
          }
        } else if (c == xDebug) {
          d2('stack ' + this.tos + " " + this.stack[this.tos]);
          var i;
          for (i=0;i < 10;i++) { 
            d2('stack ' + i + " " + this.stack[i]);
          }
        } else if (c == xPic2) {
          var p1 = this.pop();
          var p2 = this.pop();
          var p3 = this.pop();
          d2('xPic2 ' + p1 + ', ' + p2 + ', ' + p3);
      
          var name = this.addr + p3 + p2;

          var ximg= document.getElementById(name);
          //if (tic > 20) dw('p1 = ',p1);
          if (p1 < 0) {p1=-p1};
          if (ximg != null) {
            if (p1 < pictureList.length) {
              ximg.src = pictureList[p1].url;
              ximg.alt = pictureList[p1].title;
            }
          }
        } else if (c == xAdd) {
          var p1 = this.pop();
          var p2 = this.pop();
          this.push(p1 + p2);
        } else if (c == xSub) {
          var p1 = this.pop();
          var p2 = this.pop();
          this.push(p1 - p2);
        } else if (c == xRand) {
          var p1 = this.pop();
          var p2 = this.pop();
          this.push(randi(p1,p2));
        }
      }    
    }
  }
} 

// ******************************************************************************************************************************* 

function ViewType(title,url,thumb,large,dim) {
  this.title = title;
  this.url   = url;
  this.thumb = thumb;
  this.large = large;
  this.text  = new Array();
  this.status= null;
  this.dim   = dim;

  if (this.dim == null) {
    this.dim = 'width= 200';
  }

  if (0) if (thumb == large) {
    dw('same images for view ' + title + "<BR>\n");
  }
  
  this.pic_t = new pictureType(title,url + '/' + thumb,title);
  this.pic_l = new pictureType(title,url + '/' + large,title);
}

// ******************************************************************************************************************************* 

function ProjectType(title,date,cclass) {

  this.t0 = function(s) {
    if (this.view.length == 0) {
      this.text.push(s);
    } else {

      var v = this.view[this.view.length - 1];

      v.text.push(s);
    }
  }

  this.a = function(s) {
    this.t0(s);
  }

  this.link = function(url,name) {
    this.t0("<A CLASS='l1' HREF='" + url + "'>" + name + "</A>");
  }

  this.t = function(s) {
    
    //this.t0('</BLOCKQUOTE>');
    //this.t0('<BLOCKQUOTE>');
    this.t0("<P><IMG SRC='http://ftag.org/images/b1/blue30x30.gif' width='5px'>&nbsp;");
    this.t0('&nbsp;');
    this.t0(s);
  }

  this.t1 = function(s) {
    this.t0(s);
  }

  this.ss = function(url,aux) {

    if (aux == null) {
      aux='';
    }
    this.t("Watch the following ");
    this.t0("<A class='l1' HREF='http://ftag.org/cgi-bin/s7.php?&c=3&u=" + url + aux + "' TARGET='SS'>Slide Show</A>");  
    this.t0("for more pictures.");
  }

  this.v = function(name,url,pic,dim) {
    this.view.push(new ViewType(name,url,pic + "t.jpg",pic + "l.jpg",dim));  
  }

  this.vd = function(name,url,pic,dim) {
    this.view.push(new ViewType(name,'http://ftag.org/images',"blankimage.jpg","blankimage.jpg ",dim));  
  }

  this.v1 = function(name,url,pic,dim) {
    this.view.push(new ViewType(name,url,pic,pic,dim));  
  }

  this.dim = function(s) {
    if (this.view.length == 0) {
      this.dim = s;
    } else {
      var v = this.view[this.view.length - 1];
      v.dim = s;
    }
  }
  
  this.s = function(s) {
  //dw(this.title + " " + s + "<BR>\n");
    if (this.view.length == 0) {
      this.status = s;
    } else {
      var v = this.view[this.view.length - 1];
      v.status = s;
    }
  }
  
  this.pricom = function() {this.s(s_pricom);} 
  this.pricol = function() {this.s(s_pricom);}
  this.percol = function() {this.s(s_percol);}
  this.percom = function() {this.s(s_percol);}
  this.sold   = function() {this.s("Sold");}
  this.gift   = function(s) {this.s("Gift" + s);}
  this.forSale= function(s) {this.s("For Sale" + s);}

  this.help = function() {
    this.t("Help");
    this.t("p.t(s)");
    
    this.t("p.dim(d)");
    
    this.t("p.pricom()");
    this.t("p.pricol()");
    this.t("p.percol()");
    this.t("p.percom(s)");
    this.t("p.sold()");
    this.t("p.gift(s)");
    this.t("p.forSale(s)");
  }
  
  if (date == null) {
    date="Unknown";
    alert('no date for ' + title);
  }

  if (cclass == null) {
    cclass=cMisc;
    alert('no class for ' + title);
  }

  this.title = title;
  this.date  = date;
  this.cclass= cclass;
  this.view  = new Array();
  this.text  = new Array();
  this.status= null;  

  this.age = days_since(date);

  this.marker = null;
}

// ******************************************************************************************************************************* 

function xinit1()
{

  MasterPage = new MasterPageType("Richard Taggart Scott");
}

function xinit2()
{

  MasterPage = new MasterPageType("Richard Taggart Scott");

  dw("<xUL><UL>");  
  dw("<TABLE VALIGN=TOP>");
  dw("<TR><TD WIDTH='40%' VALIGN=TOP>");

  dw("<TABLE VALIGN=TOP>");
  dw("<TR><TD COLSPAN=3 ALIGN=Left CLASS=B14>Contents");

  var tocid=0;
  for (row=0;row < 25;row++) 
  {
    dw("<TR><TD CLASS=B10 ID=ID_C"+row+">&nbsp;");
    var a = "right";

    a="left";
    for (col=0;col < 2;col++) 
    {
      var id="tocid" + tocid++;
      dw("<TD CLASS=f10 ALIGN='" + a + "'><A HREF=#" + id + ">&nbsp;<SPAN ID="+id+">" + "&nbsp;" + "</SPAN></A>");
      p++;
      a = "left";
      a="right";
    }  
    dw("</TR>");
  }

  dw("</TABLE>");

  dw("<TD><TABLE VALIGN=TOP>");
 
  for (row=0;row < 6;row++) 
  {
    dw("<TR>");
    for (col=0;col < 5;col++) 
    {
      dw("<TD><img id=xxx",row,col," border=0 src=\"misc/black1.jpg\" height=90 width=70 alt='pic' >");
    }  
    dw("</TR>");
  }
  dw("</TABLE>");

  dw("</TABLE>");
  dw("</UL></xUL>");

}

// ******************************************************************************************************************************* 

  showDebug();
  xinit1();

// ******************************************************************************************************************************* 

function x99()
{
  if (!document.layers) {
    dw('<div id="divStayTopLeft" style="position:absolute">')
  }

  var n = 0;
  
  {
    var p;
    for (p=0; p < MasterPage.project.length;p++) 
    {  
      pp=MasterPage.project[p];

      if (MasterPage.cclass == pp.cclass)  {
        n++;
      }
    }  
  }
  
  dw('<layer id="divStayTopLeft">');
  dw('<table border="1" width="150" cellspacing="0" cellpadding="5">');
  dw('<tr>');
  dw('  <td width="100%" bgcolor="#FFAFCC">Menu '+ n +'</td>');
  dw('</tr>');
  dw('<tr>');
  dw('    <td width="100%" bgcolor="#FFFFFF">');
  dw('      <a class=menu1 href="#top">Top</a>');


  if (0) {
    dw(MasterPage.project.length);
    dw(MasterPage.cclass);
  }

  
  
  {
    var p;
    for (p=0; p < MasterPage.project.length;p++) 
    {  
      pp=MasterPage.project[p];

      if (MasterPage.cclass == pp.cclass)  {
        if (pp.marker == null) {
          dw("<A HREF='#P" + p + "'>");
        } else { 
          dw("<A HREF='#" + pp.marker + "'>");
        }
       
        var vv = pp.view[0];
        
        var h = 50;
        
        if (n > 10) h = 30;
        
        if (n > 20) h = 20;

        dw("<IMG class='gallery' border=2" 
           + " SRC=" + vv.pic_t.url 
           + " name='"   + pp.title + "' "  
           + " alt= '"   + pp.title + "' " 
           + " height= " + h 
           + ">"
        );
        
        //dw("&nbsp;"+pp.title);
        dw("</A>");
      }
    }  
  }

  dw('      <a class=menu1 href="#bottom">Bottom</a>');
  dw('  </tr>');
  dw('</table>');
  dw('</layer>');

  if (!document.layers) {
    document.write('</div>')
  }

  JSFX_FloatTopDiv();
}

//Enter "frombottom" or "fromtop"
var verticalpos="frombottom"

verticalpos='fromtop';


function JSFX_FloatTopDiv()
{
  var startX = 3,
  
  startY = 550;
  startY = 20;
  
  var ns = (navigator.appName.indexOf("Netscape") != -1);

  var d = document;

  function ml(id)
  {
    var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];

    if (d.layers) el.style=el;

    el.sP=function(x,y){this.style.left=x;this.style.top=y;};
    el.x = startX;
    if (verticalpos=="fromtop")
      el.y = startY;
    else {
      el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
      el.y -= startY;
    }
    return el;
  }

  window.stayTopLeft=function()
  {
    if (verticalpos=="fromtop"){
        var pY = ns ? pageYOffset : document.body.scrollTop;
            
            ftlObj.y += (pY + startY - ftlObj.y)/8;
    } else {
            var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;

            ftlObj.y += (pY - startY - ftlObj.y)/8;
    }

    ftlObj.sP(ftlObj.x, ftlObj.y);
    setTimeout("stayTopLeft()", 25);
  }

	ftlObj = ml("divStayTopLeft");
	// stayTopLeft();
}




  

