
var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var w_y, w_x, index, boxheight, boxwidth;
var ishover=false;
var isloaded=false;
var ieop=0;
var op_id=0;
var dofade=true;     
var center=false; 
var centertext=false; 
var DivWidth = 150;

function getwindowdims()
{
	w_y=(NS4||NS6)? window.innerHeight : (IE5||IE4)? document.body.clientHeight : 0;
	w_x=(NS4||NS6)? window.innerWidth : (IE5||IE4)? document.body.clientWidth : 0;
}

function getboxwidth()
{
	if(NS4)boxwidth=(index.document.width)? index.document.width : index.clip.width;
	if(IE5||IE4)boxwidth=(index.style.pixelWidth)? index.style.pixelWidth : index.offsetWidth;
	if(NS6)boxwidth=(index.style.width)? parseInt(index.style.width) : parseInt(index.offsetWidth);
}

function getboxheight()
{
	if(NS4)boxheight=(index.document.height)? index.document.height : index.clip.height;
	if(IE4||IE5)boxheight=(index.style.pixelHeight)? index.style.pixelHeight : index.offsetHeight;
	if(NS6)boxheight=parseInt(index.offsetHeight);
}


function moveindex(x,y)
{
	if(NS4)index.moveTo(x,y);
		if(W3C||IE4)
		{
		index.style.left=x+'px';
		index.style.top=y+'px';
		}
}


function getpagescrolly()
{
	if(NS4||NS6)return window.pageYOffset;
	if(IE5||IE4)return document.body.scrollTop;
}


function getpagescrollx()
{
	if(NS4||NS6)return window.pageXOffset;
	if(IE5||IE4)return document.body.scrollLeft;
}


function writeindiv(text)
{
	if(NS4)
	{
	index.document.open();
	index.document.write(text);
	index.document.close();
	}
	if(W3C||IE4)index.innerHTML=text;
}


function Menu(titulo, conteudo)
{ 
	var vs_content;
	vs_content = "<table cellpadding=\"1\" cellspacing=\"1\" align=\"right\" class=\"tb01\"><tr><td><table cellpadding=\"0\" cellspacing=\"1\" width=\"" + DivWidth +"\" class=\"tb02\">";
	vs_content = vs_content + "<td class=\"td01\">";
	vs_content = vs_content + "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td></td></tr>";
	vs_content = vs_content + "<tr><td class=\"td02\"><font class=\"ft01\">" + titulo + "</font>";
	vs_content = vs_content + "<br><font class=\"ft02\"><b>" + conteudo + "</b></font></td></tr></table></td></tr></table></td></tr></table>"; 
	return vs_content;
}


function escrevertexto(text)
{
	if(isloaded)
	{
		if(text!=0)
		{
			ishover=true;
			if(NS4)text='<div class="navtext">'+text+'</div>';
			writeindiv(text);
			getboxheight();
			if((W3C || IE4) && dofade)
			{
				ieop=0;
				incropacity();
			}
		}
		else
		{
			if(NS4)index.visibility="hide";
			if(IE4||W3C)
			{
				if(dofade)clearTimeout(op_id);
				index.style.visibility="hidden";
			}
			writeindiv('');
			ishover=false;
		}
	}
}


function incropacity()
{
	if(ieop<=100)
	{
		ieop+=7;
		if(IE4 || IE5)index.style.filter="alpha(opacity="+ieop+")";
		if(NS6)index.style.MozOpacity=ieop/100;
		op_id=setTimeout('incropacity()', 35);
	}
}


function moveobj(evt)
{
	if(isloaded && ishover)
	{
		margin=(IE4||IE5)? 1 : 23;
		if(NS6)if(document.height+27-window.innerHeight<0)margin=15;
		if(NS4)if(document.height-window.innerHeight<0)margin=10;
		//mx=(NS4||NS6)? evt.pageX : (IE5||IE4)? event.clientX : 0;
		//my=(NS4||NS6)? evt.pageY : (IE5||IE4)? event.clientY : 0;
		if (NS4)
		{
			mx=evt.pageX
			my=evt.pageY
		}
		else 
			if (NS6)
			{
				mx=evt.clientX
				my=evt.clientY
			}
		else 
			if (IE5)
			{
				mx=event.clientX
				my=event.clientY
			}
			else 
				if (IE4)
				{
					mx=0
					my=0
				}
		if(NS4)
		{
			mx-=getpagescrollx();
			my-=getpagescrolly();
		}
		xoff=(center)? mx-boxwidth/2 : mx- DivWidth + 5;
		yoff=(my+boxheight+15-getpagescrolly()+margin>=w_y)? -15-boxheight: 5;
		moveindex( getpagescrollx() + xoff , my+yoff+getpagescrolly());
		if(NS4)index.visibility="show";
		if(W3C||IE4)index.style.visibility="visible";
	}
}

if(NS4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;

window.onload=function()
{
	index=(NS4)? document.layers['index'] : (IE4)? document.all['index'] : (W3C)? document.getElementById('index') : null;
	getboxwidth();
	getboxheight();
	getwindowdims();
	isloaded=true;
	if(W3C)index.style.padding='4px';
	if(IE4 || IE5 && dofade)index.style.filter="alpha(opacity=0)";
}

window.onresize=getwindowdims;

