var mouseX = 0;
var mouseY = 0;
var tamanho = 12;
var ativaBannerOver = false;

function moveMouse(e){
    if(document.all){
         mouseX = event.clientX;
         mouseY  = event.clientY;
    } else {
          mouseX = e.clientX;
          mouseY = e.clientY;
    }
}

function AlteraFonte(tipo){
	if(parseInt(tipo) == 1){
		if(tamanho < 20){
			tamanho = tamanho + 2;
		}
	}else{
		if(tamanho > 12){
			tamanho = tamanho - 2;
		}
	}
	document.getElementById('borda_texto').style.fontSize = tamanho +'px';
}


function FechaBanner(obj){
	var div = obj.parentNode;
	div.style.display = 'none';
}


var bannerHeight = 90;
function OcultaBanner(){
	if(bannerHeight > 5){
		bannerHeight = bannerHeight - 2;
		setTimeout('OcultaBanner()',5);
		document.getElementById('borda_bcentral').style.height = bannerHeight +'px';
	}
}

function getUrl(url){
	window.top.location.href = url;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}	
	return [curleft,curtop];
}

function BannerPopUp(id,obj){
	
	if(ativaBannerOver == true){ //-----
		
		var pos = findPos(obj);
	
		if(!document.getElementById('BannerPopUp')){	
			var criar = document.createElement('div');
			criar.setAttribute('id','BannerPopUp');
			document.body.appendChild(criar);
		}	
	
		var bodySize = BodySize();
		var div = document.getElementById('BannerPopUp');
		if((bodySize[0] - pos[0]) < 200){ pos[0] = pos[0] - 80; }
		div.style.left = (pos[0] - 80) +'px';
		div.style.top = (pos[1] + 85) +'px';
		
		div.innerHTML = '<h3>' +banner.banners[id].nome+ '</h3>' +banner.banners[id].info;
		
		div.style.visibility = 'visible';	
		
		obj.onmouseout = function(){
			div.style.visibility = 'hidden';		
		}
	}//-----
	
}

function BodySize(){
		var body_height = document.documentElement.clientHeight;
		var body_width = document.documentElement.clientWidth;
		var scroll_top = document.documentElement.scrollTop;
		
		//var page_height = document.documentElement.scrollHeight;
		//var page_width = document.documentElement.scrollWidth;
		
		if (window.opera){ 
			body_height = document.body.clientHeight;
			body_width = document.body.clientWidth;
			scroll_top = document.body.scrollTop;
		}
		return [body_width,body_height,scroll_top]
}

function PopUp(endereco,titulo,x,y){
	//window.open(endereco, titulo, "status=no, width="' +x+ '", height="' +y+ '"")	
	window.open(endereco,titulo,'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' +x+ ',height=' +y+ '');  
}

function getNavigator(){
	if(navigator.appName.indexOf("Microsoft") != -1){ //IE
		var arr = navigator.appVersion.split(";");
		if(arr[1].indexOf("6.0") !=-1){
			return true;
		}
	}
	return false;
}

function FechaAviso(){
	document.getElementById('NavigatorAlert').style.display = 'none';		
}

function AvisoIE6(){
	if(getNavigator() == true){
		var criar = document.createElement('div');
		criar.setAttribute('id','NavigatorAlert');
		document.body.appendChild(criar);
		
		var div = document.getElementById('NavigatorAlert');	
		div.innerHTML = 'Você parece estar utilizando um navegador desatualizado (Internet Explorer versão 6.0).<br />Para uma melhor interação recomendamos a atualização de seu navegador.';
		div.style.display = 'block';
		
		setTimeout('FechaAviso()',12000);
	}
}

window.onload = function(){
	//setTimeout('OcultaBanner()',1000);	
	 //AvisoIE6();
	 ativaBannerOver = true;
}
document.onmousemove = moveMouse;


