// JavaScript Document
// ideas taken from week 9 study guide page 3
// For photo album 1 on photo_album.html in the top left hand side
// For photo album 2 on photo_album.html in the top right hand side
var swap_Photos1 = { 
pots : [ 
          { "title":"Evening Sunset", "path":"Images/photo1.jpg" }, 
          { "title":"Cirrus Clouds", "path":"Images/photo2.jpg" }, 
          { "title":"Lightning over Sydney", "path":"Images/photo3.jpg"}, 
          { "title":"Lenticular Smooth Clouds", "path":"Images/photo4.jpg"},  
          { "title":"Windmils", "path":"Images/photo5.jpg"}, 
          { "title":"The Snow Scene", "path":"Images/photo6.jpg"}, 
          { "title":"Streaky Skies", "path":"Images/photo7.jpg"}, 
		  { "title":"Mountains By the Waterside", "path":"Images/photo8.jpg" } 
], 
pos : 0, 
//id = a string, id of image 
//dir = a string, plus + or minus - sign 
//titleId = a string, id of element to display title  
switchImage1 : function (id,dir,titleId) { 
if (dir == '-') { 
this.pos = (this.pos > 0) ? this.pos-1 : this.pots.length-1; 
} else if (dir == '+') { 
this.pos = (this.pos < this.pots.length - 1) ? this.pos+1 : 0; 
} 
document.getElementById(id).src = this.pots[this.pos]["path"]; 
document.getElementById(titleId).innerHTML = this.pots[this.pos]['title']; 
return false; 
} 
};


window.onload = function () { 
swap_Photos1.switchImage1('switchable',0,'title');
};


