var oldSrc;
var preload = new Array();
function preloadimages() {
	/*
	pre-load a highlighted version 
	of each "nav_" image
	*/
	var num = document.images.length;
	var img,posn,temp,orig,newsrc;

	for(var i = 0; i<num; i++) {
		img = document.images[i].src;
		posn = img.indexOf("left_nav");
		if(posn > -1 && img.indexOf("_lit")< 0){
			dot = img.lastIndexOf(".");
			temp = img.substr(dot,img.length);
			orig = img.substr(0,dot);
			newsrc = orig + "_lit" + temp;
			//alert(newsrc);
			preload[i] = new Image();
			preload[i].src = newsrc;
		}//if
	}//for
 }

function getSrc(n){
    	img = n.toString();
         eval("n = document." + img + ".src");
         if(n.indexOf("_lit")< 0){
		 //alert(n.indexOf("_lit"));
                 dot = n.lastIndexOf(".");
                 temp = n.substr(dot,n.length).toString();
                 orig = n.substr(0,dot).toString();
                 newsrc = orig + "_lit" + temp;
                 newsrc = newsrc.toString();
				 //alert(newsrc);
         return newsrc;
         }
        else{return n;}
 }

function swap(imgname) {
      			  n = arguments[0].toString();
                  eval("oldSrc = document." + n + ".src");
				 // alert(oldSrc);
                  old =
				   n;
                  eval("document." + n + ".src=getSrc('" + imgname + "')");
 }

function restore(){
      eval("document." + img + ".src=oldSrc");

 }
 
 	function openImage(imUrl)
	{
	var colourWin;
	var popleft=((document.body.clientWidth - this.ImagePageWidth) / 2)+window.screenLeft;
	var poptop=(((document.body.clientHeight - this.ImagePageHeight) / 2))+window.screenTop-40;	
	colourWin = window.open(imUrl,"PhotoWindow","scrollbars=YES,width=600,height=600,left="+popleft+",top="+poptop+",resizable");
	colourWin.focus();
	}
	
 	function openeBook(Url)
	{
	var BookWin;
	var popleft=((document.body.clientWidth - this.ImagePageWidth) / 2)+window.screenLeft;
	var poptop=(((document.body.clientHeight - this.ImagePageHeight) / 2))+window.screenTop-40;	
	BookWin = window.open(Url,"BookWindow","scrollbars=YES,width=600,height=680,left="+popleft+",top="+poptop+",resizable");
	BookWin.focus();
	}	