function navigate_photos(e)
{
	/* check which key has been pressed */
	var key_pressed = e.keyCode ? e.keyCode : e.charCode

	switch (key_pressed)
	{
		/* listen to the left and right arrow keys. */
		case 37: /* left arrow key */
			to_navigate = "newer_photo"
			break
		case 39: /* right arrow key*/
			to_navigate = "older_photo"
			break
		default: /* ignore other keys */
			to_navigate = null
	}

	/* if we have a defined navigation point... */
	if (to_navigate)
	{
		/* ...check whether the ID exists... */
		if (document.getElementById(to_navigate))
			/* ...then read the URL; go there. */
			document.location = document.getElementById(to_navigate).href
	}
}

/* attach this event to the entire browser window. */
window.onkeyup = navigate_photos;


