// JavaScript Document
function setEmbreve(action)
{
	var dst_codigo	= document.getElementById('dst_codigo') ? document.getElementById('dst_codigo') : null;
	var bodyElement	= document.getElementsByTagName('body');
	var pubTop		= document.getElementById('div-publicidade-top') ? document.getElementById('div-publicidade-top') : null;
	var pubLeft		= document.getElementById('div-publicidade-left') ? document.getElementById('div-publicidade-left') : null;
	var isIE		= navigator.appVersion.indexOf('MSIE') != -1;
	
	bodyElement		= bodyElement[0];
	

	
	if(action == 'hide')
	{
		document.getElementById('div-embreve-box').style.display= 'none';
		document.getElementById('div-embreve').style.display	= 'none';
		if(dst_codigo != null)dst_codigo.style.display			= 'inline';
		
		if(!isIE)
		{
			bodyElement.style.overflow	= 'visible';
		}
		else
		{			
			var ie7 = navigator.userAgent.toUpperCase().indexOf('MSIE 7') != -1;
			
			if(ie7)document.documentElement.style.overflow = 'auto';
			else document.body.scroll = "auto";
		}
		
		if(pubTop != null)pubTop.style.visibility = 'visible';
		if(pubLeft != null)pubLeft.style.visibility = 'visible';
	}
	else
	{		
		window.scrollTo(0,0);
		
		if(!isIE)
		{
			bodyElement.style.overflow = 'hidden';
		}
		else
		{
			var ie7 = navigator.userAgent.toUpperCase().indexOf('MSIE 7') != -1;			
			
			if(ie7)document.documentElement.style.overflow = 'hidden';
			else document.body.scroll = "no";
		}		
		if(pubTop != null)pubTop.style.visibility = 'hidden';
		if(pubLeft != null)pubLeft.style.visibility = 'hidden';
		
		if(dst_codigo != null)dst_codigo.style.display = 'none';
		
		if (self.innerHeight) // all except Explorer
		{
			var width	= self.innerWidth;
			var height	= self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)// Explorer 6 Strict Mode
		{
			var width	= document.documentElement.clientWidth;
			var height	= document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			var width	= document.body.clientWidth;
			var height	= document.body.clientHeight;
		}
		
		var embreve		= document.getElementById('div-embreve');
		var embreveBox	= document.getElementById('div-embreve-box')
		
		embreve.style.width 	= width + 'px';
		embreve.style.height	= height + 'px';
		
		embreve.style.display	= "block";
		embreveBox.style.display= "block";
		
				
		if(embreveBox.getBoundingClientRect)//Internet Explorer O:
		{
			var rectRange	= embreveBox.getBoundingClientRect();
			var objWidth	= rectRange.right - rectRange.left;
			var objHeight	= rectRange.bottom - rectRange.top;
		}
		else//Mozilla :D
		{
			var objWidth	= embreveBox.clientWidth;
			var objHeight	= embreveBox.clientHeight;
		}
		
		embreveBox.style.left	= parseInt((width / 2) - (objWidth / 2)) + 'px';
		embreveBox.style.top	= parseInt((height / 2) - (objHeight / 2)) + 'px';
	}
	
	return false;
}

