  var dimages = new Array();
	var req;
	var vImages = new Array();
	var nImages = 0;
	var t;
	var tt;
	var timer = null;
	var WinRef;
	var newWindow;
	var cnt = 0;	//incrementing counter for images slide show
	var strDetails = "";
	var firstImage = true;

	var tbl1;

	var end_opacity = 50; //end opacity, 25 = 25%, 50 = 50%, 100 = 100%, etc.
	var increase_opacity_by = 10; //how much to increase by each time the timeout ends
	var timeout = 100; //timeout in miliseconds, 0 = instant fade-out
	var win;			//= document.getElementById("thewindow");
	var winbackground;			//= document.getElementById("thewindowbackground");
	var wincontent; 				//= document.getElementById("thewindowcontent");
	var cur_opacity = 0;

function wm_onmouseover(obj) {
	obj.style.textDecoration = 'underline';
	}

function wm_onmouseout(obj) {
	obj.style.textDecoration = 'none';
	}

function wm_click(obj) {
	window.location = "mailto:Marianne@nidm.org";
	}

function UnTt() {
	clearTimeout(tt);
	UnTip();
	}

function curImage_onmouseover(obj) {
	obj.style.borderColor = '#C0C0C0';			//Grey
	UnTt();
	clearTimeout(t);
	Tip("Slide Show on Hold...");
	tt = setTimeout("UnTt()",1500);
	}

function curImage_onmouseout(obj) {
	obj.style.borderColor = 'rgb(220,220,220)';		//Off-White
	UnTt();
	t = setTimeout("swapPicture()", 3500);
	Tip("Slide Show Proceeding...");
	tt = setTimeout("UnTt()",1500);
	if (typeof(win) == "object") {
		if (win.style.display !== "none") {
			clearTimeout(t);
			UnTt();
			}
		}
	}

function curImage_onmousedown(obj) {
	clearTimeout(t);
	if (strDetails.length > 0) {
		document.getElementById("details").innerHTML = strDetails;
		strDetails = "";
//alert(strDetails);
		}
	showWindow();
	}


function btn_onmouseover(obj) {
	obj.style.fontWeight = 'bold';
	obj.style.borderColor = 'rgb(255,255,255)';			//White
	obj.style.backgroundColor = 'rgb(0,150,150)';
	var txt = obj.innerHTML;
		if (txt.indexOf("Show") > 0) {
			Tip("Click here to learn about controlling Slide Show");
			}
	}

function btn_onmouseout(obj) {
	obj.style.fontWeight ='lighter';
	obj.style.borderColor = '#C0C0C0';		//Silver
	obj.style.backgroundColor = 'Transparent';
	UnTip();
	}


function btn_onmousedown() {
	strDetails = document.getElementById("details").innerHTML;		//save Details
	if (typeof(win) =="object") {
		win.style.display = 'none';		//	hideWindow();
		}					
	clearTimeout(t);			//stop Slide Show
	//assemble HTML for about window

	var hdText = "<em>Slide Show</em><ul>";
	hdText = hdText + "<li>to Pause:  move cursor over painting</li>";
	hdText = hdText + "<li>to Continue:  move cursor off painting</li>";
	hdText = hdText + "<li>to Display Details:  click anywhere on painting</li>";
	hdText = hdText + "</ul>";
	hdText = hdText + "<em>Full Screen View</em><ul>";
	hdText = hdText + "<li>F11 to toggle</li></ul>";

	document.getElementById("details").innerHTML = hdText;
	showWindow();
	}

function readImageList() {
//var vImg = document.getElementById("the-images").innerHTML;
//alert(document.getElementById("the-images").innerHTML);
//document.getElementById("the-images").innerHTML = vImg + vImg;
//alert(vImg + vImg);
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
		}
	if(req) {
		sURL  = "http://" + self.location.hostname + "/Gallery/ImageList.txt";
		req.onreadystatechange = processReqChange;
		req.open("GET", sURL, true);			//async = true
		req.send("");
	}
}


function processReqChange() {
    // only if req shows "loaded"
    if (req.readyState == 4) {			//4=request Complete
        // only if "OK"
        if (req.status == 200) {		// Server response Ok
            // ...processing statements go here...
						// load global variable with image file urls
						vImages = req.responseText.split(/\r\n/);
						nImages = vImages.length;
// IE and FF arrive at different nImages, possibly due to final crlf in ImageList.txt
// test for blank line and reduce by one
				if (vImages[nImages-1] == "" ) nImages = nImages - 1;			
						loadImages();
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
        }
    }
}


