﻿function BannersLoad(opcao) {
        var m_images = new Array()
        m_images[1] = (opcao == 1 ? "../../":"") + "img_site/img_header.jpg";
        m_images[2] = (opcao == 1 ? "../../":"") + "img_site/img_header_contato.jpg";
        m_images[3] = (opcao == 1 ? "../../":"") + "img_site/img_header_especialidades.jpg";
        m_images[4] = (opcao == 1 ? "../../":"") + "img_site/img_header_institucional.jpg";
        m_images[5] = (opcao == 1 ? "../../":"") + "img_site/img_header_obras360.jpg";
        m_images[6] = (opcao == 1 ? "../../":"") + "img_site/img_header_testemunhos.jpg";
        m_images[7] = (opcao == 1 ? "../../":"") + "img_site/img_header_videos.jpg";
        
        var ef_Banners = new Fx.Tween('container_header_right', { duration: 400 }), periodical;
        var fx_BannerNextChange = function() {
            ef_Banners.start('width', '0').chain(function() {
                var nm = Math.floor(Math.random() * m_images.length);
                if (nm == 0) {
                    nm = 1;
                }
                if (nm == parseInt($('container_header_right').get('pos'))) {
                    nm = nm < m_images.length ? nm + 1 : 1;
                }
              
                $('container_header_right').set('pos', nm);
                $('container_header_right').setStyle("background", "url('" + m_images[nm] + "') no-repeat left center");
                ef_Banners.start('width', '410');
            });
            return fx_BannerNextChange;
        };

        periodical = fx_BannerNextChange().periodical(5000);

}
