  
  /*
    Javascript Vertical Background Image Slider
    
    Author: Derek Harvey 
    Website: http://www.lotsofcode.com
    
    Notes:
    
    > Compatibility:
      FF1+, Opera & IE6 (AFAIK)
  */

  var LOC_Loaded = true;

  // var background = "images/nav_directory_active.gif";
  var speed = 0;
  
  // Each step, e.g each pixel per movement.
  var pixelMove = 1;
  
  // The timeout variable, globally declared
  var backgroundTimeout = new Array();
  
  // Starting location, the first and last place the slider can go
  var topStop = -8;
  
  // The bottom most pixel the slider can visit
  var botStop = -2;
  
  // 
  if (LOC_Loaded)
  {
    function LOC_moveBackground(direction, vPos, currentID)
    {
        if (!currentID)
          return;
          
        debug('moveBackground', 'called')
        
        if (vPos == '-1')
        {
          vPosB = document.getElementById(currentID).style.backgroundPosition.split(' ')[1];
          getChars = 1;
          if (vPosB.substring(0, 1) == '-')
            getChars = 2;
          vPos = vPosB.substring(0, getChars);
        }
        if (!vPos)
          vPos = 0
          
        debug('vPos', vPos)
        debug('direction', '1')
          
        if (direction == 1) // 1 == up
        {
          if (!isNaN(vPos)) {
            if (vPos == topStop)
              return;
            vPos -= pixelMove;
          }
        }
        else // Move it down
        {
          if (!isNaN(vPos)) {
            if (vPos >= botStop)
              return;
            vPos += pixelMove;
          }
        }
        
        document.getElementById(currentID).style.backgroundPosition = 0 + "px " + vPos + "px";
        
        backgroundTimeout[currentID] = setTimeout("LOC_moveBackground(" + direction + ", " + vPos + ", '" + currentID + "')", speed)
    }
    
    var consoleCount = 0;
    function debug(name, value)
    {
      /*
        var cellClass;
        consoleCount++;
        var console = document.getElementById('debugger');  
        if (console)
        {
          cellClass = (consoleCount % 2 == 0) ? 'oddCell' : 'evenCell';
          console.innerHTML = '<div class="' + cellClass + ' t"><span class="n">' + name + '</span> = <span class="v">' + value + '</span></div>' + console.innerHTML;
        }
      */
    }
    
    function LOC_moveDown(currentID)
    {
      if (backgroundTimeout)
        window.clearTimeout(backgroundTimeout[currentID]);
      
      LOC_moveBackground(0, topStop, currentID);
    }
    
    function LOC_moveUp(currentID)
    {
      if (backgroundTimeout)
        window.clearTimeout(backgroundTimeout[currentID]);
      LOC_moveBackground(1, botStop, currentID);
    }
  }
