On.fontsiz = 0;
On.fontwate = 0;
On.fontcolor = "white";

var timerId;
var timerId2;
var xWVal;
var yWVal;
var xBVal;
var yBVal;

/* test for objects */
(document.layers) ? layerobj=true : layerobject=false;
(document.all) ? allobject = true : allobject=false;
(document.getElementById) ? dom = true : dom = false;

function On(tag)
{
	On.fontcolor = document.getElementById(''+tag+'').style.color;
	document.getElementById(''+tag+'').style.color="yellow";
}

function Off(tag)
{
	document.getElementById(''+tag+'').style.color=On.fontcolor;
}

function initPosition()
{
     xWVal = 90;
     yWVal = 350;
     xBVal = 380;
     yBVal = 351;
     changePositionW('test', xWVal, yWVal);
     changePositionB('test2', xBVal, yBVal);
}

function changePositionW(id,x,y)
{
     if(layerobject)
     {
     	document.layers[''+id+''].left = x;
     	document.layers[''+id+''].top = y;
     }
     else if(allobject)
     {
        document.all[''+id+''].style.left = x;
        document.all[''+id+''].style.top = y;
     }
     else if(dom)
     {
     	document.getElementById(''+id+'').style.left = x;
     	document.getElementById(''+id+'').style.top = y;
     }

     xWVal++;
     if( xWVal > 230 )
         clearTimeout(timerId);
     else
         timerId = setTimeout("changePositionW('test', xWVal, yWVal)", 10);

     return;
}

function changePositionB(id,x,y)
{
     if(layerobject)
     {
     	document.layers[''+id+''].left = x;
     	document.layers[''+id+''].top = y;
     }
     else if(allobject)
     {
        document.all[''+id+''].style.left = x;
        document.all[''+id+''].style.top = y;
     }
     else if(dom)
     {
     	document.getElementById(''+id+'').style.left = x;
     	document.getElementById(''+id+'').style.top = y;
     }

     xBVal--;
     if( xBVal < 232 )
         clearTimeout(timerId2);
     else
         timerId2 = setTimeout("changePositionB('test2', xBVal, yBVal)", 10);
     return;
}

var step = 1;
var col = 0xFF;
var maxcolor = 0x80;
var tens = 0xF;
var units = 0xF;

function startAnimation(tag)
{
  var str = new String("");
  var strTens = new String("");
  var strUnits = new String("");
  var tOutStr = new String("");

  col = col - step;
  if (col > maxcolor)
  {
		if( units == 0 )
		{
			units = step;
			tens = tens - 1;
			if( tens == 0 )
			  col = -1;
		}
		else
			units = units - step;

		if (tens == 15)
			strTens = "F";
		else if( tens == 14 )
			strTens = "E";
		else if( tens == 13 )
			strTens = "D";
		else if( tens == 12 )
			strTens = "C";
		else if( tens == 11 )
			strTens = "B";
		else if( tens == 10 )
			strTens = "A";
		else
			strTens = tens;

		if (units == 15)
			strUnits = "F";
		else if( units == 14 )
			strUnits = "E";
		else if( units == 13 )
			strUnits = "D";
		else if( units == 12 )
			strUnits = "C";
		else if( units == 11 )
			strUnits = "B";
		else if( units == 10 )
			strUnits = "A";
		else
			strUnits = units;

		str = "#" + strTens + strUnits + strTens + strUnits + strTens + strUnits;
		document.getElementById(''+tag+'').style.color = str;
		tOutStr="startAnimation(" + "'" + tag + "'" + ")";

		move=setTimeout(tOutStr, 80);
  }
  else
  {
	clearTimeout(move);
  	document.getElementById(''+tag+'').style.color = "#000000";
  }
}
