// -------------------------------------------------------------
// JavaScript to sequence through images "images\nancy#.jpg"
// -------------------------------------------------------------
// nancy1.jpg is the first image (variable 'count' is initialized to 1).
// Likewise, blog1.htm is the blog text for the first comic.
//
// Set variable "count" inside function "init" to the comic you want displayed
// first by default.
//
// The variable 'maxPic' sets the name of the last image.
// You can specify which strip number to go to by putting the number
// after the URL, e.g. comicmain.htm?7  will display strip number 7.

maxPic = 72;


count = 1;
// beginning and end of the "object tag" statement replaced by innerHTML method:
objbeg='<object class="blogfield" data=';
objend='></object>';

function init() {
  count=location.search.substr(1);
   if (count === '') {
// Set default comic:
     count = maxPic;  // latest comic, or
//   count = 1;        // a specific comic
     }
img_src="images/nancy" + count + ".jpg";
document.getElementById("comic_img").src=img_src;
txt_src="blog" + count + ".htm";
document.getElementById("blogbox").innerHTML=objbeg + txt_src + objend;
}

function first() {
count = 1;
img_src="images/nancy" + count + ".jpg";
document.getElementById("comic_img").src=img_src;
txt_src="blog" + count + ".htm";
document.getElementById("blogbox").innerHTML=objbeg + txt_src + objend;
}

function last() {
count = maxPic;
img_src="images/nancy" + count + ".jpg";
document.getElementById("comic_img").src=img_src;
txt_src="blog" + count + ".htm";
document.getElementById("blogbox").innerHTML=objbeg + txt_src + objend;
}

function next() {
count++;
  if (count > maxPic) {
  count = maxPic;
  }
img_src="images/nancy" + count + ".jpg";
document.getElementById("comic_img").src=img_src;
txt_src="blog" + count + ".htm";
document.getElementById("blogbox").innerHTML=objbeg + txt_src + objend;
}

function back() {
count--;
  if (count === 0) {
  count = 1;
  }
img_src="images/nancy" + count + ".jpg";
document.getElementById("comic_img").src=img_src;
txt_src="blog" + count + ".htm";
document.getElementById("blogbox").innerHTML=objbeg + txt_src + objend;
}

// ------------------------------------------------------
// JavaScript to change arrows on mouseover and mouseout
// ------------------------------------------------------
// 'dir' is the id of the image to change, e.g. first, back, next, last
// It also doubles as the beginning of each arrow graphic's name
// The xxxxx_h.jpg is the highlighted version.

function mover(dir) {
img_src="images/" + dir + "arrow_h.jpg";
document.getElementById(dir).src=img_src;
}

function mout(dir) {
img_src="images/"+ dir + "arrow.jpg";
document.getElementById(dir).src=img_src;
}
