// JavaScript Document
window.onload = initLinks;

var myPix = new Array("../pics/gino/3dwire.gif","../pics/gino/dxfimage.gif","../pics/gino/fancolour.gif","../pics/gino/ginobig.gif"
					  ,"../pics/gino/koch.gif","../pics/gino/plastic.jpg","../pics/gino/segments.gif","../pics/gino/snooker.gif","../pics/gino/vero1.jpg");
var thisPic = 0;

function initLinks() {
	
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
	document.getElementById("status").innerHTML = "1/" + myPix.length;
	document.getElementById("myPicture").src = myPix[0];
	document.getElementById("header").onmousemove = showcoords;
	document.getElementById("sidebar1").onmousemove = showcoords;
	rotate();
}

function processPrevious() {
	if (thisPic == 0) {
		thisPic = myPix.length;
	}
	thisPic--;
	document.getElementById("myPicture").src = myPix[thisPic];
	document.getElementById("status").innerHTML = thisPic+1 + "/" + myPix.length;
	clearTimeout(t);
	return false;
}

function processNext() {
	thisPic++;
	if (thisPic == myPix.length) {
		thisPic = 0;
	}
	document.getElementById("myPicture").src = myPix[thisPic];
	document.getElementById("status").innerHTML = thisPic+1 + "/" + myPix.length;
	clearTimeout(t);
	return false;
}
function rotate() {
	thisPic++;
	if (thisPic == myPix.length) {
		thisPic = 0;
	}
	document.getElementById("myPicture").src = myPix[thisPic];
	document.getElementById("status").innerHTML = thisPic+1 + "/" + myPix.length;
    t = setTimeout("rotate()",3000);
	return false;
}
function showcoords(evt){
	if(!evt){
		evt = window.event;
	}
	document.getElementById("breadright").innerHTML = "X = " + evt.clientX*245 + ", Y = " + evt.clientY*245;
}