window.onload = initLinks;

var myPhoto = new Array(
"photo/bou01.jpg",
"photo/bou02.jpg",
"photo/bou03.jpg",
"photo/bou04.jpg",
"photo/bou05.jpg",
"photo/bou06.jpg",
"photo/bou07.jpg",
"photo/bou08.jpg",
"photo/fie01.jpg",
"photo/fie02.jpg",
"photo/hpg01.jpg",
"photo/hpg02.jpg",
"photo/hun01.jpg",
"photo/hun02.jpg",
"photo/hun03.jpg",
"photo/pre01.jpg",
"photo/pre02.jpg",
"photo/pre03.jpg",
"photo/pre04.jpg",
"photo/rou01.jpg",
"photo/rou02.jpg",
"photo/rou03.jpg",
"photo/rou04.jpg",
"photo/rou05.jpg",
"photo/rou06.jpg",
"photo/rou07.jpg",
"photo/rou08.jpg",
"photo/set01.jpg",
"photo/set02.jpg",
"photo/set03.jpg",
"photo/set04.jpg",
"photo/set05.jpg",
"photo/set06.jpg");


var myText = new Array(
"#1. Ancient Boundaries & Land Ownership: Late Iron Age Tribal Groupings.",
"#2  Ancient Boundaries & Land Ownership: Approximate Late Roman Administrative boundaries",
"#3 Ancient Boundaries & Land Ownership: Appearance and spread of Anglo Saxon Culture in the late 5th and 6th Centuries AD.",
"#4 Ancient Boundaries & Land Ownership: Ancient Shire Boundaries.",
"#5 Ancient Boundaries & Land Ownership: Ancient Parish Boundaries.",
"#6 Ancient Boundaries & Land Ownership: Medieval Government the Location of Hundreds.",
"#7 Ancient Boundaries & Land Ownership: Major Landholders of the Medieval Period pre 1530s.",
"#8 Ancient Boundaries & Land Ownership: Major Landholders of the Post Medieval Period post 1530s.",
"#9 Fields Theme: Ancient field systems in Wiltshire.",
"#10 Fields Theme: Overview of Enclosed Land in the AONB.",
"#11 Historic Parks and Gardens: Overview.",
"#12 Historic Parks and Gardens: Medieval Deer Parks.",
"#13 Hunting Landscapes: Medieval Chase and Forests in the vicinity of the AONB.",
"#14 Hunting Landscapes: Location of the 'walks' in the Cranborne Chase.",
"#15 Hunting Landscapes: Location of the Inner and Outer Boundaries of the Cranborne Chase.",
"#16 Landscapes of Prehistory: Palaeolithic, Mesolithic and Neolithic find spots.",
"#17 Landscapes of Prehistory: Bronze Age Round Barrows.",
"#18 Landscapes of Prehistory: Neolithic Long Barrows, Causewayed Enclosures and Henges",
"#19 Landscapes of Prehistory: Landscape of the Cursus.",
"#20 Routeways in the Landscape: Roads, Tracks, Lanes and Paths in the AONB.",
"#21 Routeways in the Landscape: Date of creation of Turnpike Roads.",
"#22 Routeways in the Landscape: Turnpike Roads in Today's Landscape.",
"#23 Routeways in the Landscape: The Character of Roman Roads between AD1700-1900.",
"#24 Routeways in the Landscape: Roads in Roman Times.",
"#25 Routeways in the Landscape: Roman Roads in Today’s Landscape.",
"#26 Routeways in the Landscape: Drove ways in the AONB",
"#27 Routeways in the Landscape: Railways in the AONB.",
"#28 Settlement: Later Prehistoric Settlement.",
"#29 Settlement: Roman Settlement.",
"#30 Settlement: Archaeological evidence for Early Saxon Settlement.",
"#31 Settlement: Deserted or Shrunken Medieval Settlements.",
"#32 Settlement: Age of today's settlement in the AONB.",
"#33 Settlement: Morphology of today's settlement in the AONB",
"#34 Woodland: Woodland in the AONB.");

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 + ")";
}

