function closeWin(){;
	this.window.close;
}
function replaceParagraph(){
	
	var mainPic = document.getElementById("placeholder");
		//process the file "src" file name to make it more friendly to read for uses
		var picSrc = mainPic.getAttribute("src");
		var getFullName = picSrc.split("/");//use the "/" character to mark the split point into an array
		var getName = getFullName[1].split(".");
	/*	var newName = document.createTextNode(getName[0]);*/
		
	var container = document.getElementById("divContainer");
	var paras = document.getElementById("replaceMe");	
	alert(paras);
	var newPara = document.createElement("p");

	newPara.setAttribute("id","replaceMe");
	var text = document.createTextNode(getName);
	newPara.appendChild(text);
	container.replaceChild(newPara, paras);

	return false;
}
function showPic(whichpic) {
  if (!document.getElementById("placeholder")) return true;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("placeholder");
  placeholder.setAttribute("src",source);
  if (!document.getElementById("description")) return false;
  if (whichpic.getAttribute("title")) {
    var text = whichpic.getAttribute("title");
  } else {
    var text = "";
  }
  var description = document.getElementById("description");
  if (description.firstChild.nodeType == 3) {
    description.firstChild.nodeValue = text; 
  }
  return false;
}

function prepareGallery(){ 
/**********  the ususal tests to make sure methods and ids are in place  ******************/
	if (!document.getElementsByTagName) {
		return false;
	}

	if (!document.getElementById) {
		return false;
	}
	if (!document.getElementById("thumbNav")){
		return false;
	}

//**********set up the links by attaching a function literal ***************/
var gallery = document.getElementById("thumbNav");
var links = gallery.getElementsByTagName("a");
for (var i=0; i < links.length; i++){
		links[i].onclick = function() {
		//send an object from prepgallery function(src attribute etc) to the showPic function
		return false;	
		}
	links[i].onmouseover = function() {
		//send an object from prepgallery function(src attribute etc) to the showPic function
			
		
		showPic(this);
		
		var mainPic = document.getElementById("placeholder");
	
		//set up the PARENT DIV CONTAINER so the child elements can be manipulated
		//first check if the current pages has the <div id="divContainer"> node there, otherwise forget this section!
		if(document.getElementById("divContainer")){
			//get the "src" file name attribute to make it more friendly to read for uses
			var picSrc = mainPic.getAttribute("src");
			var getFullName = picSrc.split("/");//use the "/" character to mark the split point into an array
			var getName = getFullName[1].split(".");
			var finalName = getName[0];
			var container = document.getElementById("divContainer");
			
			//IF A DYNAMIC LABEL IS NEEDED THEN CHECK FOR THE "replaceMe" paragraph, IF SO INSERT THE LABEL, IF NOT SKIP THIS SECTION
			if (!document.getElementById("replaceMe")){
				return false;
			}
			var oldText = document.getElementById("replaceMe");
			var newPara = document.createElement("p");
			var newName = document.createTextNode(finalName);
			/*var test = document.createTextElement("this is a test");*/
			/*var myText = document.getElementById("text");*/
			newPara.appendChild(newName);
			newPara.setAttribute("id","replaceMe");
			container.replaceChild(newPara,oldText);
			}

			//stop the default a link behavior
			return false;
		}
	}
}

function addLoadEvent(func){
var oldOnLoad = window.onload;
if (typeof window.onload != 'function'){
	window.onload = func;
}else{
	window.onload = function(){
		oldOnLoad();
		func();
		}
	}
}

addLoadEvent(prepareGallery);