

// (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';

Thumbnail[0] =  'images/thumb_down.gif';

origThumbnail[0] =  'images/thumb.gif';

/*
Caption[0] = "A silversmith in his shop in 1955.";
Caption[1]  = "The Print Shop was located in the Prentis Store until 1958.";
Caption[2]  = "Skill in brass, wood, and iron were necessary to create the weapons shown here in 1964.";
Caption[3]  = "Eddie W. Givens was the master baker at the Raleigh Tavern Bakery in 1965.";
Caption[4]  = "In 1966, the leatherworking trade included boot, harness, and saddle making.";
Caption[5]  = "The master clockmaker and his apprentice were hard at work in the clock shop in 1974.";
Caption[6]  = "Young visitors in tricorn hats watch intently as a cooper works on a stave in the cooper shop in 1979. Master Cooper George Pettengell, in the background to the right, came to Colonial Williamsburg from England, where his father was a cooper, and his father before him, and his father before him. Today, George\'s younger brother Jim Pettengell is the master cooper.";
Caption[7]  = "Weaver Max Hamrick turns threads into cloth at the loom in the weaver\'s shop in 1990.";
Caption[8]  = "A gown is fit to the lady's figure in the millinery shop (1994).";
Caption[9]  = " In more recent times, carpenters using colonial techniques work on the reconstruction of the kitchen at the Randolph complex (2000).";
Caption[10]  = " A printer is performing a technique known as \"marbling paper\" in a work area set up outdoors in 1965.";
*/



var tss;
var iss;
var jss = 0;
var pss = Picture.length-1;
var thss = Thumbnail.length-1;
var othss = origThumbnail.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 < thss+1; iss++){
}

preLoadT[0] = new Image();
preLoadT[0].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 < othss+1; iss++){
}

preLoadO[0] = new Image();
preLoadO[0].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=1;


function thumbs(n,thumbnail){

//alert(document.images[2].name);

document.images[x].src = origThumbnail[0];
//need to determine what number your first thumbnail image is, then add to n
  
jss = n;
x = n+1;
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();
}
}
