//<![CDATA[

  var colourUrl = "undefined";
  var colourLeftImage;
  var colourMidImage;
  var colourRightImage;
  var colourDefault = "#FFFFFF";
  var colourHilight = "#000000";

  function changeToWhite(obj) {
    setDefaults();
    img = colourMidImage;

    if (obj.className.indexOf('first') > -1) {
      img = colourLeftImage;
    }

    if (obj.className.indexOf('last') > -1) {
      img = colourRightImage;
    }

    obj.style.backgroundImage = "url("+ img +")";
    obj.style.color = colourHilight;
  }

  function changeToDefault(obj) {
    setDefaults();
    obj.style.backgroundImage = "none";
    obj.style.color = colourDefault;
  }

  function setDefaults() {
    if (colourUrl == 'undefined') {
      colourUrl = computedStyle(document.getElementById("bcText"), "backgroundImage");

      var baseURL = 'image/';

      var imageURL = baseURL + 'default/';

      if (colourUrl.search(/yellow-on-black/) != -1) {
        imageURL = baseURL + 'yellow-on-black/';
        colourDefault = "#FFF000";
        colourHilight = "#000000";
      }   

      if (colourUrl.search(/black-on-yellow/) != -1) {
        imageURL = baseURL + 'black-on-yellow/';
        colourDefault = "#000000";
        colourHilight = "#FFF000";
      }   

      if (colourUrl.search(/blue-on-white/) != -1) {
        imageURL = baseURL + 'blue-on-white/';
        colourDefault = "#0000FE";
        colourHilight = "#FFFFFF";
      }   

      if (colourUrl.search(/white-on-blue/) != -1) {
        imageURL = baseURL + 'white-on-blue/';
        colourDefault = "#FFFFFF";
        colourHilight = "#0000FE";
      }   

      colourLeftImage = imageURL + 'submit_bar_5_left.gif'
      colourMidImage = imageURL + 'submit_bar_5_middle.gif'
      colourRightImage = imageURL + 'submit_bar_5_right.gif'
    }
  }

  function computedStyle(htmlObject, cssStyle) {
    var computedStyle;
    if (typeof htmlObject.currentStyle == 'undefined') {
      computedStyle = document.defaultView.getComputedStyle(htmlObject, null);
    } else {
      computedStyle = htmlObject.currentStyle;
    }
    return computedStyle[cssStyle];
  }
  
  function highlightButton(textId) {
    var obj = document.getElementById(textId);
    var colourUrl = computedStyle(obj, "backgroundImage");
    if (colourUrl.search(/hilite/) < 0) {
      obj.style.backgroundImage = colourUrl.replace(".jpg", "_hilite.jpg");
    }
  }

  function dimButton(textId) {
    var obj = document.getElementById(textId);
    var colourUrl = computedStyle(obj, "backgroundImage");
    if (colourUrl.search(/hilite/) != -1) {
      obj.style.backgroundImage = colourUrl.replace("_hilite.jpg", ".jpg");
    }
  } 

//]]>
