mazeValue = new Array ([1,2,3,4,1],[3,3,1,3,4],[3,1,2,2,4],[4,2,2,2,1],[2,4,4,3,0]);
function imgLoad(){
 imgFile = imgLoad.arguments;
 imgSrc = new Array();
 for (i=0; i<imgFile.length; i++){
  imgSrc[i] = new Image;
  imgSrc[i].src = 'red'+imgFile[i]+'.gif'; }}
function mazeMove(x,y) {
 currImg = document.images['grid'+x+y];
 if (currImg.src.indexOf('next') != -1) {
  currImg.src='red.gif';
  for (a=0; a<5; a++) {
   for (b=0; b<5; b++) {
    fixImg = document.images['grid'+a+b]
    fixImg.src = (fixImg.src.indexOf('red') != -1)?'red.gif':'blank.gif';   }  }
 z = mazeValue[x][y];
 if (z == 0) {
  alert('You made it! Hurrah!');
  return; }
 modify = new Array ([-z,0],[0,-z],[z,0],[0,z]);
  for (i=0; i<4; i++) {
   if (testImg = document.images['grid'+(x+modify[i][0])+(y+modify[i][1])]) {
    testImg.src = (testImg.src.indexOf('red') != -1)?'red_next.gif':'blank_next.gif';   }  }
 currImg.src='red_spin_'+z+'.gif';
  } else {
    alert('You can only move the number of squares specified.');  }}
