// JavaScript Document
nav   = null;
ffX   = null;
ffY   = null;
topo  = null;
fecha = null;

window.onload = function()
{
	// TESTA O TIPO DE NAVEGADOR
	if(navigator.appName.indexOf('Explorer') > -1){
		nav  = 'IE';
		topo = 95;
	}else{
		nav  = 'FF';
		topo = 390;

		function pegacoordenadas(e){
			if(document.all)e = event;
			ffX = e.clientX;
			ffY = e.clientY
		}
		document.documentElement.onmousemove =  pegacoordenadas;
	}
}

function fechar(pId, flag)
{
	if(flag == 1){
		fecha = true;
		setTimeout("exibe('"+pId+"',2)", 10);
	}else{
		fecha = false;
	}

}

function fechatudo()
{
	var obj = document.getElementsByTagName('div');

	for(x=0;x<obj.length;x++){
		if(obj[x].id.substr(0,6) == 'sbmenu') obj[x].style.display = 'none';
	}
}

function exibe(pId, flag)
{
	var obj = document.getElementById(pId), pIni = null;
	
	if(nav == 'IE')
		pIni = event.x - 315;
	else
		pIni = ffX - 30;

	if(flag == 1){
		fechatudo();
		obj.style.left    = pIni.toString()+'px';
		obj.style.top     = topo.toString()+'px';
		obj.style.display = 'block';
	}else if(flag == 2){
		if(fecha) obj.style.display = 'none';
	}else if(flag == 0){
		obj.style.display = 'none';
	}
}

function menuouver(obj,flag)
{
	if(flag == 1){
		obj.style.color      = '#ffffff';
		obj.style.background = '#0066ff';
	}else{
		obj.style.color      = '#000000';
		obj.style.background = '#d5eaff';
	}
}
