// Write the navigation buttons and picture caption. Show this page's image. Preload next and previous images
function nav(thispic,next,prev,index,gallery) {
	var ll="&lt;&lt;"
	var rr="&gt;&gt;"
	var hidden_next = next + ".jpg"
	var hidden_prev = prev + ".jpg"
	var nextpage = next + ".html";
	var prevpage = prev + ".html";
	thispic = thispic + ".jpg";
	gallery = " &nbsp;" + gallery + "&nbsp;Gallery&nbsp; " 
	index   = "../" + index   + ".html";
	
	document.write("<table><tr>");
	document.write("<td class='PIN' onclick='location.href=\"" + prevpage + "\"'>" + ll	 	 + "<\/td>"); 
	document.write("<td class='PIN' onclick='location.href=\"" + index    + "\"'>" + gallery + "<\/td>");
	document.write("<td class='PIN' onclick='location.href=\"" + nextpage + "\"'>" + rr 	 + "<\/td>");
	document.write("<\/tr><\/table><br>");
	
	document.write("<table><tr><td class='BuyPINO' >" + document.title.replace(/ /g,"&nbsp;") + "<\/td><\/tr><\/table><br>");

	document.write("<img class='large'  src='../mediafiles/" + thispic + "'>");
	document.write("<img class='hidden' src='../mediafiles/" + hidden_next + "'>");
	document.write("<img class='hidden' src='../mediafiles/" + hidden_prev + "'><br><br>");
	}

//Copy the text of window title to caption box, replacing all spaces with nbsp
function title() {
	document.write("<table><tr><td class='BuyPINO' >" + document.title.replace(/ /g,"&nbsp;") + "<\/td><\/tr><\/table><br>");
	}

//Called by body onLoad of an index page: Show thumbnails AFTER they have all loaded
function showImages() {
	for(var i=0; i<document.images.length; i++) {
		document.images[i].style.visibility = 'visible';}
	}

//In all index pages: show thumbnail, set Mac/Win tooltip, + mouseover
function thuN(thname,tip) {
	var thumb = "thumbN/" + thname + ".jpg";
	document.write("<img class='thumb' src='" + thumb + "'name='" + tip + "'title='" + tip + "' onclick=showpage('" + thname + "') />")
	}
			
//on click on thumbnail: go to the associated page
function showpage(name) {location.href='pages/' + name + ".html";}

// write auto-updating copyright text
function copy() {
	var d=new Date(); 
	var yr=d.getFullYear();
	document.write("Photographs on this site (except where noted)<br>");
	document.write("are copyright &copy; Dr Brian Watson 1962 - " + yr);
	}

// script to embed Flash movie taken from pano2VR
function p2q_EmbedFlash(sFile,sWidth,sHeight) {
	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
	document.writeln('  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
	document.writeln('  width="' + sWidth + '" height="' + sHeight + '" >');
	document.writeln('  <param name="movie" value="' + sFile + '">');
	for(i=3;i<arguments.length;i+=2) {document.writeln('  <param name="' + arguments[i] + '" value="' + arguments[i+1] + '">');}
	document.writeln('<embed width="' + sWidth + '" height="' + sHeight + '"');
	document.writeln('	pluginspage="http://www.macromedia.com/go/getflashplayer"');
	document.writeln('	type="application/x-shockwave-flash"');
	document.writeln('	src="' + sFile + '"');
	for(i=3;i<arguments.length;i+=2) {document.writeln('  ' + arguments[i] + '="' + arguments[i+1] + '"');}
	document.writeln('	/>');
	document.writeln('</object>');
	}

// change the class of an img (use onclick instead) by clicking the image     : small<-->large ========;cursor: url(PNGs/grab.cur), pointer;
function toggle(elem,size1,size2){elem.className = (elem.className==size1)?size2:size1;}


function goPage(theUrl) {
	document.location.href = theUrl;
	return;
	}
