var ifthumbs;
var imageptr = 1;  	 			/* the current enlargement array element */
var running = false;
var slidetiming = 5000;
var wait;
var browser=navigator.appName;
/* var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if ((browser=="Netscape"||browser=="Microsoft Internet Explorer")*/

function load () {

  ifthumbs = ifolder + 'thumbs/';
  document.getElementById('pagetitle').childNodes[0].nodeValue = galleryname; 
	showthumbs ();
	showphoto(imageptr);
	document.getElementById('gallerystats').childNodes[0].nodeValue = ''; 
}

function showthumbs () {
var pid;

  for (i = 1; i <= imagecount; i++) {
	  pid = 'thumbnail' + i.toString(); 
		document.getElementById(pid).src = ifthumbs + imgfile[i];
		document.getElementById(pid).alt = imgname[i]; }
}

function showphoto(photonum) {

  document.images.currentimg.src = ifolder + imgfile[photonum];
  document.getElementById('photodesc').childNodes[0].nodeValue = imgname[photonum] + ':  Photo by ' + imgcred[photonum] + '  ' + imgdate[photonum];
  imageptr = photonum;
  if (! running) document.getElementById('stopstart').childNodes[0].nodeValue = 'Start Slideshow'; 

  if (document.getElementById('imgleft')) {
    if ((imageptr > 1) && (! running)) {
			document.getElementById('imgleft').src = '../furniture/button_lt.gif';}
    else {
			document.getElementById('imgleft').src = '../furniture/blankbutton.jpg';}
  }
  if (document.getElementById('imgright')) {
    if ((imageptr < imagecount) && (! running)) {
      document.getElementById('imgright').src = '../furniture/button_rt.gif';}
    else {
      document.getElementById('imgright').src = '../furniture/blankbutton.jpg';}  
	}		 
}

function findimage (frameno) {
  if (running==true) running = false;
  imageptr = frameno;
	if (imageptr <= imagecount) showphoto(imageptr); 
}

function steponimage (stepOn) {
  if (stepOn == true) {				 						    /* stepping down */
    if(imageptr < imagecount) {
      imageptr++;
      showphoto(imageptr);	}}
  else {							 												/* stepping up */
    if (imageptr > 1) {
      imageptr--;
      showphoto(imageptr);	}}
}

function setrunmode () {

  if (running) {
    running = false;
		showphoto(imageptr);
    document.getElementById('stopstart').childNodes[0].nodeValue = 'Start Slideshow'; }
  else {
    running = true;
		imageptr++;
    document.getElementById('imgleft').src = '../furniture/blankbutton.jpg';
    document.getElementById('imgright').src = '../furniture/blankbutton.jpg'; 
    wait = setTimeout('slideshow()', 0);}
}

function slideshow(){

  if (running) {
    if (imageptr > imagecount) imageptr=1;
/*		if (browser=="Microsoft Internet Explorer") {
      displayphoto (imageptr);}
	  else {
		  document.images.currentimg.src = imgfile[imageptr]; }	*/
		showphoto(imageptr);	
    document.getElementById('stopstart').childNodes[0].nodeValue = 'Stop Slideshow'; 
    imageptr++;
    if (imageptr > imagecount) imageptr=1;
    wait = setTimeout('slideshow()', slidetiming); }
  else	{	
    document.getElementById('stopstart').childNodes[0].nodeValue = 'Start Slideshow'; }
} 

function openhelpwindow(url) {
  mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=500,top=200,left=200');
}

