color = new Array();
color[0] = '#DDA9FF';
color[1] = '#64B664';
color[2] = '#D4B58A';
color[3] = '#DDEBEF';
preload = new Image();
preload.src="img/flechab.gif";

if ( typeof menuBg == 'undefined' ) menuBg="#000000"

// window.alert("js: "+menuBg);

function eover(b, id) {
  document["i"+id].src="img/flechab.gif";
  b.style.background=color[id];
  b.style.color='#000000'
}
function eout(b, id) {
  document["i"+id].src="img/flecha.gif";
  b.style.background=menuBg;
  b.style.color="#FFFFFF"
}

var animTarget;
var animRun = 0;
var animColor = 1;
var lastDate = new Date();
var checkTime = 0;

function anim(b, id) {
  if ( animRun == 0 ) {
    animRun = 1;
    animTarget = b;
    document["i"+id].src="img/flechab.gif";
    animTarget.style.color='#000000';
    checkTime = 0;
    doAnim();
  }
}

function doAnim() {
  currDate = new Date();
  if ( currDate-lastDate < 450 && checkTime ) return;
  checkTime = 1;
  lastDate = currDate;
  animTarget.style.background=color[animColor];
  document.forms[0].style.background=color[animColor];
  animColor = (animColor + 1)% color.length;
  if ( animRun ) setTimeout("doAnim()", 500);
  else {
       document.forms[0].style.background=menuBg;
       eout( animTarget, 4 );
    
  }
}

function stopAnim() {
  animRun = 0;
  document.forms[0].style.background=menuBg;
  eout( animTarget, 4 );        
  clearTimeout();
  document.forms[0].style.background=menuBg;
  eout( animTarget, 4 );        

}
