function enableBlink()
{
   var aryBlinkingElements = document.getElementsByTagName("blink")
   for(i=0;i<aryBlinkingElements.length;i++)
   {
      objElement = aryBlinkingElements[i];
			if(objElement.style.display == "none")
			{
	   		objElement.style.display = "block" ;
   		}	
			else
			{
	   		objElement.style.display = "none" ;
			}
   }
   setTimeout('enableBlink()', 1000);
}

var fader = new Array(), fadeQ = new Array();
var RGB = new Array(256), k = 0, hex = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
for (var i = 0; i < 16; i++) for (var j = 0; j < 16; j++) RGB[k++] = hex[i] + hex[j];

function fadeObj(number, id, colOff, colOn, spdIn, spdOut, def) {
  this.number = number;
  this.id = id;
  this.colOff = [parseInt(colOff.substr(0, 2), 16), parseInt(colOff.substr(2, 2), 16), parseInt(colOff.substr(4, 2), 16)];
  this.colOn = [parseInt(colOn.substr(0, 2), 16), parseInt(colOn.substr(2, 2), 16), parseInt(colOn.substr(4, 2), 16)];
  this.colNow = [parseInt(colOff.substr(0, 2), 16), parseInt(colOff.substr(2, 2), 16), parseInt(colOff.substr(4, 2), 16)];
  this.spdIn = spdIn;
  this.spdOut = spdOut;
  this.def = def;
  this.direction = false;
  this.active = false;
  this.message = new Array();
  this.messageNow = 0;
  this.messageIndex = 0;
  this.color = new Array();
  this.bold = new Array();    
}

function fadeAll( n, direction)
{
    var cont = true;
    for( var i = 0; i < n; i++ )
    {
        if (!fader[i].active)
        {
            fader[i].active = true;
            fader[i].direction = direction;
            fader[i].messageNow = fader[i].messageIndex;
            document.getElementById(fader[i].id).innerHTML = fader[i].message[fader[i].messageIndex];
            if( fader[i].bold[fader[i].messageIndex] != null )
                document.getElementById(fader[i].id).style.fontWeight = 'bold';
            else    
                document.getElementById(fader[i].id).style.fontWeight = 'normal';            
        }

        var iniCol = (direction) ? fader[i].colOff : fader[i].colOn;
        var endCol = (direction) ? fader[i].colOn : fader[i].colOff;
                
        if( fader[i].color[fader[i].messageIndex] != null )
        {
        	var tcol = fader[i].color[fader[i].messageIndex].substr(1);
        	var onc = [parseInt(tcol.substr(0, 2), 16), parseInt(tcol.substr(2, 2), 16), parseInt(tcol.substr(4, 2), 16)];

            iniCol = (direction) ? fader[i].colOff : onc;
            endCol = (direction) ? onc : fader[i].colOff;
        }
                
        var incCol = fader[i].colNow;
        var spd = (direction) ? fader[i].spdIn : fader[i].spdOut;
        for (var x = 0; x < 3; x++)
        {
            var incr = (endCol[x] - iniCol[x]) / spd;
            incCol[x] = (incr < 0) ? Math.max(incCol[x] + incr, endCol[x]) : Math.min(incCol[x] + incr, endCol[x]);
        }
        document.getElementById(fader[i].id).style.color = "#" + RGB[parseInt(incCol[0])] + RGB[parseInt(incCol[1])] + RGB[parseInt(incCol[2])];
        if (incCol[0] == endCol[0] && incCol[1] == endCol[1] && incCol[2] == endCol[2])
        {
            cont = false;
            fader[i].active = false;
            if( !direction )
            {
                if( fader[i].messageIndex + 1 >= fader[i].message.length )
                    fader[i].messageIndex = 0;
                else
                    fader[i].messageIndex = fader[i].messageIndex+1;
            }
                
            if (!fader[i].def)
               document.getElementById(fader[i].id).innerHTML = "&nbsp;";
        }        
    }
    if( cont )
        setTimeout(function() { fadeAll( n, direction); }, 200);   
}