//
// Simple Button Animations
// Copyright (C) Damian Walker 2003
//
// To use:
//   xyzButton = loadButton ("xyz"); // on initialisation
//   onMouseOver="pressButton('xyz'); // to press in
//   onMouseOut="releaseButton('xyz'); // to release
//
// Updated: 27-Feb-2003
//

// Load all the images of a particular button
function loadButton(name) {
  tempButton = new Array(3);
  for (count = 0; count < 3; ++count) {
    tempButton[count] = new Image();
    tempButton[count].src = "buttons/" + name + '-' + count + '.gif';
  }
  return tempButton;
}

// Animate the pressing of the button
function pressButton(name) {
  for (count = 1; count <= 2; ++count) {
    setTimeout('document.' + name + '.src = ' + name + 'Button[' +
	       count + '].src',100 * (count - 1));
  }
}

// Animate the release of the button
function releaseButton(name) {
  for (count = 1; count >= 0; --count) {
    setTimeout('document.' + name + '.src = ' + name + 'Button[' +
	       count + '].src',100 * (1 - count));
  }
}

