// JavaScript Document
window.onload = loadMyfunction;

function loadMyfunction(){
	initLinks();
	rolloverInit();
}

function rolloverInit(){
	for (var i=0; i<document.images.length; i++){
		if (document.images[i].parentNode.tagName == "A"){
			setupRollover(document.images[i]);
		}
	}
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = thisImage.id + "_on.jpg";
	thisImage.onmouseover = rollOver;
}
	
function rollOut() {
	this.src = this.outImage.src;
}
 
 function rollOver() {
	 this.src = this.overImage.src;
 }
 
 var myPix = new
Array("slide_two.jpg","slide_three.jpg","slide_four.jpg","slide_five.jpg", "slide_six.jpg", "slide_seven.jpg", "slide_eight.jpg", "slide_nine.jpg", "slide_ten.jpg", "slide_elevin.jpg", "slide_one.jpg");
var thisPic = 0;

function initLinks(){
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
}
function processPrevious(){
	if (thisPic == 0){
		thisPic = myPix.length;
	}
	thisPic--;
	document.getElementById("myPicture").src = myPix[thisPic];
	return false;
}
function processNext(){
	thisPic++;
	if (thisPic == myPix.length){
		thisPic = 0;
	}
	document.getElementById("myPicture").src = myPix[thisPic];
	return false;
}
