function correctPNG() {

    var arVersion = navigator.appVersion.split("MSIE")

    var version = parseFloat(arVersion[1])

    if ((version >= 5.5) && (document.body.filters)) {

        for(var i=0; i<document.images.length; i++) {

            var img = document.images[i]

            var imgName = img.src.toUpperCase()

            if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {

                var imgID = (img.id) ? "id='" + img.id + "' " : ""

                var imgClass = (img.className) ? "class='" + img.className + "' " : ""

                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "

                var imgStyle = "display:inline-block;" + img.style.cssText

                if (img.align == "left") imgStyle = "float:left;" + imgStyle

                if (img.align == "right") imgStyle = "float:right;" + imgStyle

                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle

                var strNewHTML = "<span " + imgID + imgClass + imgTitle

                + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"

                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"

                + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"

                img.outerHTML = strNewHTML

                i = i-1

            }

        }

    }

}

$(document).ready(function(){
   correctPNG();

   $('.col1 #ano').change(function(){
        window.location = baseUrl + 'noticias/ano/' + $(this).val();
    });

    //campos clicaveis
    $('.clicavel').focus(function(){

        if( $(this).val() == $(this).attr('title') ){
            $(this).val('');
            $(this).addClass('editando');
        }

    });
    $('.clicavel').blur(function(){

        if( $(this).val() == '' ){
            $(this).val($(this).attr('title'));
            $(this).removeClass('editando');
            $('label.error').css('display','none');
        }

    });

    $("#newsletter").validate({
        submitHandler: function() {
            $.get( baseUrl + 'home/newsletter/',
            {email: $('#newsletterEmail').val()},
            function(data){
                $('#newsletterEmail').val('');
                $('label.reply').css('display','');
                $('label.reply').html(data);
                setTimeout( function() {
                    $('label.reply').fadeOut();
                    $('label.error').fadeOut()
                } , 5000 );
            }
        )
        },
        rules:{
            newsletterEmail: {
                email:true,
                required:true
            }
        },
        messages:{
            newsletterEmail: "Preencha com um email válido. "
        }
    });
//    setTimeout( function() {$('.noticias .windows').fadeOut()} , 3000 );

});

function mouseOverMenu(obj,arquivo){
//    if( !$(obj).hasClass('active') ){
        $(obj).attr('src',
        baseUrl + 'assets/images/' + arquivo + '-ativo.png' );
        $(obj).parent().find('img').first().attr('src',
        baseUrl + 'assets/images/menu-bullet-ativo.png' );
//    }
}
function mouseOutMenu(obj,arquivo){
//    if( !$(obj).hasClass('active') ){
        $(obj).attr('src',
        baseUrl + 'assets/images/' + arquivo + '.png' );
        $(obj).parent().find('img').first().attr('src',
        baseUrl + 'assets/images/menu-bullet.png' );
//    }
}
