//Global
	  var showDisplay = "" ;
		var showTitle = "" ;
   var newWin = null; 
//alert("Hi");		

function showPict(thisImg)
{
 
     showDisplay = "";
        showTitle= "";
   fileName =  thisImg.getAttribute("src");
    fileName  = fileName + '.txt'; 
 // alert(fileName);
    getDescription(fileName);
		
		 if (thisImg.width > thisImg.height)
		   { // landscape
			    winWidth='625'; winHeight='500';
			  }
		   else
			   {// portrait
				   winWidth='500'; winHeight='625';
				   } 
 
     openOptions = 'width='+winWidth+',height='+winHeight +',resizable=yes';
 
      if (newWin == null || newWin.closed)
      {
				newWin = window.open("about:blank","_blank",openOptions);
			 }	
			else
			{// recycle existing
			 newWin.resizeTo((winWidth *1) + 50, (winHeight *1) + 50)
			}	
					
				//	window.setTimeout(,1000);
	 
		newWin.focus(); // try get around apparent Mozilla bug where first time nothing shows
		
     imgPos = thisImg.getAttribute("src").lastIndexOf("/") +1;
	//alert(thisImg.src);	 
	   newWin.document.body.style.cssText="font-family:arial, helvetica, sans-serif; font-size:11pt;";
      newWin.document.body.innerHTML = '<center><p /><img alt=\"'
			+thisImg.src.substr(imgPos)
			 +'\" src=\"'
        + thisImg.src
         + '\"><br /><p id=\"showTitleText\" style=\"text-align:center;font-weight:bold; font-family:times new roman, roman, serif; font-size:11.5pt;\">'
				  + showTitle
				   +'</p><p id=\"showDisplayText\" >'
				    + showDisplay
				     +'</p><p align=\"right\">'
					    +'<button onclick=\"window.close()\">Close</button></center></p>';

newWin.document.title = showTitle ;
}
		
		
function createXMLHttpRequest() 
{
 if (typeof XMLHttpRequest != "undefined") 
    {
	    return new XMLHttpRequest();
     } else if (typeof ActiveXObject != "undefined") 
		    {
	       return new ActiveXObject("Microsoft.XMLHTTP");
        } 
			 else {
	            throw new Error("XMLHttpRequest not supported");
             }
 }


function getDescription(fileName) 
{
// alert(fileName);
 var request = createXMLHttpRequest();
 request.open("GET", fileName, true);
 
 request.onreadystatechange = function() 
   {
   	if (request.readyState == 4) 
		    {
         //alert('>'+request.responseText.substr(0,6)+'<');
         if (request.responseText.substr(0,6) == '<html>')
         {
	         showDisplay = "";
		        showTitle = "";
		       }
    else	{
		        reply =  request.responseText;
		        _break = reply.indexOf('_');
		       	//reply.substr(0,thisText.length - 12); 
            showDisplay = reply.substr(_break +1, reply.length - (_break -1));
			      showTitle = reply.substr(0,_break);
						
						newWin.document.getElementById("showDisplayText").innerHTML = showDisplay;
						 newWin.document.title = showTitle;
						newWin.document.getElementById("showTitleText").innerHTML = showTitle;
						
					newWin.focus();
					
			     } 
	      }// if (request.readyState == 4)
     }// close function()
		 
 request.send(null);
}

function whichBrowser(here)
 {
  if (BrowserDetect.browser != "Explorer")
	 {
	   here.document.write(".<br />"+parent.BrowserDetect.browser +", users please click twice if necessary. " );
   alert(parent.BrowserDetect.browser + " Users:\n\nClick twice on pictures if necessary, \nand please don\'t close the extra picture window until you really need to.")
    }
	}	

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

function docsLoaded(here)
 {
 buildLink = document.location.search.replace('?','');
 
 if (buildLink != '' )
 document.frames("docs").location = buildLink;
 
 //  here.lastChild.src = buildLink;
  }

