// JavaScript Document

//No-Spam Email script created with Webmaster Tools (webmastertools.sawpit.net)
var showtag="@"
var showlink="Email Us";
var showname="ghellis";
var showhost="pinehurst.net";

//Javascript Code for IMAGE GALLERY
//from DOM Scripting, Ch 6, by Jeremy Keith, published by Friends of Ed
function showPic(whichpic) 
{
  if (!document.getElementById("placeholder")) return false; 
  //should client's browser does not understand js, use html <a> tag "normally"
  var source = whichpic.getAttribute("href");
  //gets information about the link's image location/href
  var placeholder = document.getElementById("placeholder");
  placeholder.setAttribute("src",source);
  //changes the placeholder <a> tag to the href/src of the link, not the placeholder graphic

//BELOW FUNCTIONALITY NOT SUPPORTED BY IE7, SO DELETED!!!
//Below: if the link has a title attibute, use it...
/*  if (whichpic.getAttribute("title")) 
  {
    var text = whichpic.getAttribute("title");
  } 
  else 
  {
    var text = "";  //otherwise, use a null text string
  }

var description = document.getElementById("description");
  if (description.firstChild.nodeType == 3) 
  //text nodes have a node type value =3, confirming that text is the firstChild
  	{
    description.firstChild.nodeValue = text; 
  //puts the link title text into the id=description text
    }
  return false; //return false so that the html <a> tag does not execute normally*/
}


//This function adds the js onclick events to each <a> tag within id=imagegallery list 
function prepareGallery() 
{
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById("imagegallery")) return false;
  if (!document.getElementById("imagegallery")) return false;
  //These top 3 statements say: if browser does not understand js, use html <a> tags "normally"
  var gallery = document.getElementById("imagegallery");
  //within id=imagegallery, take all the <a> tags and add onclick events to them: onclick=function(); return
  var links = gallery.getElementsByTagName("a");
  for ( var i=0; i < links.length; i++) 
  {
    links[i].onclick = function() 
	{
      showPic(this);
	  return false;
	}
  }
}

window.onload = prepareGallery;

