// Simple slide navigation.
// Paul Fenwick <pjf@perltraining.com.au>, Feb 2005.

// Keys function, inspired by S5 slides, inspired by 
// MozPoint.

// The horrid looking document.getElementsByName("...").item(0).href
// is an attempt to make this work on as many platforms as possible.

function keys (key) {
	if (!key) {
		key = event;
		key.which = key.keyCode;
	}
	switch (key.which) {
		case 10:	// Return
		case 13:	// Enter
		case 34:	// PgDown
		case 39:	// Right Arrow
		case 40:	// Down Arrow
			window.location = document.getElementsByName("next").item(0).href;
			break;
		case 33:	// PgUp
		case 37:	// Left Arrow
		case 38:	// UpArrow
			window.location = document.getElementsByName("prev").item(0).href;
			break;
		case 32:	// Spacebar
			dotpoint();
			break;
	}
}

var point = 0;

function dotpoint () {
	var dot = document.getElementById(point++);
	if (dot) {
		dot.style.visibility = 'visible';
	} else {
		window.location = document.getElementsByName("next").item(0).href;
	}
}

document.onkeyup = keys;
