// 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
var swap_Photos = { 
pots : [ 
          { "title":"Sunrise", "path":"Scripts/Images/sunrise.jpg" }, 
          { "title":"Altocumulus Clouds", "path":"Scripts/Images/altocumulus.jpg" }, 
          { "title":"Cumulus Fractus Clouds", "path":"Scripts/Images/cumulus_fractus.jpg"}, 
          { "title":"Cirrus Spissatus Cloud", "path":"Scripts/Images/cirrus_spiss.jpg"},  
          { "title":"Cumulus Congestus Cloud", "path":"Scripts/Images/CumulusCongestus.jpg"}, 
          { "title":"Cumulus Mediocris Cloud", "path":"Scripts/Images/cumulus_mediocris.jpg"}, 
          { "title":"Nimbostratus", "path":"Scripts/Images/nimbostratus.jpg"}, 
		  { "title":"Blue Sky", "path":"Scripts/Images/blue_sky.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  
switchImage : 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_Photos.switchImage('switchable',0,'title');
};

// For photo album 2 on photo_album.html in the top right hand side
var swap_Photos1 = { 
pots : [ 
          { "title":"Evening Sunset", "path":"Images/sunset.jpg" }, 
          { "title":"Cirrus Clouds", "path":"Images/CumulusCongestus.jpg" }, 
          { "title":"Lightning over Sydney", "path":"Images/lightning1.jpg"}, 
          { "title":"Lenticular Smooth Clouds", "path":"Images/lenticular.jpg"},  
          { "title":"Windmils", "path":"Images/windmills.jpg"}, 
          { "title":"The Snow Scene", "path":"Images/snow_scene.jpg"}, 
          { "title":"Streaky Skies", "path":"Images/lightning2.jpg"}, 
		  { "title":"Mountains By the Waterside", "path":"Images/bythewaterside.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');
};

// For photo album 3 on photo_album.html in the bottom left hand side
var swap_Photos2 = { 
pots : [ 
          { "title":"Sunrise", "path":"Images/sunrise.jpg" }, 
          { "title":"Altocumulus Clouds", "path":"Images/altocumulus.jpg" }, 
          { "title":"Cumulus Fractus Clouds", "path":"Images/cumulus_fractus.jpg"}, 
          { "title":"Cirrus Spissatus Cloud", "path":"Images/cirrus_spiss.jpg"},  
          { "title":"Cumulus Congestus Cloud", "path":"Images/CumulusCongestus.jpg"}, 
          { "title":"Cumulus Mediocris Cloud", "path":"Images/cumulus_mediocris.jpg"}, 
          { "title":"Nimbostratus", "path":"Images/nimbostratus.jpg"}, 
		  { "title":"Blue Sky", "path":"Images/blue_sky.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  
switchImage2 : 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_Photos2.switchImage2('switchable',0,'title');
};

// For photo album 4 on photo_album.html in the bottom right hand side

var swap_Photos3 = { 
pots : [ 
          { "title":"Sunrise", "path":"Images/sunrise.jpg" }, 
          { "title":"Altocumulus Clouds", "path":"Images/altocumulus.jpg" }, 
          { "title":"Cumulus Fractus Clouds", "path":"Images/cumulus_fractus.jpg"}, 
          { "title":"Cirrus Spissatus Cloud", "path":"Images/cirrus_spiss.jpg"},  
          { "title":"Cumulus Congestus Cloud", "path":"Images/CumulusCongestus.jpg"}, 
          { "title":"Cumulus Mediocris Cloud", "path":"Images/cumulus_mediocris.jpg"}, 
          { "title":"Nimbostratus", "path":"Images/nimbostratus.jpg"}, 
		  { "title":"Blue Sky", "path":"Images/blue_sky.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  
switchImage3 : 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_Photos3.switchImage3('switchable',0,'title');
};

