// hardacker.com, Andy Hardacker, 2001-2002
// javascript for cats pix
if (document.images) {
  // preload
  loading_image = new Image(83, 80);
  loading_image.src = "../images/cats/cat-0.gif"; 
  // set up the array of cats...   
  var catCount = 41; 
  var cats = new Array(catCount+1);  
  for (j=1;j!=catCount+1;j++)
  {
    cats[j] = new Object();
    cats[j].thumbon = new Image(50,50);
    cats[j].thumbon.src = "../images/cats/thumb-on-" + j + ".gif";
    cats[j].thumboff = new Image(50,50);
    cats[j].thumboff.src = "../images/cats/thumb-off-" + j + ".gif";
    // don't preload these
    //cats[j].pic = new Image();
    //cats[j].pic.src = "images/cats/cat-" + j + ".jpg";  
    cats[j].src= "../images/cats/cat-" + j + ".jpg";
  }
  // now add the captions...
  cats[1].text = "<p>Hans, the first Dorchester cat, was discovered on a Brookline street on New Year's Day, 1980.</p><p>(b. 0ct 1979, d. 15 Feb 1998)</p>";
  cats[2].text = "<p>Gunther spent the summer of 1980 on our front porch. We had no choice but to bring him inside in the fall.</p><p>(b. 1979, d. 1995)</p>";
  cats[3].text = "<p>Rollo (the orange-and-white longhair napping with Gunther) was first seen as a tiny kitten eating out a tin can in a heap of garbage in Codman Square. My late partner Michael swore that Rollo just followed him home. Rollo apparently thought his nightly dinner rations might end at any moment - he ate anything in sight.</p><p>(b. Spring 1983, d. 2 Dec 2000)</p>";
  cats[4].text = "<p>Pablo was also a tiny kitten when he showed up in the yard. He grew into something like a miniature Shetland pony. Gunther, who thought himself quite photogenic, pushed himself into this picture.</p><p>(Pablo d. 1992)</p>";
  cats[5].text = "<p>Potter, the new kid. She looks innocent here - caught mid-pedicure - but the next day she ate most of the aloe plant behind her (with no apparent ill effects).</p><p>(b. May 2000)</p>";
  cats[6].text = "<p>Potter turned up in the yard (do you notice a trend?) wearing a pink collar. No one claimed her so we took her in as company for 17-year-old Rollo. He would have preferred a catnip mouse.</p>";
  cats[7].text = "<p>Not a great photograph but the only one we have with the entire Gang of Four in one place.</p>";
  cats[8].text = "<p>Hans, Rollo and Pablo. Gunther was probably at my feet, trying to get picked up.</p><p>December 1992</p>";
  cats[9].text = "<p>L.C. and Hanc.</p><p>(L.C. b. September 1974, d. January 1992)</p>";        	    
  cats[10].text = "<p>Tubitha and Chloe <p>Tubitha adopted at age three in 1976 d. July 1994</p><p>Chloe b. Fall 1981 d. April 1997</p>";
  cats[11].text = "<p>In front, Frog, a blue-point Siamese. Behind him is Simi, a lynx-point, and on the right, Mehitabel, a tabby.</p><p> August 1989</p>";
  cats[12].text = "<p>The Harold, showing off his stunning tiger stripes.</p><p>Harold died 9 February 2002</p>";
  cats[13].text = "<p>Rollo on vacation on Martha's Vineyard. \"Tell Socks I can't come out and play now.\"</p>";
  cats[14].text = "<p>Frog and Chloe</p>";        	    
  cats[15].text = "<p>Amazing Grace, Harold's sister</p>";
  cats[16].text = "<p>Ziegfeld</p>";
  cats[17].text = "<p>Ziegfeld with Zorba the Vizla</p>";
  cats[18].text = "<p>Oscar, truly a glamor puss.</p>";
  cats[19].text = "<p>Mehitabel</p>";
  cats[20].text = "<p>Jennyanydots</p>";
  cats[21].text = "<p>Don Gatto in his favorite sleeping position doing some light reading.</p>";
  cats[22].text = "<p>Polly basking in the sun. \"I wish they'd buy me a sofa.\"</p><p>Polly and Don Gatto were adopted from the <a href=\"http://www.treehouseanimals.org/\" target=\"_blank\" title=\"Treehouse Animal Foundation\">Treehouse&nbsp;Animal&nbsp;Foundation</a> in Chicago in March, 2000.</p>";
  cats[23].text = "<p>Golden-eyed Emma</p>";
  cats[24].text = "<p>Libby, also known as Miss Liberty.</p>";
  cats[25].text = "<p>Leo (for Aldo Leopold) was known as George in another life.</p>";
  cats[26].text = "<p>Abe, Erin's first cat.</p>"; 
  cats[27].text = "<p>Erg</p><p>(b. 4 Dec 1985 d. May 1991)</p>";
  cats[28].text = "<p>Hans's second-favorite game (after \"push the tchotchke off the table\") was \"pull off the eyeglasses\".</p>";
  cats[29].text = "<p>Hanc and Hitty, a black lab, up to no good. It's all Hanc's doing; Hitty was sweet but not the sharpest knife in the drawer.</p>";
  cats[30].text = "<p>Ruhig, our first dog. Fortunately he came along before the photographer William Wegman began putting up his Weimaraners in costumes, so we never tried to dress Ruhig up for photographs. \"Ruhig\", which we pronounced <b>roo</b>-igg</b>, is German for \"calm\".</p><p><p>(Summer 1966)</p>";
  cats[31].text = "<p>Tubitha, the Persian cat, usually got a crew cut for summer. She doesn't look pleased.</p>";
  cats[32].text = "<p>Hanc, a Tonkinese, was our first cat. All Hardacker cats are indoor cats and Hanc seems shocked at being outside.</p><p>b. February 1971 d. November 1985</p>";  
  cats[33].text = "<p>Rollo and Gunther, who had quite a noble profile.</p>";
  cats[34].text = "<p>Potter loose in the garden before she was adopted.</p><p>The plants are (l. to r.) Geranium \"Ann Folkard\", Salvia \"Purple Rain\", Heuchera \"Plum Pudding\", lamb's ears, and, in the back, Hosta \"Sum and Substance\"</p><p>(July 2000)</p>";
  cats[35].text = "<p>The demon inside.</p>";
  cats[36].text = "<p>Potter relaxing.</p>";
  cats[37].text = "<p>Potter-in-a-bag</p>";
  cats[38].text = "<p>Dick, Keith's long-haired white cat of long ago. He was stone deaf, but survived as an outdoor cat to his late 'teens.</p><p>(ca. 1935)</p>";
  cats[39].text = "<p>I couldn't resist another picture of Oscar's blue eyes.</p>";
  cats[40].text = "<p>Mehitabel using Oscar as a pillow.</p>";
  cats[41].text = "<p>Leo inside, Mona and Grendel outside. And, thinks Leo, all's right with the world.</p><p>Mona, the Scottish terrier, died 11 October 2001 at the age of 13. After a unhappy start in life, she was adopted when she was four and spent nine wonderful years on the farm in Iowa.</p>";
}  
function getImageObject(id, in1, in2) {
  if (document.getElementById) {
    return document.getElementById(id);
  }
  if (document.all) {
    return eval("document.all." + id);
  }
  if (document.layers) {
    // for old Netscape, have to include all containing layers 
    // (the NEW divs may cause problems here)
    var outer = "";
    if (in1) { outer  = "document.layers." + in1 + "."; }
    //if (!in2) in2 = id+"DIV";
    if (in2) { outer += "document.layers." + in2 + "."; }
//alert("outer = " + outer);    
    return eval(outer + "document.images['"+id+"']");     // ." + id)
  }
  return null;
}
function flip(index, onoff) {
  if (document.images) {
    var oThumb = getImageObject("thumb" + index, "catMenu");
    oThumb.src = eval("cats[index].thumb"+onoff+".src");
   // alert("thumb title >"+thumb.title+"<");  
    window.status = (onoff == "off") ? "" : (typeof oThumb.alt == "undefined" || oThumb.alt == "") ? (typeof oThumb.title == "undefined" || oThumb.title == "") ? "Pick me!" : oThumb.title : oThumb.alt;
  }
  return true;
}
function showPhoto(index) {
  if (document.images) {
    if (document.getElementById || document.all) {
      var photo = getImageObject("thePhoto"); //, "container", "drag");
      // show "loading" image
      photo.border = 0;
      photo.src = loading_image.src;
      // show image
      photo.border = 1;
      photo.style.border = "1px solid black";
      photo.src = cats[index].src; 	  
      // display text
      if (document.getElementById) {  
        document.getElementById('photoText').innerHTML = cats[index].text;
      } else if (document.all) {
        document.all.photoText.innerHTML = cats[index].text;
        document.all.photoText.style.visibility = 'visible';
      }
    } else if (document.layers) {
      // all this for old NN
      var s = '<img src="'+cats[index].src+'" border="1" alt=""/><div id="photoText" name="photoText">'+cats[index].text+'</div>';
      //alert("s=" + s);
      document.layers['drag'].document.open();
      document.layers['drag'].document.write(s);
      document.layers['drag'].document.close();
    }
  }
  return false;
}
function setDrifterPosition() { 
  if(!isNN4) return;
  var leftPos = 300; // need to calculate right coord of table and add 15
  drifter.left = leftPos;
}
// this is hacked to get xhtml to validate, although this is probably just as bad.
function hackImages() {
/*
  var thumbs = document.images;
  var count = thumbs.length;
  for (var i=0;i<count;i++) {
    if (thumbs[i].id.indexOf("thumb" == 0) {
      thumbs[i].border="0";
      thumbs[i].name=thumbs[i].id;
    }
  }
*/  
}
