// botões dinamicos: ao clicar nos links, os botões mudam dando a impressão de botão premido by atferraz
function buttonState(element, state, src)
{
	if(element)
	{
		if(state=="up")
		{
			element.style.border="thin outset #993333";
		}
		else
			element.style.border="thin inset #993333";
		if(src)
		{
			if(src=='voltar')
			{
				parent.window.history.go(-1);
				//window.location="../default.htm";
			}
			else
			{
				//document.getElementById("main").src = "Fsource/pagCentral.html"
				parent.window.location=src;
			}
		}
	}
	else
		alert("ERRO - "+element.id+" não detectad0")
}

function tituloIs(elementId, btn, width)
{
	if(document.getElementById(elementId))
	{
		document.getElementById(elementId).src = btn
		if(width)
			document.getElementById(elementId).width = width
	}
	else
		alert("ERRO - "+elementId+" não detectada")
}


//----------------------------------SCRIPT DE MENSAGEM
function loadScroll()
{
	setTimeout("startw()",10);

}

function startw()
{
	if (document.all) 
		iemarqueew(wslider);
	else 
	if (document.getElementById)
		ns6marqueew(document.getElementById('wslider'));
	else 
	if(document.layers)
	ns4marqueew(document.wslider1.document.wslider2);
}
function iemarqueew(whichdiv)
{
	iedivw=eval(whichdiv)
	iedivw.style.pixelLeft=getWidth()
	iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>'
	sizeupw=iedivw.offsetWidth
	ieslidew()
}
function ieslidew()
{
	if (iedivw.style.pixelLeft>=sizeupw*(-1))
	{
		iedivw.style.pixelLeft-=wspeed
		setTimeout("ieslidew()",50)
	}
	else
	{
		iedivw.style.pixelLeft=getWidth()
		ieslidew()
	}
}
function ns4marqueew(whichlayer)
{
	ns4layerw=eval(whichlayer)
	ns4layerw.left=getWidth()
	ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>')
	ns4layerw.document.close()
	sizeupw=ns4layerw.document.width
	ns4slidew()
}
function ns4slidew()
{
	if (ns4layerw.left>=sizeupw*(-1))
	{
		ns4layerw.left-=wspeed
		setTimeout("ns4slidew()",50)
	}
	else
	{
		ns4layerw.left=getWidth()
		ns4slidew()
	}
}
function ns6marqueew(whichdiv)
{
	ns6divw=eval(whichdiv)
	ns6divw.style.left=getWidth()
	ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>'
	sizeupw=ns6divw.offsetWidth
	ns6slidew()
}
function ns6slidew()
{
	if (parseInt(ns6divw.style.left)>=sizeupw*(-1))
	{
		ns6divw.style.left=parseInt(ns6divw.style.left)-wspeed
		setTimeout("ns6slidew()",50)
	}
	else
	{
		ns6divw.style.left=getWidth()
		ns6slidew()
	}
}

function getSpeed()					// devolve scroller speed
{
	return 2;
}
function getWidth(src)					// devolve scroller width
{
	if(src)
	{
		return document.body.clientWidth/2-10
	}
	else
		return document.body.clientWidth-20;
}
function getHeight()				// devolve scroller height
{
	return 20;
}
function getBgColor()				// devolve a cor do background
{
	return "#320607";
}


//--------------------------------------------------------------------------------- Bola
// Original:  Dragos Saracu (smardoi@yahoo.com) 
// Cross Browser by:  Bob Simpson (webmaster@maryjanebrown.net) -->
// Contributor URL:  http://www.maryjanebrown.net/webmaster  -->
function BrowserCheck() 
{
	var b = navigator.appName;
	if (b == "Netscape") 
		this.b = "NS";
	else 
	if(b == "Microsoft Internet Explorer") 
		this.b = "IE";
	else 
		this.b = b;
	this.v = parseInt(navigator.appVersion);
	this.NS = (this.b == "NS" && this.v>=4);
	this.NS4 = (this.b == "NS" && this.v == 4);
	this.NS5 = (this.b == "NS" && this.v == 5);
	this.IE = (this.b == "IE" && this.v>=4);
	this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0);
	this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	if (this.IE5 || this.NS5) 
		this.VER5 = true;
	if (this.IE4 || this.NS4) 
		this.VER4 = true;
	this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
	this.min = (this.NS||this.IE);
}

function buttonUp(e) 
{
	if ( ((is.NS) ? e.which : event.button) != 1) return true;
	if (setId != 0) 
		clearInterval(setId);
	bouncingBall.visibility="visible";
	stillBall.visibility="hidden";
	sair.visibility="hidden";
	bouncingBall.left = (is.NS) ? e.pageX - 15 : event.offsetX - 15;
	bouncingBall.top = (is.NS) ? e.pageY - 15 : event.offsetY - 15;
	iter = 0;
	setId = setInterval("generateGravity()", 20);
	return true;
}
function generateGravity() 
{
	if ((parseInt(bouncingBall.top)+iter < winH) && down) 
	{
		bouncingBall.top = parseInt(bouncingBall.top) + iter;
		iter++;
		return;
	}
	else 
	{
		if ((parseInt(bouncingBall.top)< winH) && down) 
		{
			bouncingBall.top = winH + 5;
			return;
		}
		down = false;
		up = true;
		if (iter < 0 && parseInt(bouncingBall.top) > winH) 
		{
			clearInterval(setId);
			bouncingBall.visibility = "hidden";
			//stillBall.visibility="visible";
			window.history.back();
			setId = 0;
		}
		if (parseInt(bouncingBall.top) > 0 && up && iter >= 0) 
		{
			bouncingBall.top = parseInt(bouncingBall.top) - iter;
			iter--;
			if (iter%3 == 0) iter--;
			return;
		}
		down = true;
		up = false;
	}
}
//scroll message

function tickinit() 
{
	if (ie) 
	{
		if (l1 == 0 && t1 == 0) 
		{
			pos = document.all['tickpos'];
			l1 = getLeft(pos);
			t1 = getTop(pos);
		}
		ticktext.style.posTop = t1;
	}
	else 
	{
		if (l1 == 0 && t1 == 0) 
		{
			pos = document.anchors['tickpos'];
			l1 = pos.x;
			t1 = pos.y;
		}
		document.ticktext.pageY = t1;
	}
	l2 = l1 + w1;
	l3 = l1 - l2;
	l = l2;
	setInterval('tick()', 10);
}
function getLeft(ll) 
{
	if (ll.offsetParent)
		return (ll.offsetLeft + getLeft(ll.offsetParent));
	else 
		return (ll.offsetLeft);
}
function getTop(ll) 
{
	if (ll.offsetParent)
		return (ll.offsetTop + getTop(ll.offsetParent));
	else
		return (ll.offsetTop);
}
function tick() 
{
	l = l - 0.5;
	if (l < l3) 
		l = l2;
	cl = l1 - l;
	cr = l2 - l;
	if (ie) 
	{
		ticktext.style.posLeft = l;
		ticktext.style.posTop = t1;
		ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
		if (first) 
			ticktext.style.visibility = "visible";
	}
	else 
	{
		document.ticktext.pageX = l;
		document.ticktext.clip.left = cl;
		document.ticktext.clip.right = cr;
		if (first) 
			document.ticktext.visibility = "show";
	}
	first = false;
}

