function KeyCheck(e) {
  var KeyID = (window.event) ? event.keyCode : e.keyCode;
  switch(KeyID) {
    case 37:
    // left
    if (document.getElementById("previous") != null) {
      window.location.href = document.getElementById("previous").href;
    }
    break;

    case 38:
    // up
    if (document.getElementById("up") != null) {
      window.location.href = document.getElementById("up").href;
    }
    break;

    case 39:
    // right
    if (document.getElementById("next") != null) {
      window.location.href = document.getElementById("next").href;
    }
    break;
  }
}

