var siglaIdioma = 'pt-BR';
var mostrarMenu = true;
var MontarCorpo = true;

var recuoFlash = 93;

var larguraSite = 1000;
var alturaSite = 580;

var larguraBackground = 1600;
var alturaBackground = 1040;

var larguraPagina = 0;
var alturaPagina = 0;

var leftBackground = 0;
var topBackground = 0;

var leftSite = 0;
var topSite = 0;

var topMenu = 0;

var lightboxWidth = 0;
var lightboxHeight = 0;

$(function()
{
	jQuery("body").fadeIn("fast");
	
	alinharSite();

	if (mostrarMenu)
	{
		jQuery('.menu').flash( {
		    src : '/menu.swf',
		    width : '100%',
		    height : '500',
		    wmode : 'transparent',
		    flashvars : {
			    'siglaIdioma' : siglaIdioma
		    }
		});
	}

	jQuery("body").mousemove(
	        function(e)
	        {
		        if (e.pageX > leftSite && e.pageX < (leftSite + 180)
		                && e.pageY > (topSite + 70)
		                && e.pageY < (topSite + 220))
		        {
			        jQuery('.menu').css('z-index', 12);
		        } else
		        {
			        if (!menuAberto)
				        jQuery('.menu').css('z-index', 9);
		        }
	        });

//	jQuery('.bread-crumb .descricao').corner("4px");
//	jQuery('.menu-esq a').corner("4px");
//	jQuery('.menu-dir a').corner("4px");
//	jQuery('.acesso-rapido').corner("4px");

	jQuery('div.lightbox-overlay').bind('click', function()
	{
		jQuery('div.lightbox-overlay').fadeOut('slow');
		jQuery('div.lightbox-conteudo').fadeOut('slow');
	});

	jQuery('div.lightbox-conteudo').bind('click', function()
	{
		jQuery('div.lightbox-overlay').fadeOut('slow');
		jQuery('div.lightbox-conteudo').fadeOut('slow');
	});
	
	jQuery('.menu-esq a').mouseover(function(){
		$(this).parent().parent().addClass("box-left-on");
		$(this).parent().addClass("box-right-on");
	}).mouseout(function(){
		$(this).parent().parent().removeClass("box-left-on");
		$(this).parent().removeClass("box-right-on");
	});
	
	jQuery('.menu-dir a').mouseover(function(){
		$(this).parent().parent().addClass("box-left-on");
		$(this).parent().addClass("box-right-on");
	}).mouseout(function(){
		$(this).parent().parent().removeClass("box-left-on");
		$(this).parent().removeClass("box-right-on");
	});
    
    jQuery('.continents a.site').mouseover(function(){
        $(this).find(".box-left").addClass("box-left-on");
		$(this).find(".box-right").addClass("box-right-on");
	}).mouseout(function(){
        $(this).find(".box-left").removeClass("box-left-on");
		$(this).find(".box-right").removeClass("box-right-on");
	});

	jQuery("#acesso-rapido").mouseleave(function(){
		$("#acesso-rapido").fadeOut("slow");
	});
	
});

jQuery(window).bind('resize', function()
{
	alinharSite();
});

function carregarDimensoes()
{
	larguraPagina = jQuery('body').width();
	alturaPagina = jQuery('body').height();
}

function alinharSite()
{

	carregarDimensoes();

	leftSite = parseInt((larguraPagina - larguraSite) / 2);
	topSite = parseInt((alturaPagina - alturaSite) / 2);

	leftBackground = parseInt((larguraPagina - larguraBackground) / 2);
	topBackground = parseInt((alturaPagina - alturaBackground) / 2);

	jQuery('body').css('background-position',
	        leftBackground + 'px ' + topBackground + 'px');

	if (MontarCorpo)
	{
		jQuery('.site').css('left', leftSite);
		jQuery('.site').css('top', topSite);
	} else
	{
		jQuery('.topo').css('position', 'absolute');
		jQuery('.topo').css('left', leftSite);
		jQuery('.topo').css('top', topSite);

		jQuery('.rodape').css('left', leftSite);
		jQuery('.rodape').css('top', topSite + alturaSite - 52);
	}

	topMenu = topSite - recuoFlash;

	jQuery('.menu').css('top', topMenu);
}

var menuAberto = false;

function fecharMenu()
{
	menuAberto = false;
}

function abrirMenu()
{
	menuAberto = true;
}

function abreAcessoRapido()
{
	if (jQuery('div.acesso-rapido').css('display') == 'none')
		jQuery('div.acesso-rapido').fadeIn('slow');
	else
		jQuery('div.acesso-rapido').fadeOut('slow');
}
