<!-- hide JavaScript from non-JavaScript browsers

var selectedDotNum = 0;
var totalImages = 0;
var imageDir = "";

function initPage(theDir) {

  var dots = getDots();
  totalImages = dots.length;
  for(var i=0; i<dots.length; i++) {
    var dot = dots[i];
    dot.style.border = 0;
  }

  var thumb = document.getElementById("thumbimg");
  thumb.style.visibility = "hidden";

  imageDir = theDir;

/*  for(var i=0; i<dots.length; i++) {
	var img = new Image();
	img.src = "http://lewisthecat.com/images/"+imageDir+"/thumbs/"+i+".jpg";
  }
  */

  showImg(1);
}

function showNext() {
  var nextNum = selectedDotNum+1;
  if(nextNum > totalImages)
    nextNum = 1;

  showImg(nextNum);
}

function showPrev() {
  var prevNum = selectedDotNum-1;
  if(prevNum < 1)
    prevNum = totalImages;

  showImg(prevNum);
}

function getDots() {
  var container = document.getElementById("dots");
  return container.getElementsByTagName("img");
}

function getDot(dotNum) {
  return document.getElementById("dot_"+dotNum);
}

function showThumb(imgNum) {
  var thumb = document.getElementById("thumbimg");
  
  thumb.src = "http://lewisthecat.com/images/"+imageDir+"/thumbs/"+imgNum+".jpg";
  thumb.style.visibility = "visible";
  thumb.style.left = (imgNum-1)*17;
  thumb.style.position = "relative";
}

function hideThumb() {
  var thumb = document.getElementById("thumbimg");
  thumb.style.visibility = "hidden";
}

function showImg(imgNum) {

  if(selectedDotNum == imgNum)
    return;

  var oldDot = getDot(selectedDotNum);
  if(oldDot != null && oldDot.src)
    oldDot.src = "http://lewisthecat.com/images/dot.gif";

  var dot = getDot(imgNum);
  dot.src = "http://lewisthecat.com/images/activedot.gif";

  var div = document.getElementById("container");
  var imgPath = "http://lewisthecat.com/images/"+imageDir+"/images/"+imgNum+".jpg";
  div.style.backgroundImage = "url(" + imgPath + ")";
  div.style.backgroundRepeat = "no-repeat";
  div.style.backgroundPosition = "center 4px";

  selectedDotNum = imgNum;
}

// -->

