//window.onload=initLinks;

function showPic(element){	
	if(!document.getElementById("photoHolder")){
		return false;
	}
	var image = document.getElementById("photoHolder");
	image.setAttribute('src',element.src);
	document.getElementById("photoUrl").innerHTML=element.alt;
	document.getElementById("photoUrl").href=element.parentNode.href;
	document.getElementById("photoUrl2").href=element.parentNode.href;
	return false;
}

function initLinks(){
		document.getElementById("prevLink").onclick=processPrevious;
		document.getElementById("nextLink").onclick=processNext;
}

function processPrevious(){
	if(thisPic==0){
		thisPic=imageGallery.length;
	}
	thisPic--;
	document.getElementById("photoHolder").src=imageGallery[thisPic];
	document.getElementById("photoUrl").innerHTML=imageName[thisPic];
	document.getElementById("photoUrl").href=imageUrl[thisPic];
	document.getElementById("photoUrl2").href=imageUrl[thisPic];
	return false;
}

function processNext(){
	thisPic++;
	if(thisPic==imageGallery.length){
		thisPic=0;
	}
	document.getElementById("photoHolder").src=imageGallery[thisPic];
	document.getElementById("photoUrl").innerHTML=imageName[thisPic];
	document.getElementById("photoUrl").href=imageUrl[thisPic];
	document.getElementById("photoUrl2").href=imageUrl[thisPic];
	return false;
}

