function disableselect(e){
	return false
}
function reEnable(){
	return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
	document.onmousedown=disableselect
	document.onclick=reEnable
}

function highlight(){
	sc=event.srcElement
	if (sc.tagName=="TABLE")
	return
	while(sc.tagName!="TR")
	sc=sc.parentElement
	if (sc.style.backgroundColor!='#3e80e0'&sc.id!="ignore") {
		oldcol=sc.style.backgroundColor;
		sc.style.backgroundColor='#3e80e0';
		sc.style.color='#ffffff';
	}
}
function changeback(){
	if (event.fromElement.contains(event.toElement)||sc.contains(event.toElement)||sc.id=="ignore")
	return
	if (event.toElement!=sc) {
		sc.style.backgroundColor=oldcol;
		sc.style.color = '#000000'
	}
}
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function printit(){  
if (window.print) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
}
function printicon(allowprint){
	if (allowprint == "yes"){
	document.write('<a href="javascript:;" onclick="printit()"><img src="/icons/printer.png" alt="Print is page" title="Print this page" /></a>');
	} else {
	var code='<a href="javascript:;" onclick="alert(&quot;Sorry, printing of this photograph is not permitted.&quot;)"><img src="/icons/no_print.png" alt="Printing disabled" title="Printing disabled" /></a>';
	document.write(code);
	}
}
function zoomicon(allowzoom){
	if (allowzoom == "yes"){
		document.getElementById('zoomon').innerHTML='<a href="javascript:;" onClick="setzoom()"><img src="/icons/zoom.png" alt="Zoom Mode" title="Zoom Mode" /></a>';
		document.getElementById('zoomoff').innerHTML='<a href="javascript:;" onClick="getphoto()"><img src="/icons/zoom.png" alt="Exit Zoom Mode" title="Exit Zoom Mode" /></a>';
	} else {
		document.getElementById('zoomon').innerHTML='<a href="javascript:;" onClick="alert(&quot;Sorry, zoom mode is not available with this photograph&quot;);"><img src="/icons/zoom_off.png" alt="Zoom Mode Disabled" title="Zoom Mode Disabled" /></a>';
	}
}
function hide(){
document.getElementById('listbar').style.visibility ="hidden";
document.getElementById('tabdown').style.visibility ="visible";
document.getElementById('tabup').style.visibility ="hidden";
}
function show(){
getphoto();
document.getElementById('listbar').style.visibility ="visible";
document.getElementById('tabdown').style.visibility ="hidden";
document.getElementById('tabup').style.visibility ="visible";
}
function getphoto(){
	var docpath="/cgi-bin/zoom/norm.pl?path="+document.location;
	var refpath="/cgi-bin/pdbsub4.pl?path="+document.location;
	var copypath="/cgi-bin/copyright.pl?path="+window.location;
	document.getElementById('zoomon').style.visibility ="visible";
	document.getElementById('zoomoff').style.visibility ="hidden";
	loadphoto(docpath);
	loadreflection(refpath);
	if(copyright!="yes") showcopyright(copypath);
}
function setzoom(){
	var docpath="/cgi-bin/zoom/zoom.pl?path="+document.location;
	var reftext='<div id="zoomtext"><span class="right"><a href="javascript:;" onClick="getphoto()">Close&nbsp;X</a></span><img src="/icons/zoom.png" />&nbsp; <strong>Photograph Zoom Mode</strong><br />Left-click on the photograph to zoom-in<br />Right-click on the photograph to zoom-out<br />Move pointer to the edges to pan.</div>';
	document.getElementById('zoomoff').style.visibility ="visible";
	document.getElementById('zoomon').style.visibility ="hidden";
	loadphoto(docpath);
	hide();
	document.getElementById('rlock').innerHTML = reftext;
}
function loadphoto(photo) {
	var photopath=photo;
	var request;		
	if (window.ActiveXObject)
		request = new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest)
		request = new XMLHttpRequest();
	else
		alert("not supported");		
	
	request.onreadystatechange = photoshow;
	function getphoto(){
		if(request.readyState==0 || request.readyState==4){
			request.open("GET",photopath,true);
			request.send(null);
		}
	}
	function photoshow(){
		if(request.readyState == 4) {
			document.getElementById('plock').innerHTML = request.responseText;
		}
	}	
	getphoto();
}
function loadreflection(path) {
	var refpath=path;
	var refrequest;		
	if (window.ActiveXObject)
		refrequest = new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest)
		refrequest = new XMLHttpRequest();
	else
		alert("not supported");		
	
	refrequest.onreadystatechange = refshow;
	function getref(){
		if(refrequest.readyState==0 || refrequest.readyState==4){
			refrequest.open("GET",refpath,true);
			refrequest.send(null);
		}
	}
	function refshow(){
		if(refrequest.readyState == 4) {
			document.getElementById('rlock').innerHTML = refrequest.responseText;
		}
	}	
	getref();
}
function showcopyright(copypath){
	var copyrequest;		
	if (window.ActiveXObject)
		copyrequest = new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest)
		copyrequest = new XMLHttpRequest();
	else
		alert("not supported");		
	
	copyrequest.onreadystatechange = copyshow;
	function getcopy(){
		if(copyrequest.readyState==0 || copyrequest.readyState==4){
			copyrequest.open("GET",copypath,true);
			copyrequest.send(null);
		}
	}
	function copyshow(){
		if(copyrequest.readyState == 4) {
			document.getElementById('copynotice').innerHTML = copyrequest.responseText;
		}
	}	
	getcopy();	
}