function loadImages() {
	if (document.images) {
		var atext = "";
		for (i=0; i<nImages; i++) {
			dimages[i]=new Image(600,316);
			dimages[i].src="Gallery/" + vImages[i];
			//assemble string for Gallery HTML for each image
			atext = atext + "<a href = 'Gallery/" + vImages[i] + "' ";
			atext = atext + "class='highslide' onclick='return hs.expand(this)' >";
			atext = atext + "<img src='Gallery/Thumbnails/" + vImages[i] + "' ";
			atext = atext + "alt='Highslide JS' title='Original art.  Click to enlarge' ></a>";
		}
		document.getElementById("the-images").innerHTML = atext;
//alert(document.getElementById("the-images").innerHTML);
		swapPicture();			//loads first image and sets timer
	}
}

			//txt = vImages[i]	//.split("_")[3];
//alert(txt);


function swapPicture()
{
  if (document.images)			//ensures that Images object is supported

  {
		var sRand = Math.random();				// 0 to 1
		var x = Math.round(sRand * nImages);		//returns integer closest to product
		
		if (cnt > (nImages - 1)) cnt = 0;

		x = cnt;

    if (dimages[x] && dimages[x].complete)
    {
      var target = false;
      if (document.images.curImage)
        {target = document.images.curImage;}
      else if (document.all && document.getElementById("curImage"))
        {target = document.getElementById("curImage");}
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
				//swap image
				target.src = dimages[x].src;	
				if (firstImage) {
					t = setTimeout("swapPicture()", 1000);
					firstImage = !firstImage;
					return;
					}
				else {
					target.style.height = '260px';
					target.style.width = '';
					target.style.border = '30px solid white';
				}

				//split for author, title and copyright information
				var atc = vImages[x].split("_");	
				var hdText = "<span style='font-weight: bold;'>" + atc[0] + "</span>";
				//strip .jpg
				var yyyy = atc[2].split(".");
				hdText = "<span style='font-style: italic;'>&nbsp;&nbsp;&nbsp;&nbsp;" + atc[1]  + "&nbsp;&nbsp;&nbsp;&nbsp;</span>";
				hdText = hdText + "<font size='-2'>Copyright © " + yyyy[0] + "&nbsp;&nbsp;&nbsp;&nbsp;Image # " + (cnt + 1) + " of " + nImages + "</font>";

				document.getElementById("R3C2").innerHTML = hdText; 

				//assemble HTML for about window
				hdText = "<p>Artist - " + atc[0] + "</p>";
				hdText = hdText + "<p>Title - " + atc[1] + "</p>";
				hdText = hdText + "<p>Year - " + yyyy[0] + "</p>";
				hdText = hdText + "<p>Medium - " + atc[3] + "</p>";
				hdText = hdText + "<p>Size - " + atc[4] + "</p>";
				hdText = hdText + "<p>Price - $" + atc[5].split(".")[0] + "</p>";
				document.getElementById("details").innerHTML = hdText;

      }
      t = setTimeout("swapPicture()", 3500);
				//increment image counter
				cnt++;
    }
    else
    {
      t = setTimeout("swapPicture()", 500);
    }
  }
}


function showWindow() {
		win = document.getElementById("thewindow");
		winbackground = document.getElementById("thewindowbackground");
		wincontent = document.getElementById("thewindowcontent");
		var img = document.getElementById("curImage")
		//try positioning img centered on it's title...
		//img.style.left = "500px";
		
		win.style.position = 'absolute';
		win.style.visibility = 'visible';
		win.style.width = String(Number(img.width) + 2*30 + 1) + "px";		
		win.style.height = String(Number(img.height) + 2*30 + 1) + "px";	
		win.style.left = findPosX(img);		
		win.style.top = findPosY(img);		

		winbackground.style.width = win.style.width;		
		winbackground.style.height = win.style.height;	
		winbackground.style.top = "0";		//win.style.top;
		winbackground.style.left = "0";		//win.style.left;

		if(timeout > 0) {
			cur_opacity = 0;
			winbackground.style.opacity = cur_opacity / 100;
			winbackground.style.filter = "alpha(opacity=" + cur_opacity + ")";

			win.style.display = 'block';
			wincontent.style.display = 'none';
			timer = setTimeout("increase_opacity()",timeout);
		}
		else {
			winbackground.style.opacity = end_opacity / 100;
			winbackground.style.filter = "alpha(opacity=" + end_opacity + ")";
			win.style.display = 'block';
			wincontent.style.display = 'block';
		}
	}

function increase_opacity() {
	cur_opacity += increase_opacity_by;
	winbackground.style.opacity = cur_opacity / 100;
	winbackground.style.filter = "alpha(opacity=" + cur_opacity + ")";
	if(cur_opacity < end_opacity) {
	timer = setTimeout("increase_opacity()",timeout);
	}
	else {
		wincontent.style.display = 'block';
	}
	}


function hideWindow() {
	win.style.display = 'none';
	t = setTimeout("swapPicture()",3500);
	}
	

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
