window.onload = initLinks;

var myPhoto = new Array(
"images/gallery1/01.jpg",
"images/gallery1/02.jpg",
"images/gallery1/03.jpg",
"images/gallery1/04.jpg",
"images/gallery1/05.jpg",
"images/gallery1/06.jpg",
"images/gallery1/07.jpg",
"images/gallery1/08.jpg",
"images/gallery1/09.jpg",
"images/gallery1/10.jpg",
"images/gallery1/11.jpg",
"images/gallery1/12.jpg",
"images/gallery1/13.jpg",
"images/gallery1/14.jpg",
"images/gallery1/15.jpg",
"images/gallery1/16.jpg",
"images/gallery1/17.jpg",
"images/gallery1/18.jpg",
"images/gallery1/19.jpg",
"images/gallery1/20.jpg",
"images/gallery1/21.jpg",
"images/gallery1/22.jpg",
"images/gallery1/23.jpg",
"images/gallery1/24.jpg",
"images/gallery1/25.jpg",
"images/gallery1/26.jpg",
"images/gallery1/27.jpg",
"images/gallery1/28.jpg",
"images/gallery1/29.jpg",
"images/gallery1/30.jpg");


var myText = new Array(
"London Life 01",
"London Life 02",
"London Life 03",
"London Life 04",
"London Life 05",
"London Life 06",
"London Life 07",
"London Life 08",
"London Life 09",
"London Life 10",
"London Life 11",
"London Life 12",
"London Life 13",
"London Life 14",
"London Life 15",
"London Life 16",
"London Life 17",
"London Life 18",
"London Life 19",
"London Life 20",
"London Life 21",
"London Life 22",
"London Life 23",
"London Life 24",
"London Life 25",
"London Life 26",
"London Life 27",
"London Life 28",
"London Life 29",
"London Life 30");

var thisPhoto = 0;

function initLinks() {
	document.getElementById("previous").onclick = processPrevious;
	document.getElementById("next").onclick = processNext;
}


function processPrevious() {
	changeOpac(0)
	if (thisPhoto == 0) {
		thisPhoto = myPhoto.length;
	}
	thisPhoto--;
	document.getElementById("myPicture").src = myPhoto[thisPhoto];
	if (document.getElementById("myPicture").src.indexOf("v") != -1)
	{
		document.getElementById("myPicture").style.marginTop = 10 + "px";
	}
	else {
		document.getElementById("myPicture").style.marginTop = 50 + "px";
	}
	document.getElementById('pictureText').innerHTML = myText[thisPhoto];
	opacityShow()
	return false;
}

function processNext() {
	changeOpac(0)
	thisPhoto++;
	if (thisPhoto == myPhoto.length) {
		thisPhoto = 0;
	}
	document.getElementById("myPicture").src = myPhoto[thisPhoto];
	if (document.getElementById("myPicture").src.indexOf("v") != -1)
	{
		document.getElementById("myPicture").style.marginTop = 10 + "px";
	}
	else {
		document.getElementById("myPicture").style.marginTop = 50 + "px";
	}
	document.getElementById('pictureText').innerHTML = myText[thisPhoto];
	opacityShow()
	return false;
}


function opacityFade() {
	timer = 900;
	for(i = 100; i >= 0; i--) {
		setTimeout("changeOpac(" + i + ")",(timer));
		timer=timer+2;
	}
}
function opacityShow() {
	timer = 900;
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ")",(timer));
	timer=timer+2;
	}
}

function changeOpac(opacity) {
	var object = document.getElementById('myPicture').style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

