

var captions_on = "yes";
var random_on = "yes";

var names = new Array()
names["seal"] = "seal";
names[0] = "0";
names[1] = "1";
names[2] = "2";
names[3] = "3";
names[4] = "4";
names[5] = "5";
names[6] = "6";
names[7] = "7";
names[8] = "8";
names[9] = "9";
names[10] = "10";
names[11] = "11";
names[12] = "12";
names[13] = "13";
names[14] = "14";
names[15] = "15";
names[16] = "16";
names[17] = "17";
names[18] = "18";
names[19] = "19";
names[20] = "20";
names[21] = "21";


var photos = new Array()
photos["seal"] = "seal.jpg";
photos[0] = "1.jpg";
photos[1] = "2.jpg";
photos[2] = "3.jpg";
photos[3] = "4.jpg";
photos[4] = "5.jpg";
photos[5] = "6.jpg";
photos[6] = "7.jpg";
photos[7] = "8.jpg";
photos[8] = "9.jpg";
photos[9] = "10.jpg";
photos[10] = "11.jpg";
photos[11] = "12.jpg";
photos[12] = "13.jpg";
photos[13] = "14.jpg";
photos[14] = "15.jpg";
photos[15] = "16.jpg";
photos[16] = "17.jpg";
photos[17] = "18.jpg";
photos[18] = "19.jpg";
photos[19] = "20.jpg";
photos[20] = "21.jpg";
photos[21] = "22.jpg";




// THIS IS WHERE YOU ADD THE PHOTO CAPTIONS


var captions = new Array()
captions["seal"] = "Medford, Massachusetts<br>Founded in 1630, Incorporated as a City in 1892";
captions[0] = "Residence, c.1868<br>185 High Street";
captions[1] = "Grace Episcopal Church, c.1870<br>160 High Street";
captions[2] = "Usher Building, c.1869<br>West Medford Square";
captions[3] = "Chevalier Auditorium, c.1939<br>30 Forest Street";
captions[4] = "Paul Curtis House, c.1839<br>114 South Street";
captions[5] = "Isaac Royall House & Slave Quarters, c.1737<br>15 George Street";
captions[6] = "Terrace Road View";
captions[7] = "Barnum Hall, Tufts College, c.1884<br>163 Packard Avenue";
captions[8] = "Residence, c.1880<br>112 Otis Street";
captions[9] = "Shepherd Brooks Manor, c.1880<br>Grove Street";
captions[10] = "Two bridges, Mystic River";
captions[11] = "Medford City Hall, c.1937";
captions[12] = "Lawrence Light Guard Armory, c.1905<br>90 High Street";
captions[13] = "Jonathan Brooks House, c.1786<br>2 Woburn Street";
captions[14] = "John B. Angier House, c.1842<br>129 High Street";
captions[15] = "Nathan Sawyer Cottage, c.1780<br>306 Riverside Avenue";
captions[16] = "Rev. David Osgood House, c.1785<br>141 High Street";
captions[17] = "Park Street Station, c.1910<br>121 Washington Street";
captions[18] = "Residence, c.1875<br>35 Grandview Avenue";
captions[19] = "Rev. Charles Brooks House, c.1765<br>309 High Street";
captions[20] = "Residence, c.1890<br>8 Grandview Avenue";
captions[21] = "Residence, c.1855<br>67 Washington Street";



// DO NOT EDIT BEYOND THIS POINT AND THE ONE BELOW



var chosen = "-";

var over = "no";
var current_element;
var the_time;
var the_window;
var the_link;
var hillslides = new Array("GA8","GA8b","GA25","GA26","GA27","GA31","GA35","GA36","GA37","HA7","HA15","HA16","HA20","HA21","HA24","HA26","HA27","HA30","HA31","HA32","HA35","HA36","GOV10","GOV12","GOV34","PR39","PR41","PR43");
var hillslidesm = hillslides.length;
var hillslidesc;
var marmslides = new Array("HS246","HS247","HS248","HS250","HS252","HS253","HS265","HS269","HS273","HS279","HS281","HS283","HS298","HS305","HS309","DR2","WR8","WR12","WR14","WR16","ROW1274","WS2","WS12","WS16","WS18","WS22","WS24");
var marmslidesm = marmslides.length;
var marmslidesc;
var shipslides = new Array("SS1","SS2","SS3","SS4","SS5","SS6","SS7","SS8","SS9","SS10","SS11","SS12","SS13","SS14","SS15","SS16","SS17");
var shipslidesm = shipslides.length;
var shipslidesc;
var showing = 0;




// THE NUMBER OF PICTURES -1

