i'm having a problem with a bit of jquery right now. I've got a navigation code (EG pressing the up arrow and down arrow alters a $_GET variable in the URL). It's working fine in the positive numbers but the moment I try to go past -1 it unsets the variable and causes the page to reset. Below is the Jquery Function in question.
function arrowbuttons()
{
  $(document).keydown(function(e){
    var full_url = document.URL; // Get current url
    var split = location.search.replace('?, &');
    var y = split[7];
    var x = split[3];
    var down = +split[7]-1;
    var up = +split[7]+1;
    var left = +split[3]+1;
    var right = +split[3]-1;
    if (e.keyCode == 37) { 
       window.location = 'index.php?X='+left+'&Y='+y+'&Z=0'; 
       return false;
    }
    if(e.keyCode == 38) {
        window.location = 'index.php?X='+x+'&Y='+up+'&Z=0'; 
    return false;
    }
    if(e.keyCode == 39) {
        window.location = 'index.php?X='+right+'&Y='+y+'&Z=0'; 
    return false;}
    if(e.keyCode == 40) { 
    window.location = 'index.php?X='+x+'&Y='+down+'&Z=0'; 
    return false;}
  });   
}
If either of the effected URL variables (X or Y) are attempting to go below -1, like i said before, everything is redirected back to the start (X=0&Y=0&Z=0) by my php redirect code. This is strictly a Jquery issue, as the links that i've hardcoded into my site i'm fully capable of going as low as -16. Furthermore, I've noticed that I cannot go above +10 on any of the directions; when i go above +10 i resets me to (X=2 or Y=2 depending on which variable has been affected)
 
     
     
    