autoShow = false;
function watchShow(xmlFile)
{
// blank out the two areas at the top of the page
document.getElementById('showText').innerHTML = "";
document.getElementById('slideShow').innerHTML = "";
//load the picture array

 picArray = loadPicArray(xmlFile);
 var showTitle = getTitle(xmlFile);
 writeIt('infoCell', showTitle);
 writeIt('homeButton', '<button name="home" onclick="goHome()">Home</button>');
 writeIt('reloadButton', '<button name="listShows" onclick="goLoad()">List of Shows</button>');
 startShow('1');
 return;
 picArray = ''
 return; 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																								
}

function showPic()
{
// actually write the html to show the picture and the picture location

		var picImg = "<img src=" + picArray[currentPic] + "></img>";
		writeIt('picture', picImg);
//		writeIt('infoCell', picArray[currentPic]);
}
function startShow(theValue)
{

   	currentPic = 0;
		showPic();
		writeNextButton();
		var prev = '';
//determine if this is an autoshow (1) or manual show (0)
		if (theValue == '1')
		{
			 autoShow = true;
		}
		if (!autoShow)
		{
// if not an autoshow, blank out the previous button		
		 	 writeIt('prevButton', prev);
		}
		else
		{
// if autoshow, blank out the prev and next buttons and add a pause button
  		var prev = '';
  		writeIt('prevButton', prev);
  		writeIt('nextButton', prev);
		 	writePauseButton();	
  	 	timeoutId = setTimeout("nextPic();", 5000);
		}
}
                                                      

function nextPic ()
{
// increment the picture number
  currentPic++;
// if greater than the number of pictures available, send alert
	if (currentPic > (picArray.length - 1))
	{
	 currentPic = 0;
//	 alert("No more pictures.");
//	 return false;	 
	}
  	showPic();
   	if (!autoShow)
  		{	
        writeNextButton();
      	writePrevButton();
  		}
  		else
  		{
			 	writePauseButton();	
   		 	timeoutId = setTimeout("nextPic();", 5000);
  		}
	
}
function prevPic ()
{
// decrement current picture number
  currentPic--;
// check to see if we are on the first picture
	if (currentPic < 0)
	{
	   currentPic++;
	 	 alert("This is the first picture");
	}
	else
	{
  	showPic();
    writeNextButton();
  	writePrevButton();
	}
}
function writePauseButton()
// if you are doing an autoshow, write a pause button so users can stop the show
{
		var next = '<button name="next" onclick="pause()">Pause</button>';
		writeIt('nextButton', next);
}
function writeResumeButton()
// if you are paused, allow user to start show again - at the next picture
{
		var next = '<button name="next" onclick="nextPic()">Resume</button>';
		writeIt('nextButton', next);
}
function pause()
// pause autoshow
{
  	clearTimeout(timeoutId);
		writeResumeButton();
}
function writeNextButton()
{
		var next = '<button name="next" onclick="nextPic()">Next</button>';
		writeIt('nextButton', next);
}
function writePrevButton()
{
		var prev = '<button name="prev" onclick="prevPic()">Previous</button>';
		writeIt('prevButton', prev);
}	
function writeIt(divName, passedVar)
{
		document.getElementById(divName).innerHTML = passedVar;
}
function goHome()
{
 if (autoShow)
 {
 	clearTimeout(timeoutId); 
 }
 location='http://www.metrocast.net/~deborah1';
}

function goLoad()
{

 location = 'http://www.metrocast.net/~deborah1/show.htm';
 writeIt('homeButton', '');
 writeIt('reloadButton', '');

}