var currentSlide = 1;

function changePictureInFrame( picToShow )
{	
	if( document.images )
	{
		window.document.images['pictureFrame'].src = eval( picToShow ).src;
	}
}


function changeCaption( captionNum )
{	
	var theLink;
	var current;
	currentSlide = captionNum;
	
	for( var i=1; i<=numOfSlides; i++ )
	{	
		currentCaption = document.getElementById( "caption" + i );
		currentLink = document.getElementById("slideshowLink" + i);
  		
		  if( i != captionNum )
				{	
					currentCaption.style.display = 'none';
					currentLink.style.color = '#000';
					currentLink.style.textDecoration = 'underline';
				}
				else 
				{
					currentCaption.style.display = 'block';
					
					//bold the number for the picture that is currently showing
					currentLink.style.fontWeight = 'normal';
					currentLink.style.textDecoration = 'none';
					currentLink.style.color = '#999';
				}	
		
	}		
}


function getPrevious() {
  	if ( currentSlide > 1)
  	{
		currentSlide = currentSlide-1;
	} 
	else
	{
		currentSlide = numOfSlides;
	}
	changePictureInFrame( "picture" + currentSlide );
	changeCaption( currentSlide );
}

function getNext() {
  	if ( currentSlide < numOfSlides)
  	{
		currentSlide = currentSlide + 1;
	} 
	else
	{
		currentSlide = 1;
	}
	changePictureInFrame( "picture" + currentSlide );
	changeCaption( currentSlide );
}

function slideshows() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("slideshowPopup")) {
      links[i].onclick = function() {
        window.open(this.href, "Slideshow", "width=820,height=420,menubar=0,scrollbars=0");
        return false;
      }
    }
	if (links[i].className.match("transcripts")) {
      links[i].onclick = function() {
        window.open(this.href, "Transcripts", "width=518,height=500,menubar=0,scrollbars=1");
        return false;
      }
    }
    if (links[i].className.match("photoPopup")) {
      links[i].onclick = function() {
        window.open(this.href, "EnlargePhoto", "width=660,height=625,menubar=0,scrollbars=0");
        return false;
      }
    }
	    if (links[i].className.match("photoPopup2")) {
      links[i].onclick = function() {
        window.open(this.href, "EnlargePhoto2", "width=440,height=595,menubar=0,scrollbars=0");
        return false;
      }
    }
  }
}
window.onload = slideshows;
	
