

// (C) 2003 by CodeLifter.com
// Free for all users, but leave in this header.

// ==============================
// Set the following variables...
// ==============================

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 2;

var Picture = new Array(); 
var Thumbnail = new Array();
var origThumbnail = new Array();
var Caption = new Array(); 
var showHot = false;       

// Caution: The number of Pictures *must*
// equal the number of Captions!
Picture[0] =  'images/1.jpg';
Picture[1]  = 'images/2.jpg';
Picture[2]  = 'images/3.jpg';
Picture[3]  = 'images/4.jpg';
Picture[4]  = 'images/5.jpg';
Picture[5]  = 'images/6.jpg';
Picture[6]  = 'images/7.jpg';
Picture[7]  = 'images/8.jpg';
Picture[8] =  'images/9.jpg';
Picture[9]  = 'images/10.jpg';
Picture[10]  = 'images/11.jpg';
Picture[11]  = 'images/12.jpg';
Picture[12]  = 'images/13.jpg';
Picture[13]  = 'images/14.jpg';
Picture[14]  = 'images/15.jpg';
Picture[15]  = 'images/16.jpg';
Picture[16]  = 'images/17.jpg';
Picture[17]  = 'images/18.jpg';

Thumbnail[0] =  'images/thumb_down.gif';

origThumbnail[0] =  'images/thumb.gif';

Caption[0] = "Site supervisor Robert Watson Jr. works in the garden at Great Hopes Plantation.";
Caption[1]  = "Hoe in hand, Pam Wharton-Young, interpreter for the African American history unit, is ready to work in the garden.";
Caption[2]  = "Robert Watson Jr., site supervisor at Great Hopes Plantation, splits hickory for tool handles.";
Caption[3]  = "Ed Schultz works on the spring plowing with a couple of friends of the 18th-century farmer &#8212; oxen.";
Caption[4]  = "Apprentice carpenter Jack Underwood works on a project on a draw bench.";
Caption[5]  = "Agriculture specialist Wayne Randolph ponders the tobacco crop.";
Caption[6]  = "Journeyman carpenter Ted Boscana drives a log into place for the slave house.";
Caption[7]  = "Ted Boscana and apprentice carpenter Wes Watkins saw a log to create an opening for a door.";
Caption[8]  = "Agriculture interpreter David Nielsen wears a hat to protect his face from the heat of the sun.";
Caption[9]  = "Agricultural trades supervisor Ed Schultz ties a sheaf of wheat.";
Caption[10]  = "Kathy Thompson, interpreter for the African American history unit, ties a sheaf of wheat.";
Caption[11]  = "A water bucket made by Colonial Williamsburg coopers sits atop a water trough hewn from poplar. In the background stands the slave house.";
Caption[12]  = "The bucket yoke seen here leaning against the water trough allows a person to carry two buckets of water a fair distance.";
Caption[13]  = "The gourdseed corn grown at Great Hopes Plantation is a historical variety of corn commonly grown in the 18th century.";
Caption[14]  = "An interpreter for the African American history unit, Emily James cultivates tobacco.";
Caption[15]  = "Kathy Thompson works in the garden.";
Caption[16]  = "Journeyman carpenter Ted Boscana observes apprentice carpenters Steve Chabra and Corky Howlett using the cross saw to cut through a timber.";
Caption[17]  = "\"Buck\" the farm horse cultivates corn.";
 








var tss;
var iss;
var jss = 0;
var pss = Picture.length-1;
//pss = 1

var preLoad = new Array();
//while iss is less than 12, build array that preload1.src=picture1, preload2.src=picture2
for (iss = 0; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}


var preLoadT = new Array();
//while iss is less than 12, build array that preload1.src=picture1, preload2.src=picture2
for (iss = 0; iss < pss+1; iss++){
preLoadT[iss] = new Image();
preLoadT[iss].src = Thumbnail[0];}


var preLoadO = new Array();
//while iss is less than 12, build array that preload1.src=picture1, preload2.src=picture2
for (iss = 0; iss < pss+1; iss++){
preLoadO[iss] = new Image();
preLoadO[iss].src = origThumbnail[0];}


//start rollover script
function changeImages() {
	if (document.images) {
	
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		
		}
	}
}

