var count = 0;
var windowWidth;
var windowHeight;


function initialize() {
	var splitArray = photoList[0].split("|");
	setContent(splitArray);
}

function forward() {
	count++;
	if (count > photoList.length - 1 ) {
		count = 0;
	}
	var splitArray = photoList[count].split("|");
	setContent(splitArray);
}

function back() {
	count--;
	if (count < 0) {
		count = photoList.length - 1;
	}
	var splitArray = photoList[count].split("|");
	setContent(splitArray);
}

function setContent(contentArray) {

	var oldPhoto=document.getElementById("photo");
	var newPhoto=document.createElement("img");
	var divParent;

	document.getElementById("artist").firstChild.firstChild.data=contentArray[0];
	document.getElementById("title").firstChild.data=contentArray[1];
	document.getElementById("media").firstChild.data=contentArray[2];
	document.getElementById("edition1").firstChild.data=contentArray[3];
	document.getElementById("edition2").firstChild.data=contentArray[4];
	newPhoto.src = contentArray[5];
	newPhoto.id = "photo";
	divParent = oldPhoto.parentNode;
	divParent.replaceChild(newPhoto, oldPhoto);
	newPhoto.setAttribute("width",contentArray[6]);
	newPhoto.setAttribute("height",contentArray[7]);
	newPhoto.setAttribute("src",contentArray[5]);
}