var photo_variable = 21;

// CHANGE THE NUMBER


function preloadImages()
{
for(var a = 0; a < photo_variable; a++)	
{
var an_image = new Image();
an_image.src = photos[a];
}
}


function randomImages()
{
if(random_on == "yes")
{



// THIS IS THE LINE THAT NEEDS TO BE CHANGED WHEN YOU ADD A PICTURE


for(b = 0; b < 22; b++)


// CHANGE THE "c < x" (FOR x = "# of Photos")



{
if(document.getElementById(b))
{
rand_number = Math.round(Math.random()*photo_variable+1);
while(chosen.indexOf("-" + rand_number) != -1)
{
rand_number = Math.round(Math.random()*photo_variable+1);
}
chosen += "-" + rand_number;
document.getElementById(b).name = rand_number - 1;
document.getElementById("img" + b).src = rand_number + ".jpg";
}
}
}
}

function switchImage(the_element)
{
if(captions_on == "yes")
{
if(over == "yes")
{
if(the_element != current_element)
{
clearTimeout(the_time);
fixImage(current_element);
current_element = the_element;
switchImage(current_element);
}
}else{
var the_name = the_element.name;
if(the_name != "seal")
{
the_name = eval(the_name);
}
var the_insert = captions[the_name];
var the_other_name = the_element.name;
if(the_other_name != "seal")
{
the_other_name = eval(the_other_name);
}
var the_other_insert = photos[the_other_name];
the_insert = "<img id=\"over\" src=\"" + the_other_insert + "\"><br><span id=\"img\">" + the_insert + "</span>"
the_element.innerHTML = the_insert;
over = "yes";
current_element = the_element;
the_time = setTimeout("fixImage(current_element);",4000);
}
}
}

function fixImage(the_element)
{
var the_name = the_element.name;
if(the_name != "seal")
{
the_name = eval(the_name);
}
var the_insert = photos[the_name];
the_insert = "<img class=\"img\" src=\"" + the_insert + "\">";
the_element.innerHTML = the_insert;
over = "no";
}


function openPicture(picture,size)
{
the_link = picture;
if(the_link != "hillslide" && the_link != "marmslide" && the_link != "shipslide")
{
if(size == "wide")
{
the_window = open("picture.html","window","width=600,height=450");
setTimeout("the_window.document.getElementById('picture').src = the_link; the_window.focus();",1000);
}else if(size == "tall")
{
the_window = open("picture.html","window","width=450,height=600");
setTimeout("the_window.document.getElementById('picture').style.width = 450; the_window.document.getElementById('picture').src = the_link; the_window.focus();",1000);
}
}else if(the_link == "hillslide")
{
the_window = open("picture.html","window","width=600,height=450");
hillslidesc = 0;
setTimeout("hillSlide();",1000);
}else if(the_link == "marmslide")
{
the_window = open("picture.html","window","width=600,height=450");
marmslidesc = 0;
setTimeout("marmSlide();",1000);
}else if(the_link == "shipslide")
{
the_window = open("picture.html","window","width=600,height=450");
shipslidesc = 0;
setTimeout("shipSlide();",1000);
}
}

function hillSlide()
{
if(hillslidesc < hillslidesm)
{
if(the_window)
{
the_window.document.getElementById("picture").src = ("http://home.comcast.net/~glawsim/Photos/Hillside/" + hillslides[hillslidesc] + ".jpg");
hillslidesc++;
setTimeout("hillSlide();",5000);
}
}else{
if(the_window)
{
the_window.close();
}
}
}


function marmSlide()
{
if(marmslidesc < marmslidesm)
{
if(the_window)
{
the_window.document.getElementById("picture").src = ("Marm/" + marmslides[marmslidesc] + ".jpg");
marmslidesc++;
setTimeout("marmSlide();",5000);
}
}else{
if(the_window)
{
the_window.close();
}
}
}

function shipSlide()
{
if(shipslidesc < shipslidesm)
{
if(the_window)
{
the_window.document.getElementById("picture").src = ("Ship/" + shipslides[shipslidesc] + ".jpg");
shipslidesc++;
setTimeout("shipSlide();",5000);
}
}else{
if(the_window)
{
the_window.close();
}
}
}


function checkKey()
{
if(event.keyCode == 67)
{
toggleCounter();
}
}

function toggleCounter()
{
if(showing == 1)
{
document.getElementById("counter").style.visibility = "hidden";
showing = 0;
}else if(showing == 0)
{
if(prompt("Password:","") == "historical")
{
document.getElementById("counter").style.visibility = "visible";
showing = 1;
}
}
}


