Hey everyone,

I'm very new to javascript, so I'm sure I'm overlooking some laughable detail here, but I can't figure out what it is. I'm using the following script:

Code:
<script type="text/JavaScript">
document.onkeypress = getKey;
var key = new Array();
key['p'] = "http://www.domain.com/previousimageurl"
key['n'] = "http://www.domain.com/nextimageurl"
function getKey(keyStroke) {
   isNetscape=(document.layers);
   eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
   which = String.fromCharCode(eventChooser).toLowerCase();
   for (var i in key) if (which == i) window.location = key[i];
}
</script>
That code works great as long as I'm navigating with letter keys. As soon as I try to switch it over to the cursor keys, however, things stop working. What would the correct key variables be to put for the arrow keys? I've tried using 37 and 39 with no luck, and also % and ' with no luck.