function popitup(url)
{
	newwindow=window.open(url,'name','toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=640,top=40,left=40');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popitupsmall(url)
{
	newwindow=window.open(url,'name','toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=480,top=40,left=40');
	if (window.focus) {newwindow.focus()}
	return false;
}


// JavaScript Document
function prepareGallery (){
  //will attach event handlers to the thumbnail gallery
  //when link is clicked.... make server request for text.... and change source for the placeholder img
  //turn off defualt behavior of the link
  if(!document.getElementById) return false;
  if(!document.getElementsByTagName) return false;
  if(!document.getElementById("img_list")) return false;
  var gallery = document.getElementById("img_list");
  var hooks = gallery.getElementsByTagName("a");
  for(var i = 0; i< hooks.length; i++){
  	hooks[i].onclick = function(){
          showPic(this);
          return false;
      }
  }
}

function showPic(whichpic){
  if(!document.getElementById("place_holder")) return false;
  var source = whichpic.getAttribute("href");
  var placeholder = document.getElementById("place_holder");
  placeholder.setAttribute("src",  source);
}

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

addLoadEvent(prepareGallery);
