/***********************************************
** File:      %M%  version %I%
** Author:    nat
** Modified:  %G%
** Copyright: I-Next Ltd
***********************************************/
/* ident %W% */


function doLoad() {
  initRollovers();
  initTDRollovers();
}

function initRollovers() {
  if ( document.images ){
    var preLoad = new Array();
    var tempSrc;
    for (var i = 0; i < document.images.length; i ++ ){

      // Only add rollover to images with the classname 'rollover'
      if ( document.images[i].className == 'rollover' ){
        var src = document.images[i].getAttribute('src'); // get the src
        var ext = src.substring( src.lastIndexOf('.'), src.length ); // get the file extension
        var hsrc = src.replace( ext, '_r' + ext ); // store the rollover src
        document.images[i].setAttribute('hsrc', hsrc); // set the new src attribute
        document.images[i].style.cursor = 'hand'; // Hand cursor where supported

        // Preload the image
        preLoad[i] = new Image();
        preLoad[i].src = hsrc;

        // Add the rollover functions
        document.images[i].onmouseover = function(){
          tempSrc = this.getAttribute('src');
          this.setAttribute('src', this.getAttribute('hsrc'));
        }
        document.images[i].onmouseout = function(){
          if (!tempSrc) tempSrc = this.getAttribute('src').replace('_r'+ftype, ftype);
          this.setAttribute('src', tempSrc);
        }
      }
    }
  }
}

function initTDRollovers() {
  var tds = document.getElementsByTagName('td');
  for (var i=0; i<tds.length; i++ ) {
    if (tds[i].className == 'rollover') {
      tds[i].onmouseover = function() {
          this.style.backgroundColor = 'fffabc';
      }

      tds[i].onmouseout = function() {
        this.style.backgroundColor = 'FFFDE7';
      }
    }
  }
}


window.onload = doLoad;