//end rollover script



var x=5;

function thumbs(n,thumbnail){

//alert(document.images[5].src);
//change old down thumbnail to up position
document.images[x].src = preLoadO[0].src;

//
//need to determine what number your first thumbnail image is, then add to n in the x=n variable and to the var x=_
//

  
jss = n;
x = n+5;
//change new thumbnail to up position
document.images[x].src = preLoadT[0].src;

if (thumbnail == true) control('T');
//alert(jss);
}

var nextB = "false"; // not _over
var backB = "false" // not _over
var activeF = true;
var activeB = true;



function control(how){
if (showHot){
if (how=="H") {
	jss = 0;
	thumbs(jss,false);}

// if the next button is active, add 1 to jss otherwise do nothing
if (activeF == true){
	if (how=="F"){
	 jss = jss + 1;
	 thumbs(jss,false);}
} else { 
	null;
	}
	
// if the back button is active, subtract 1 from jss otherwise do nothing
if (activeB == true){
	if (how=="B") {jss = jss - 1;
	 thumbs(jss,false);}
} else {
	null;
}


if (how=="T") jss = jss; 

// if jss equals the total pictures, turn off next button
if (jss == (pss)) {
	nextB = "true";
	activeF = false;}
// if jss is at the first picture, turn off back button
if (jss == 0){
	backB = "true";
	activeB = false; }
// any other time turn on back and next buttons
if (jss != 0) {
	backB = "false";
	activeB = true; }
if (jss != (pss)) {
	nextB = "false";
	activeF = true;}



//get reference to CaptionBox and PictureBox for all browsers
function getRefToDiv(divID,oDoc) {
    if( !oDoc ) { oDoc = document; }
    if( document.layers ) {
        if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
            //repeatedly run through all child layers
            for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
                //on success, return that layer, else return nothing
                y = getRefToDiv(divID,oDoc.layers[x].document); }
            return y; } }
    if( document.getElementById ) {
        return document.getElementById(divID); }
    if( document.all ) {
        return document.all[divID]; }
    return false;
}


myReference2 = getRefToDiv("PictureBox");
if( myReference2.style ) { myReference2 = myReference2.style; }
myReference2.backgroundImage = 'url(' + preLoad[jss].src + ')';
//alert (myReference.backgroundImage);

myReference = getRefToDiv("CaptionBox");
//changes text in CaptionBox, technique varies by browser
if( typeof( myReference.innerHTML ) != 'undefined' ) {
  //used by the IE series, Konqueror, Opera 7+ and Gecko browsers
  myReference.innerHTML = Caption[jss];
} else {
  if( myReference.document && myReference.document != window.document ) {
    //used by layers browsers
    myReference.document.open();
    myReference.document.write(Caption[jss]);
    myReference.document.close();
  } else {
    if( window.frames && window.frames.length && window.frames['nameOfIframe'] ) {
      //used by browsers like Opera 6-
      //if we attempt to rewrite the iframe content before
      //it has loaded we will only produce errors
      myReference = window.frames['nameOfIframe'].window;
      myReference.document.open();
      myReference.document.write(Caption[jss]);
      myReference.document.close();
    }
  }
}







/*

if( myReference.innerHTML ) {
	document.getElementById("PictureBox").backgroundImage = 'url(' + preLoad[jss].src + ')'; }

if( myReference.style ) {
document.getElementById("PictureBox").style.backgroundImage = 'url(' + preLoad[jss].src + ')'; }

*/

//for explorer
//if (document.all){
//can be used with a "real" image to have a fade effect
//document.images.PictureBox.style.filter="blendTrans(duration=2)";
//document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
//document.images.PictureBox.filters.blendTrans.Apply();
//}

if (nextB == "true") document.images.next.src = 'images/next_down.gif';
if (nextB == "false") document.images.next.src = 'images/next.gif';
if (backB == "true") document.images.backB.src = 'images/back_down.gif';
if (backB == "false") document.images.backB.src = 'images/back.gif';
//document.images.PictureBox.src = preLoad[jss].src;

//if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];

//for explorer
//if (document.all) document.images.PictureBox.filters.blendTrans.Play();
}
}
