var pictures = Array ("EighteenthAndSpringGarden", "EighteenthStreet", "Annex", "SpringGardenAcademy", "Pulpit", "Pews",
                       "Organ");
 var numberOfPictures = pictures.length;
var EighteenthAndSpringGardenInfo = 'In 1960, Highway Tabernacle moved to the a pre-Civil War building on the corner of 18th and Spring Garden Streets'
                                   +' in Center City Philadelphia.';
var EighteenthStreetInfo = 'The building building is located in the Spring Garden Historical District and is, therefore, architecturally true'
                                   +' to its 19th-century heritage.';
var AnnexInfo = 'The portion of the building dubbed "the annex," although a part of the original building, was modernized on the inside to accommodate'
                 +' classrooms, a small chapel, a full kitchen, and a fellowship hall.';
var SpringGardenAcademyInfo = 'The home of Spring Garden Academy.'
var PulpitInfo = 'The building survived a major fire in'
                + ' 1986 and was restored over a period of three years.'
var PewsInfo = 'In 2003, the building underwent some long-overdue repairs to the flooring system and heating system, with the help of volunteers from'
               +' churches as far north as Newark, New Jersey, and as far west as California.';
var OrganInfo = 'The Hilborne L. Roosevelt organ, restored by Patrick'
               +' J. Murphy and Associates, is still played in worship services.'
var firstPicture = pictures[0];
var previousPicture = firstPicture;
 //load all of the images into cache
if (location.search.indexOf("Building")+1) {
   var pictureImageArray = Array (numberOfPictures);
   for (imageIndex = 0; imageIndex < numberOfPictures; imageIndex++) {
     pictureImageArray [imageIndex] = new Image();
    pictureImageArray[imageIndex].src = "Graphics/Building/" + pictures[imageIndex] + ".jpg";
   }
 }
 function expanded () {
   var tempString = "";
   for (stringIndex = 0; stringIndex < this.length; stringIndex++) {
      if (stringIndex > 0 && this.charAt(stringIndex).toUpperCase() == this.charAt(stringIndex))
        tempString += " ";
      tempString += this.charAt(stringIndex);
   }
  return (tempString);
 }
 String.prototype.expanded = expanded;

 function showMe (thePicture) {
  var thePic = "Graphics/Building/" + thePicture + ".jpg";
 document.SplashImage.src = thePic;
 document.Photosphere.PictureTitle.value = thePicture.expanded();
 document.Photosphere.PictureInfo.value = eval (thePicture + "Info");
  if (previousPicture != thePicture && !oldJavaVersion) {
    var theElement = document.getElementById(thePicture); 
   theElement.className = "Highlighted";
    theElement = document.getElementById(previousPicture); 
   theElement.className = previousPicture;
    theElement = document.getElementById("HREF" + thePicture);
   theElement.className = "Highlighted";
    theElement = document.getElementById("HREF" + previousPicture); 
   theElement.className = previousPicture;
    theElement = document.getElementById("IMG" + thePicture);
   theElement.className = "Highlighted";
    theElement = document.getElementById("IMG" + previousPicture); 
   theElement.className = previousPicture;
    previousPicture = thePicture;
  }
 }
 var picturesText = '<Form Name="Photosphere">'
                   +'<Table><TR>'
                   +'<TD Class="Highlighted">'
                   +'<IMG Name="SplashImage" Src="Graphics/Building/' + firstPicture + '.jpg" onError="this.src=\'Photos/PhotoUnavailable.gif\'">'
                   +'</TD><TD Align="Center" Class="Highlighted">'
                   +'<Input Type="Text" Name="PictureTitle" Size="70"  Style="Background:Transparent; Border:None; Text-Align:Center; Cursor:Default;'
                   +' Font-Family:Arial; Font-Weight=Bold; Font-Size:13"'
                   +' Value="' + firstPicture.expanded() + '" ReadOnly><BR>'
                   +'<Textarea Name="PictureInfo" Rows="11" Cols="70" Style="Background:Transparent; Border:None; Text-Align:Justify;'
                   +' Font-Family:Arial; Font-Size:12; Cursor:Default;" ReadOnly>'
                   + eval (firstPicture + "Info")
                   +'</Textarea>'
                   +'</TD></TR>'
                   +'</Table>'
                   +'</Form>'
                   +'<Table style="font-size:\'10\'" Cellpadding="6"><TR>';
 var midPoint       = Math.round(numberOfPictures/2);
 for (pictureIndex = 0; pictureIndex <numberOfPictures; pictureIndex++) {
   var alignDirection = (pictureIndex % 2) ? "Left" : "Right";
  var pictureName = pictures[pictureIndex];
  var pictureClass = (pictureIndex) ? pictureName : "Highlighted";
  var theHref       = (oldJavaVersion) ? "javascript:showMe('" + pictureName + "');" :
                                         'javascript:void(0);" '
                                        +'onClick="if (this.className != \'Highlighted\') { showMe(\'' + pictureName + '\'); return(false);}';
  picturesText += '<TD Align="Center" Valign="Top"  Class="' + pictureClass + '" ID="' + pictureName + '">'
                  +'<A  Class="' + pictureClass + '" ID="IMG' + pictureName + '"'
                  +' Href="' + theHref + '"'
                  +'><B>'
                  +'<IMG Name="' + pictureName + '" SRC="Graphics/Building/' + pictureName + 'Thumb.gif" '
                  +'onError="this.src=\'Photos/PhotoUnavailableThumb.gif\';" Border="0"></A><BR>'
                  +'<A Class="' + pictureClass + '" ID="HREF' + pictureName + '"'
                  +' Href="' + theHref + '"';
   if (!oldJavaVersion)
      picturesText+= ' Style="text-decoration:None; font-size:10;"';
   picturesText += '>' + pictureName.expanded() + '</A></TD>';
  if (pictureIndex == midPoint-1)  picturesText += '</TR><TR>';
  }
  picturesText += '</TR></Table>'

