

// (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 showHot = false;       


var Caption = new Array(); 
Caption[0] = "In the 18th century, the first step in making bricks was to dig clay from the ground.";
Caption[1]  = "Christine Trowbridge, supervisor of masonry trades, prepares a loaf of clay to be molded.";
Caption[2]  = "Christine Trowbridge presses a loaf of clay into the mold. ";
Caption[3]  = "In a process called \“striking,\” a board is pulled across the wet clay to smooth it and get rid of the excess.";
Caption[4]  = "Apprentice Jason Whitehead \“butters\” a brick, placing mortar on the edge of the brick to be placed in the wall he is building.";
Caption[5]  = "Jason sets the end brick, a glazed header, in a Flemish bond pattern.";
Caption[6]  = "The trowel Jason uses was made by Colonial Williamsburg Historic Area blacksmiths, reproduced from an original.";
Caption[7]  = "The lime mortar in the brickyard is made from burnt oyster shells.";
Caption[8] = "Flemish bond – popular between 1730 and 1750 – uses glazed \“headers\” or bricks set on end next to the \“stretchers\” or bricks laid on their sides.";
Caption[9] = " Bricks laid in English bond, with no glazed headers, are often used in foundations.";
Caption[10] = "A leveling tool insures the bricks are level.";
Caption[11] = "The fire glows in the kiln during the fall brick burn, which lasts about a week in October.";
Caption[12] = "William Neff tends the kiln fire, stirring the coals with an eight-foot iron hook, as Jason Whitehead looks on.";
Caption[13] = "Brickmakers use the fire in the foreground for warmth as they tend the kiln, in the background, ’round the clock during the brick burn.";
Caption[14] = "Jason Whitehead opens the kiln door while Chris Trowbridge observes the glow of the bricks to measure the temperature of the kiln. Larry Reynolds carries wood for the fire, while Val Povinelli and Chad Jones observe.";
Caption[15] = "Bill Neff and Larry Reynolds add wood to the fire. The bricks of the kiln are smeared with dirt and ash to help insulate it.";

var tss;
var iss;
var jss = 0;
var pss = Caption.length-1;
//pss = 1

//set images based on number of captions
var Picture = new Array();
for (iss = 0; iss < pss+1; iss++){
Picture[iss] = 'images/' + (iss + 1) + '.jpg';
}


var preLoad = new Array();
//while iss is less than the number of captions
for (iss = 0; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}




//start rollover script
//set thumbnails based on number of captions
var thumbState = new Array();
thumbState[0] =  'down';
for (iss = 1; iss < pss+1; iss++){
thumbState[iss] = 'up';
}

var thisThumbState;


 function changeColorOn (flag) {
var thisThumb = "thumb" + flag;
document.getElementById(thisThumb).style.backgroundColor = "#908D96"; //over color
 }


 function changeColorOut (flag) {
var clr;
var thisThumb = "thumb" + flag;
var thisThumbState = thumbState[flag];
if (thisThumbState == "up") {
		 clr = "#696471";  } //regular color
	else if (thisThumbState == "down") {
		clr="#423F47";	} //down color

document.getElementById(thisThumb).style.backgroundColor = clr;
 }
//end rollover script

//next and back button scripts


var nextB = "false"; // not _over
var backB = "true" // _over
var activeF = true;
var activeB = false;




function changeBackPointer (status) 
{
	if (activeB)
	{
		if (status == 'bckOver')
		{
			document.images.backB.src = 'images/back_over.gif';
		}
		else if (status == 'bckDown')
		{
			document.images.backB.src = 'images/back.gif';
		}
	}
}
	
function changeNextPointer (status) 	
{
	if (activeF)
	{
		if (status == 'nxtOver')
		{
			document.images.next.src = 'images/next_over.gif';
		}
		else if (status == 'nxtDown')
		{
			document.images.next.src = 'images/next.gif';
		}
	}
}

//end next and back button scripts

var x=0;


//setting thumb state

function thumbs(n,thumbnail){

//onclick sets the old thumb to up and the new to down
var setThisUpThumb = "thumb" + x;
var setThisDownThumb = "thumb" + n;

thumbState[x] = "up";
thumbState[n] = "down";

document.getElementById(setThisUpThumb).style.backgroundColor = "#696471"; //regular color
document.getElementById(setThisDownThumb).style.backgroundColor = "#423F47"; // down color


  
jss = n;
x = n;


if (thumbnail == true) control('T');
//alert(jss);
}

//end setting thumb state



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 (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';


}
}
