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/far01.jpg",
"photo/fie01.jpg",
"photo/fie02.jpg",
"photo/hpg01.jpg",
"photo/hpg02.jpg",
"photo/hun01.jpg",
"photo/hun02.jpg",
"photo/hun03.jpg",
"photo/ind01.jpg",
"photo/ind02.jpg",
"photo/ind03.jpg",
"photo/ind04.jpg",
"photo/mil01.jpg",
"photo/pre01.jpg",
"photo/pre02.jpg",
"photo/pre03.jpg",
"photo/pre04.jpg",
"photo/ope01.jpg",
"photo/ope02.jpg",
"photo/ope03.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",
"photo/war01.jpg",
"photo/war02.jpg",
"photo/wod01.jpg");


var myText = new Array(
"#1 Theme 1 Ancient Boundaries & Land Ownership: Late Iron Age Tribal Groupings.",
"#2 Theme 1 Ancient Boundaries & Land Ownership: Approximate Late Roman Administrative boundaries",
"#3 Theme 1 Ancient Boundaries & Land Ownership: Appearance and spread of Anglo Saxon Culture in the late 5th and 6th Centuries AD.",
"#4 Theme 1 Ancient Boundaries & Land Ownership: Ancient Shire Boundaries.",
"#5 Theme 1 Ancient Boundaries & Land Ownership: Ancient Parish Boundaries.",
"#6 Theme 1 Ancient Boundaries & Land Ownership: Medieval Government the Location of Hundreds.",
"#7 Theme 1 Ancient Boundaries & Land Ownership: Major Landholders of the Medieval Period pre 1530s.",
"#8 Theme 1 Ancient Boundaries & Land Ownership: Major Landholders of the Post Medieval Period post 1530s.",
"#9 Theme 2 Farms and Farming: Pre 1800 Farmsteads.",
"#10 Theme 3 Fields in the Landscape: Ancient field systems in Wiltshire.",
"#11 Theme 3 Fields in the Landscape: Overview of Enclosed Land in the AONB.",
"#12 Theme 4 Historic Parks and Gardens: Overview.",
"#13 Theme 4 Historic Parks and Gardens: Medieval Deer Parks.",
"#14 Theme 5 Hunting Landscapes: Medieval Chase and Forests in the vicinity of the AONB.",
"#15 Theme 5 Hunting Landscapes: Location of the 'walks' in the Cranborne Chase.",
"#16 Theme 5 Hunting Landscapes: Location of the Inner and Outer Boundaries of the Cranborne Chase.",
"#17 Theme 6 Industry: Water Mills in the AONB.",
"#18 Theme 6 Industry: Windmills in the AONB.",
"#19 Theme 6 Industry: Quarries in the AONB.",
"#20 Theme 6 Industry: Other Industrial Sites in the AONB.",
"#21 Theme 7 Military Landscapes: Military Sites in the AONB.",
"#22 Theme 8 Landscapes of Prehistory: Palaeolithic, Mesolithic and Neolithic find spots.",
"#23 Theme 8 Landscapes of Prehistory: Bronze Age Round Barrows.",
"#24 Theme 8 Landscapes of Prehistory: Neolithic Long Barrows, Causewayed Enclosures and Henges",
"#25 Theme 8 Landscapes of Prehistory: Landscape of the Cursus.",
"#26 Theme 9 Open Land in the AONB: Open Land Overview.",
"#27 Theme 9 Open Land in the AONB: Common Land in the AONB.",
"#28 Theme 9 Open Land in the AONB: Chalk Grassland.",
"#29 Theme 10 Routeways in the Landscape: Roads, Tracks, Lanes and Paths in the AONB.",
"#30 Theme 10 Routeways in the Landscape: Date of creation of Turnpike Roads.",
"#31 Theme 10 Routeways in the Landscape: Turnpike Roads in Today's Landscape.",
"#32 Theme 10 Routeways in the Landscape: The Character of Roman Roads between AD1700-1900.",
"#33 Theme 10 Routeways in the Landscape: Roads in Roman Times.",
"#34 Theme 10 Routeways in the Landscape: Roman Roads in Today's Landscape.",
"#35 Theme 10 Routeways in the Landscape: Drove ways in the AONB",
"#36 Theme 10 Routeways in the Landscape: Railways in the AONB.",
"#37 Theme 11 Settlement: Later Prehistoric Settlement.",
"#38 Theme 11 Settlement: Roman Settlement.",
"#39 Theme 11 Settlement: Archaeological evidence for Early Saxon Settlement.",
"#40 Theme 11 Settlement: Deserted or Shrunken Medieval Settlements.",
"#41 Theme 11 Settlement: Age of today's settlement in the AONB.",
"#42 Theme 11 Settlement: Morphology of today's settlement in the AONB",
"#42 Theme 12 Water: Water based features in the AONB",
"#42 Theme 12 Water: Water Meadows in the AONB",
"#43 Theme 13 Trees and 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 + ")";
}


