// JavaScript Document

// for rotating images slideshow

var curimg=1;
var imageLink=new Array();
imageLink[1] = 'photos/1.jpg';
imageLink[2] = 'photos/2.jpg';
imageLink[3] = 'photos/3.jpg';
imageLink[4] = 'photos/4.jpg';
imageLink[5] = 'photos/5.jpg';
imageLink[6] = 'photos/6.jpg';



function rotateimages(){
document.getElementById("slideshow").setAttribute("src", "photos/"+galleryarray[curimg]);
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
addLink();
}
function rotateimage(direction) {
if (direction == 'forward') {
curimg=(curimg<galleryarray.length)? curimg+1 : 1
document.getElementById("slideshow").setAttribute("src", "photos/"+[curimg]+".jpg");
addLink();

}
if (direction == 'backward')
curimg=(curimg<=1)? galleryarray.length : curimg-1 
document.getElementById("slideshow").setAttribute("src", "photos/"+[curimg]+".jpg");
addLink();

}

function loaded(){
setInterval("rotateimage('forward')", 5000);
addLink();
}
function addLink() {
var var1 = document.getElementById("slideshow").getAttribute("src"); 
var var2 = var1.split("/");
var var3 = var2[1].split(".");
var var4 = var3[0];
document.getElementById("slideShowImage").setAttribute("href", imageLink[var4]);
}


