//2004 version Sugar Hill javascript module
var aNumList = new Array(
"8835~The happy blur of bodies in a dance",
"8836~And the dance goes on",
"8837~What the Hey?",
"8838~Reviewing the digital pictures",
"8840~I figure that the curve warning was insufficient",
"8841~A good sentiment",
"8842~A bassist divides the pastoral from the institutional",
"8844~What's the &quot;score&quot;?",
"8845~I wouldn't normally look down on a bassist",
"8846~Can't leave musicians alone for a minute!",
"8847~To weave, perchance to...",
"8848~Clogging: Good for the arteries.",
"8849~Take a step back, 80 times a minute!",
"8850~Lunch is served...",
"8851~... by your busy staff volunteers",
"8852~How many strings does it take?",
"8853~Pickin' and bowin'",
"8855~Take a bow, yoga style",
"8856~Now <b>that's</b> a sandwich,",
"8857~But grapes bring a smile",
"8858~Post prandial discussion groups",
"8859~Ready to check you in",
"8860~Marc holds the professor...",
"8862~...And the mustard",
"8863~Drummers in the shadows",
"8865~Okay, I was fascinated by this prickly spider",
"8867~Any arachnologists know what we're looking at?",
"8868~Taking it easy",
"8869~Low sun gilds the trees...",
"8870~As supper burritos flow",
"8871~Sunday morning Bubbles",
"8872~Looking down the open bubble",
"8873~Bubbles for kids of all ages",
"8874~Sunday Morning Bubble-mania",
"8877~Bubble passing teen on the left",
"8878~Bubble master overhead",
"8879~Bubble master overhead",
"8880~Sunday Morning Bubble-mania",
"8881~Embraceable Bubble",
"8882~Primordial-egg-bubble gets attention",
"8884~Long bubble",
"8885~Longer bubble",
"8888~Playing with light",
"8890~Self portrait",
"8893~Passers-by while some time away",
"8895~As the tables get stowed, some are uncertain about the bubbly environs",
"8896~&quot;Run Away&quot;",
"8896b~&quot;Run Away&quot; Cropped for a better view",
"8899~Birth of a bubble",
"8900~And it grows",
"8901~Sunday Morning Bubble-mania",
"8903~Man beneath a bubbles notice",
"8904~Watching it die",
"8907~Those oblivious &quot;normals&quot;",
"8908~Sunday nearly noon: Last chance snacks"
);

var strPrefix, iMaxImg, iCurrentImg, currentDoc, sourceDoc, imgWin;

function getImgUrl(iNum){
  var aLine = aNumList[iNum].split('~'); //num~cap to 2 place array
  return strPrefix + aLine[0];
}//getImgUrl

function caption(iNum){
  var aLine = aNumList[iNum].split('~'); //num~cap to 2 place array
  return aLine[1];
}//getImgUrl

function findIndex(strFile){ // sort of a complement of getImgUrl()
   var i, strMatch, retVal;
   retVal = 0;
   strMatch = strFile.substr(4, strFile.indexOf('.') - 4); //strip DCP
   for (i=0;i<aNumList.length;i++){
      if (strMatch == aNumList[i]){
         retVal = i;
      }
   }
   return retVal;
}//findIndex()

function wdoContents(i){ // fill currentDoc with image i
    var imgSrc = getImgUrl(i)+".jpg";
    var strCap = caption(i);

    with (currentDoc){
      open();
      write('<html><body><div align="center">');
      write('<a href="javascript:',sourceDoc, '.prevImg();">&lt;&lt; prev</a>');
      write(' -- <b>' + imgSrc + '</b> -- ');
      write('<a href="javascript:',sourceDoc, '.nextImg();">next &gt;&gt;</a>');
      writeln('<p>');
      writeln('<font size="+1">',strCap,'</font><br />');
      write(' <img src="',imgSrc,'" alt="',strCap,'" /><br />',strCap,'</p>');
      write('<p>Copy this link to send the picture to someone:<br />');
      write('<a href="http://www.DanKlarmann.com/SugarHill/2004/index.html#',imgSrc,'" target="_new">');
      write('http://www.DanKlarmann.com/SugarHill/2004/index.html#',imgSrc,'</a></p>');

      write('</div></body></html>');
      close();
      iCurrentImg = i;
    } //endwith
}//wdoContents

function fillWindow(i){ //frames version
  currentDoc = parent.SHWindow.document;
  sourceDoc = 'parent.main';
  wdoContents(i);
}//fillWindow

function showImg(imgNum){ // for fillWindow or showImg
   if (! imgWin){
      imgWin = window.open("", "SHWindow","resizable,scrollbars,status,height=450");
      if (navigator.appName.indexOf('Netscape') >= 0){ // Netscape browser
         imgWin.innerHeight=450;
      }
   } else if (!imgWin.document){
      imgWin = window.open("", "SHWindow","resizable,scrollbars,status,height=450");
      if (navigator.appName.indexOf('Netscape') >= 0){ // Netscape browser
         imgWin.innerHeight=450;
      }
   }

   imgWin.document.open();
   currentDoc = imgWin.document;
   sourceDoc = 'opener';
   wdoContents(imgNum); // fill the new/reused window
   imgWin.document.close();
//   imgWin.location.refresh;
   imgWin.focus();
}//showImg()

function closer(){ // for indexn: if opener closes, so does pop-up
  if (imgWin) {
    imgWin.close();
  }
}

function prevImg(){
  if (iCurrentImg > 0){
    wdoContents(iCurrentImg - 1);
  } else {
    alert("That's All Folks");
  }
}
function nextImg(){
  if (iCurrentImg < iMaxImg){
    wdoContents(iCurrentImg + 1);
  } else {
    alert("That's All Folks");
  }
}

function drawThumbs(){
    var popCode = '<a href="javascript:';
    if (window.name == 'main'){
      popCode += 'fillWindow('; //frames version
    } else {
      popCode += 'showImg('; //pop-up version
    }
    strPrefix = "DCP_";
    iMaxImg = aNumList.length - 1;
    for (var i=0; i<= iMaxImg;i++){
      var url= getImgUrl(i);
      var imgsrc = url+"-t.jpg";
      url += ".jpg"

      document.write(popCode, i, ')" name="',url,'"><img src="',imgsrc,'" border="2" hspace="2" /></a> ');
    }// endfor
    if (parent.document.URL.indexOf('#') >= 0){// start with specific image
      // expecting ...#DCP_xxxxx.jpg
      fillWindow(findIndex(parent.document.URL.substr( parent.document.URL.indexOf('#')+1)));
    }
}//drawThumbs()

