window.onload = initLinks;

var myPhoto = new Array(
"img_content/ahorn-8saitig-optimiert/01.jpg",
"img_content/ahorn-8saitig-optimiert/02.jpg",
"img_content/ahorn-8saitig-optimiert/03.jpg",
"img_content/ahorn-8saitig-optimiert/04.jpg",
"img_content/ahorn-8saitig-optimiert/05.jpg",
"img_content/ahorn-8saitig-optimiert/06.jpg")



var myText = new Array(
"1",
"2",
"3",
"4",
"5",
"6")



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 = 0 + "px";
	}
	else {
		document.getElementById("myPicture").style.marginTop = 0 + "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 = 0 + "px";
	}
	else {
		document.getElementById("myPicture").style.marginTop = 0 + "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 + ")";
}


