ativo = null;
cellAtivo = null;
timeId = null;
document.onclick = new Function("show()");

function addOption(obj,arr)
{
	var obj = document.getElementById(obj);
	var boxLength = obj.length;
	for(i=0; i<arr.length; i++)
	{
		newoption = new Option(arr[i][0], arr[i][1], false, false);
		obj.options[boxLength] = newoption;
		boxLength++;
	}
}

function show(cell,obj)
{
	obj = document.getElementById(obj);
	if(ativo!=null) { ativo.style.visibility = "hidden"; ativo=null;  cellAtivo.style.backgroundColor=''; }
	if(cell)
	{
		cell.style.backgroundColor='#F6F6F6';
		cellAtivo = cell;
	}
	if(timeId!=null){ clearTimeout(timeId); }
	if(obj)
	{
		obj.style.visibility = "visible";
		ativo = obj;
	}
}


function timerHidePop()
{
	if(ativo!=null)
	{
		timeId = setTimeout("ativo.style.visibility = 'hidden'; timeId=null; cellAtivo.style.backgroundColor=''; ativo=null;",3000);
	}
	else { 
	if(ativo==null){ cellAtivo.style.backgroundColor=''; }
	}
}

function escreveMenu(stringFinal){
 if ( document.all )
        {
                menu.innerHTML = stringFinal;
                menu.style.visibility = 'visible';
		        }
        else if ( !document.all && document.getElementById )
        {
                document.getElementById( "menu" ).innerHTML = stringFinal;
                document.getElementById( "menu" ).style.visibility = 'visible' ;
		        }
        else
        {
                menu.innerHTML = stringFinal;
                menu.style.visibility = 'visible' ;
		        }
}

