var ns = document.layers;
var ie = document.all;
var ns6 = (document.getElementById && !document.all);
var div_Move;
var pos_inicial = 10;
var lastScrollY = 0;
var body_central;

function EventoScrol()
{
	var percent;
	
	if(document.body.scrollTop != lastScrollY && document.body.scrollTop < 480) 
	{
		
		percent = .3 * (document.body.scrollTop - lastScrollY);
	
		if(percent > 0) 
		{
			percent = Math.ceil(percent);
		}
		else 
		{
			percent = Math.floor(percent);
		}
		
		if(ie) 
		{
   		    if (pos_inicial > 471){
			pos_inicial = 471;	
			}
			pos_inicial += percent; 
			div_Move.pixelTop = pos_inicial;
		}
		if(ns) 
		{			
			div_Move.top = div_Move.top + percent;
		}
		if(ns6)
		{
			if (pos_inicial > 380){
			pos_inicial = 300;	
			}
			pos_inicial += percent;
			div_Move.top = pos_inicial;
		}		
		lastScrollY = lastScrollY + percent;
	}
	setTimeout('EventoScrol()',50);
}

function SetaDivMove()
{
	if(ie) 
	{
		div_Move = document.all['CSeg'].style;
		body_central = document.all['central'].style;
	}
	else if(ns)
	{
		div_Move = document.CSeg;
		body_central = document.central;
	}
	else if(ns6)
	{
		div_Move = document.getElementById('CSeg').style;
		body_central = document.getElementById('central').style;
	}
	
	EventoScrol();
	
	if(screen.width <= 640)
	{
		alert(screen.width);
		body_central.overflow='auto';
	}
}

if(screen.width > 800)
	{
		document.write ('<div id=CSeg style="position:absolute; left:785px; top:10px">')
		document.write ('<tr><td><a href="pg_redirectseguranca.asp?auxorigem=HomeBVP" target="_blank"><img src="../imgs/OS2850BannerSeguranca.gif" border="0"></a></td></tr>')
		document.write ('</div>');			
	}
else{
   	document.write ('<div id=CSeg>')
	document.write ('</div>');			
}	

function ReloadTop()
{ 
	try
	{
		parent.frames[0].frames.document.Form1.AGN.focus();
	}
	catch(e)
	{
	 var detect = navigator.userAgent.toLowerCase();
     if (detect.indexOf('mac') < 1)
	 {top.location.href="../index.asp";}
	}
	SetaDivMove();
}
