function showPic(whichpic) {

  if (!document.getElementById("placeholder")) return true;
  
  var source = whichpic.getAttribute("href");
  
  var placeholder = document.getElementById("placeholder");
 
  placeholder.setAttribute("src", source);
  
  window.location.hash="picjump";
  
  if (!document.getElementById("placeholder_description")) return false;
  
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  
  var description = document.getElementById("placeholder_description");
  
  description.innerHTML = text;
  
  //if (description.firstChild.nodeType == 3) {
    //alert(text);
    //description.firstChild.nodeValue = text;
  //}
  
  return false;
  
}

function nextPicture()
{
    img = document.getElementById('sshow_img');
    txt = document.getElementById('sshow_text');
    
    if (ss_current < ss_max)
    {
        ss_current++;
    }
    else
    {
        ss_current = 0;
    }
    
    temp = slideshow[ss_current];
    
    img.src = temp[1];
    txt.innerHTML = "Photo: " + temp[0];
    t = setTimeout("nextPicture()", 5000);
}

function runSlideshow()
{
    //  Set a timeout
    t = setTimeout("nextPicture()", 5000);
}

function prepareGallery() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("imagegallery")) return false;
  var gallery = document.getElementById("imagegallery");
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) {
    links[i].onclick = function() {
      return showPic(this);
    }
    links[i].onkeypress = links[i].onclick;
  }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(prepareGallery);

