$(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#volare.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');
});
function fontSize(action, container){
    container = typeof(container) != 'undefined' ? container : "#content" //se não for especificado um container será "div.texto"
	baseSize = parseInt($(container+" p").css("font-size")) //extraímos o font-size padrão, tomando como base o p do nosso container
 
    $els = $(container+" p");
 
    $els.each(function(){
        $fs = parseInt($(this).css("font-size"));
        if(action=="plus" && baseSize < 16){ 
            $fs+=1;
        }
        else if(
            action == "minus" && baseSize > 11) {
        $fs -= 1;
               }
        $(this).css("font-size", $fs)
    })
}
