// tracks the original image src so we can swap back
var origButtonStates = new Object( );

/**
 * turns a button on by swapping for the '_over' image.
 **/
function btnOver ( pImg ) {
  if( pImg ) {
    var imgId = pImg.id;
    var imgSrc = pImg.src;
    origButtonStates[imgId] = imgSrc;
    pImg.src = pImg.src.replace( /_off/, "_over" );
    pImg.src = pImg.src.replace( /_on/, "_over" );
  }
}

/**
 * turns a button off by swapping back to the original image.
 **/
function btnOut ( pImg ) {
  if( pImg ) {
    var imgId = pImg.id;
    if( origButtonStates[imgId] != null ) {
      pImg.src = origButtonStates[imgId];
    }
  }
}

/**
 * turns a tooltip on
 **/
function ttipOn ( pId ) {
  if( pId ) {
    var ttip = document.getElementById( pId );
    if( ttip ) {
      ttip.style.display = 'block';
    }
  }
}

/**
 * turns a tooltip off
 **/
function ttipOff ( pId ) {
  if( pId ) {
    var ttip = document.getElementById( pId );
    if( ttip ) {
      ttip.style.display = 'none';
    }
  }
}

/**
 * toggles a tooltip
 **/
function ttipToggle ( pId ) {
  if( pId ) {
    var ttip = document.getElementById( pId );
    if( ttip ) {
      ttip.style.display = ttip.style.display == 'none' ? 'block' : 'none';
    }
  }
}
