var timers = new Array();
var hasMouse = new Array();
var fadeDelay = 50;
var holdDelay = 1000;
var fadeIn  = "ECA840";
var fadeOut = "48ACE";

function showMenuText(dispNum, textVal, idx) {
  if (typeof idx == 'undefined') {
    // First time in the loop
    clearTimeout(timers[dispNum]);
    timers[dispNum] = null;
    idx = 0;
  }
  if (idx < fadeIn.length) {
    ch = fadeIn.charAt(idx);
    colr = ch + ch + ch;
    //newHTML = '<FONT COLOR=#' + colr + '>' + textVal + '</FONT>';
    newHTML = '<span style="color: #' + colr + '">' + textVal + '</span>';
    document.getElementById('MenuText'+dispNum).innerHTML = newHTML;
    idx++;
    nextFunc = 'showMenuText(' + dispNum + ', \'' + textVal + '\',' + idx + ')';
    timers[dispNum] = window.setTimeout(nextFunc, fadeDelay);
  } else {
    if (hasMouse[dispNum]) {
      nextFunc = 'showMenuText(' + dispNum + ', \'' + textVal + '\',' + idx + ')';
      timers[dispNum] = window.setTimeout(nextFunc, fadeDelay);
    } else {
      nextFunc = 'dimMenuText(' + dispNum + ', \'' + textVal + '\')';
      timers[dispNum] = window.setTimeout(nextFunc, holdDelay);
    }
  }
  return true;
}

function dimMenuText(dispNum, textVal, idx) {
  if (typeof idx == 'undefined') {
    // First time in the loop
    clearTimeout(timers[dispNum]);
    timers[dispNum] = null;
    idx = 0;
  }
  if (idx < fadeOut.length) {
    ch = fadeOut.charAt(idx);
    colr = ch + ch + ch;
    //newHTML = '<FONT COLOR=#' + colr + '>' + textVal + '</FONT>';
    newHTML = '<span style="color: #' + colr + '">' + textVal + '</span>';
    document.getElementById('MenuText'+dispNum).innerHTML = newHTML;
    idx++;
    nextFunc = 'dimMenuText(' + dispNum + ', \'' + textVal + '\',' + idx + ')';
    timers[dispNum] = window.setTimeout(nextFunc, fadeDelay);
  } else {
    clearMenuText(dispNum);
  }
  return true;
}

function clearMenuText(dispNum) {
  clearTimeout(timers[dispNum]);
  timers[dispNum] = null;
  //document.getElementById('MenuText' + dispNum).innerHTML = '&nbsp;';
  document.getElementById('MenuText' + dispNum).innerHTML = '';
  return true;
}

function setMouse(dispNum) {
  hasMouse[dispNum]=true;
}

function clearMouse(dispNum) {
  hasMouse[dispNum]=false;
}

//-----------------------------------------

function showAlbumName(imgNum) {
  targImg = document.getElementById('img'+imgNum);
  targDiv = document.getElementById('AlbIndexName');
  targDiv.innerHTML = targImg.alt;
}

function hideAlbumName() {
  targDiv = document.getElementById('AlbIndexName');
  targDiv.innerHTML = "";
}

