//onkey daw abang anong keyboard key pindutin based on "key code table"

document.onkeydown = keyHit;

var pictures = new Array("images/callisto.jpg", "images/europa.jpg", "images/ganymede.jpg", "images/io.jpg");

var pic = 0;


function keyHit(evt) {
	var leftArrow = 37;
	var rightArrow = 39;

	var thisKey;

	if(evt){
		thisKey = window.event.keyCode;
	}
	if(thisKey == leftArrow){
		newSlide(-1);
	}
	if(thisKey == rightArrow){
		newSlide(1);
	}
	return false;
}
	function newSlide(direction){
		pic = pic + direction;

		if(pic == pictures.length){
			pic = 0;
		}
		if(pic <0){
			pic = pictures.length-1;
		}


		document.getElementById('myPicture').src =pictures[pic];
	}