//################################################################################
//#    hoverImage - JavaScript mouse over image script
//#    Copyright (C) 2005  Mike Kornelson
//#
//#    This program is free software; you can redistribute it and/or modify
//#    it under the terms of the GNU General Public License as published by
//#    the Free Software Foundation; either version 2 of the License, or
//#    (at your option) any later version.
//#
//#    This program is distributed in the hope that it will be useful,
//#    but WITHOUT ANY WARRANTY; without even the implied warranty of
//#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//#    GNU General Public License for more details.
//#
//#    You should have received a copy of the GNU General Public License
//#    along with this program; if not, write to the Free Software
//#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  US
//#
//#    You can find the GPL license here: http://www.gnu.org/copyleft/gpl.html
//################################################################################

//# -----------------------------------
//#  Instructions:
//#
//#    <todo>
//#
//# -----------------------------------
//#  Contact:
//#    Mike Kornelson
//#    mike@windmillcomputers.ca
//#    http://www.windmillcomputers.ca
//# -----------------------------------

//%%%%%%%%%% YOU DO NOT NEED TO EDIT THIS FILE %%%%%%%%%%%%

    var hovImg = new Array();    //Global var. Contains image objects
    var hovImg_preloaded = false;

    function preloadImages(imgSrc)
    {
      //For each pair of image sources create both the on and off
      //image objects and preload the images.

      for (i=0;i<imgSrc.length;i++) {
        x = hovImg.length;
        hovImg[x] = new Array(2);
        hovImg[x][0] = new Image();
        hovImg[x][1] = new Image();
        if (x==(imgSrc.length-1)) {
          hovImg[x][1].onload=donePreload;
        }
        hovImg[x][0].src = imgSrc[i][0];
        hovImg[x][1].src = imgSrc[i][1];
      }
    }

    function hoverOn(imgNum) {
      //Flip image to ON state
      if (hovImg_preloaded) {
        document.getElementById("hover"+imgNum).src = hovImg[imgNum][1].src;
      }
    }
    function hoverOff(imgNum) {
      //Flip image to OFF state
      if (hovImg_preloaded) {
        document.getElementById("hover"+imgNum).src = hovImg[imgNum][0].src;
      }
    }

    function donePreload() {
      hovImg_preloaded = true;
    }