$(document).ready(function(){
    $("body").css("fontSize", "62.5%")

    $(".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();
	
	if ($("body.news").length) {
        $("div.news-images a:not(:first)").hide();
        if ($("div.news-images a").length > 1) {
            $("div.news-images").append("<a href='' class='see-more'>veja mais fotos</a>").find(".see-more").attr("href", "javascript:void(0)").click(function() {
                $("div.news-images a:first").next().click();
            });
        }
        $("div.news-images a:not(.see-more)").lightBox({
            txtImage: "Foto",
            txtOf: "de"
        });
    }
	
	if($("#box-enquete").length){
		$("#form-enquete").submit(function(){
			if(!$("input[name='answerId']:checked").length){
				return false;
			}
		})
    }
	if($("body.poll").length){
		
		$("div.poll form").submit(function(){
			if (!$("input[name='answerId']:checked", $(this)).length) {
				return false;
			}
		})
		
    }
	if($("table.result").length)
	{
		$('table.result tr:odd').addClass('odd');
	}
	
	if($("body.simulator.first-step").length){
		$("input[name='valor']:not(:checked)").parent().siblings("input.text-field").attr("disabled", true);
		$("input[name='valor']").click(function(){
			$("input[name='valor']:not(:checked)").parent().siblings("input.text-field").attr("disabled", true).attr("value", "0");
			$(this).parent().siblings("input.text-field").attr("disabled", false);
		});
	}
	
	if($(".all-news  #primary .highlight").lenght){
		$(".all-news  #primary .highlight:last-child").addClass("last");
	}
	
	if($("body#cnr.contact-us")){
		if($("#ouvidoria").length){
			$("#ouvidoria").click(function(){
				$("#contact-options").slideDown("slow");
				$("#this").unbind("click");
			})
		}else{
			$("#contact-options").show();
		}
	}
	
	$("a[rel='external']").attr('target','_blank');
});