// JavaScript Document
window.onload = initLinks;

var myPix = new Array("../pics/menu/graphopus.gif","../pics/menu/field.png","../pics/menu/gallery4.gif",
"../pics/casestudies/dynacrypt.png","../pics/menu/niesr7.png","../pics/menu/mices.png","../pics/menu/vero4.jpg");
var thisPic = 0;
var t;

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;
}