function update()
{
 if (document.all.boardgame.cells(x+y*10).background=="")
 {
  document.all.boardgame.cells(x+y*10).background="bg.gif";
 }
  var dir = Math.floor(Math.random() * 8);
  var oldx = x;
  var oldy = y;
  if (dir==0 && x>=3) {
   if (document.all.boardgame.cells(x-3+y*10).background=="") x-=3;
  }
  if (dir==1 && x<=6) {
   if (document.all.boardgame.cells(x+3+y*10).background=="") x+=3;
  }
  if (dir==2 && y>=3) {
   if (document.all.boardgame.cells(x+(y-3)*10).background=="") y-=3;
  }
  if (dir==3 && y<=6) {
   if (document.all.boardgame.cells(x+(y+3)*10).background=="") y+=3;
  }
  if (dir==4 && y<=7 && x<=7) {
   if (document.all.boardgame.cells(x+2+(y+2)*10).background=="") {
    y+=2;
    x+=2;
   }
  } 
  if (dir==5 && y<=7 && x>=2) {
   if (document.all.boardgame.cells(x-2+(y+2)*10).background=="") {
    y+=2;
    x-=2;
   } 
  }
  if (dir==6 && y>=2 && x<=7) {
   if (document.all.boardgame.cells(x+2+(y-2)*10).background=="") {
    y-=2;
    x+=2;
   } 
  }
  if (dir==7 && y>=2 && x>=2) {
   if (document.all.boardgame.cells(x-2+(y-2)*10).background=="") {
    y-=2;
    x-=2;
   } 
  }
  document.all.boardgame.cells(x+y*10).borderColor="#EF5428";
  if (oldx!=x || oldy!=y)
  {
  document.all.boardgame.cells(oldx+oldy*10).borderColor="";
  }
}

function hideElement (elementId) {
var element;
if (document.all)
element = document.all[elementId];
else if (document.getElementById)
element = document.getElementById(elementId);
if (element && element.style)
element.style.display = 'none';
}

function showElement (elementId) {
var element;
if (document.all)
element = document.all[elementId];
else if (document.getElementById)
element = document.getElementById(elementId);
if (element && element.style)
element.style.display = '';
}

