$(document).ready(function() {
    $("body").css("fontSize", "62.5%")
    smoothScroll();
    showHide();
    overNoticias();

    $(".decrease").click(function() {
        var size = parseFloat($("body").css("fontSize"));
        if (size > 62.5) {
            size -= 10;
            $("body").css("fontSize", size + "%");
        }
    }).blur();
    $(".increase").click(function() {
        var size = parseFloat($("body").css("fontSize"));
        if (size < 92.5) {
            size += 10;
            $("body").css("fontSize", size + "%");
        }
    }).blur();

    $("a[rel='external']").attr("target", "blank");
});

/* SMOOTH SCROLL */
function smoothScroll() {
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body')
				.animate({scrollTop: targetOffset}, 1000);
			return false;
			}
		}
	});
}

/* MUDA O BACKGROUND DA HOME DE ACORDO COM O CONTEUDO DO FLASH */
function changeBodyClass(cssClass) {
	$("body").removeAttr('class').addClass(cssClass);
}

/* SHOW/HIDE LAYERS PRO CONTATO */
function showHide() {
		$('#empty, #atendimentoCliente, #trabalheConosco, #linhaEtica').hide().find("input, textarea").attr("disabled", true);
		$("#area").change(function() {
		    $("#" + this.value).show().siblings().hide().find("input, textarea").attr("disabled", true);
		    $("#" + this.value).show().find("input, textarea").removeAttr("disabled");
		});
		$('#area' + $(this).find('option:selected').attr('id')).show().find("input, textarea").removeAttr("disabled");
	$("#area").change();
}

/* HOVER PARA AS LISTAGENS DE NOTÍCIAS */
function overNoticias() {
	$('#outrasNoticias li, #listagem li').bind("mouseenter",function() {
		$(this).find('a').addClass('bold');
	}).bind("mouseleave",function() {
		$(this).find('a').removeClass('bold');
	});
}  
