//-----------------------------------------------------------------
// Barry Mann Photography
// ----------------------
// Gallery images
// Created:   10 February 2006
// Copyright: George Mann Publications 2006 ~ post@gmp.co.uk
//-----------------------------------------------------------------
//
//--------------------------------------------------------
// SHOWGALLERYTITLE: Show gallery title
//--------------------------------------------------------
function showgallerytitle () {

  if (location.search == "") {
    location.replace("index.html");
    return;
  }
  else {
    entry = location.search.split('=');
  }

  galleryid = entry[1];
  gallerytitleimage = gallerytitle[(galleryid * 1)];
  entry = gallerytitleimage.split("/");

  document.write("<img src=images\\title-gallery-" + entry[1] + ".jpg border=0>")

}
//
//-----------------------------------------------------
// SHOWGALLERY: Set gallery thumbnail image SRC and ALT
//-----------------------------------------------------
function showgallery () {

  if (location.search == "") {
    location.replace("index.html");
    return;
  }
  else {
    entry = location.search.split('=');
  }

  galleryid = entry[1];
  gallerytitleimage = gallerytitle[(galleryid * 1)];

  startindex = 0;
  entries = 0

  for (i = 1; i < (gallery[0] + 1); i++) {

    entry = gallery[i].split('/');

    if (entry[0] == galleryid) {
      if (startindex == 0) {
        startindex = i;
        entries = i;
      }
      else {
        entries = entries + 1;
      }
    }

  }

  focushtml = "<table border=0 cellpadding=0 cellspacing=0>"

  sequence = 1
 
  for (i = startindex; i < (entries + 1); i++) {

    entry = gallery[i].split('/');

    if (entry[1] == "null") {
      codehtml = "p" + sequence + ".className = \"\";";
      eval(codehtml)
    }

    if (entry[1] != "focus") {

      codehtml = "p" + sequence + ".src = \"galleries/t" + entry[1] + ".jpg\";"
      eval(codehtml)

      codehtml = "p" + sequence + ".alt = \"" + entry[2] + "\";";
      eval(codehtml)

      sequence = sequence + 1;

    }

  }

}
//
//-----------------------------------------------------
// SHOWGALLERYFOCUS: Set gallery focus navigation
//-----------------------------------------------------
function showgalleryfocus () {

  if (location.search == "") {
    location.replace("index.html");
    return;
  }
  else {
    entry = location.search.split('=');
  }

  galleryid = entry[1];
  gallerytitleimage = gallerytitle[(galleryid * 1)];

  startindex = 0;
  entries = 0

  for (i = 1; i < (gallery[0] + 1); i++) {

    entry = gallery[i].split('/');

    if (entry[0] == galleryid) {
      if (startindex == 0) {
        startindex = i;
        entries = i;
      }
      else {
        entries = entries + 1;
      }
    }

  }

//  focushtml = "<table border=0 cellpadding=0 cellspacing=0>"
  focushtml = ""

  sequence = 1
 
  for (i = startindex; i < (entries + 1); i++) {

    entry = gallery[i].split('/');

    if (entry[1] == "focus") {

      if (entry[2] != "") {
        focushtml = focushtml + "<tr valign=top><td colspan=2 height=25 valign=bottom class=topic>" + entry[2] + "</td></tr>";
      }

      if (entry[4].indexOf("?") == -1) {

        focushtml = focushtml + "<tr valign=top><td class=topicnavigation>&#149;</td><td class=topicnavigation><a href=" + entry[4] + ".html>" + entry[3] + "</a></td></tr>";

      }

      else {

        focushtml = focushtml + "<tr valign=top><td class=topicnavigation>&#149;</td><td class=topicnavigation><a href=" + entry[4] + ">" + entry[3] + "</a></td></tr>";

      }

    }

  }

//  document.write(focushtml + "</table>");
  document.write(focushtml);

}
//
//--------------------------------------------------------
// SETCAPTION: Set thumbnail image caption (inline JS code)
//--------------------------------------------------------
function setcaption (captionid) {

  entry = location.search.split('=');
  galleryid = entry[1];

  thisindex = 0;

  for (i = 1; i < (gallery[0] + 1); i++) {

    entry = gallery[i].split('/');

    if (entry[0] == galleryid) {
      thisindex = i + captionid - 1;
      entry = gallery[thisindex].split("/");
      document.write(entry[3]);
      break;
    }
  }

}
