$(document).ready(
    function(){
            //manipulação listas
            $('.options-top UL LI:last-child A').css("border", "0px none");
            $('#menu-top LI:last-child').css("border", "0px none");
            
            //configuração containers
            var columB = $("#containerB").height();
            var columD = $("#containerD").height();
            
            if(columB > columD){
                $("#containerD").height(columB);
                $("#containerB").height(columB);
            } 
            
            //máscaras
            $(".data").mask("99/99/9999");
            $(".telefone").mask("(99) 9999-9999");
            $(".cpf").mask("999.999.999-99");
            $(".cnpj").mask("99.999.999/9999-99");
            $(".cep").mask("99999-999");
            $(".hora").mask("99:99");
            
            $(".img-diario-home").hover(
		function(){
			$(this).css({'position' : 'absolute', 'z-index' : '1000'});
			$(this).stop().animate({ 
				width: "110px",
				height: "110px",
				marginTop: "-5px",
				marginLeft: "-8px"
			}, 200 );
		},
		function(){
			$(this).css({'position' : 'static', 'z-index' : '1'});
			$(this).stop().animate({ 
				width: "75px",
				height: "75px",
				marginTop: "0px",
				marginLeft: "0px"
			}, 200 );
		}
            );
                
            $('a#encarte').lightBox();
            $('#gallery a').lightBox();

            $('#cod_id_pais').change(function(){
                    if($('#cod_id_pais').selectedTexts() != '')
                    {
                            $('#cod_id_estado').removeOption(/./);
                            $('#cod_id_municipio').removeOption(/./);

                            $('#cod_id_prefeito').val('');
                            $('#ds_nome_prefeito').val('');
                            $('#ds_partido').val('');

                            $('#cod_id_estado').ajaxAddOption('lib/Listagens.php', {cod_id_pais: $(this).val(), acao: 'ler_estados'}, false);
                    }
            });

            $('#cod_id_estado').change(function(){
                    if($('#cod_id_estado').selectedTexts() != '')
                    {
                            $('#cod_id_municipio').removeOption(/./);

                            $('#cod_id_prefeito').val('');
                            $('#ds_nome_prefeito').val('');
                            $('#ds_partido').val('');

                            $('#cod_id_municipio').ajaxAddOption('lib/Listagens.php', {cod_id_estado: $(this).val(), acao: 'ler_municipios'}, false);
                    }
            });

            $('#cod_id_municipio').change(function(){
                    if($('#cod_id_municipio').selectedTexts() != '')
                    {
                            $('#cod_id_prefeito').val('');
                            $('#ds_nome_prefeito').val('');
                            $('#ds_partido').val('');

                            $.getJSON('lib/Listagens.php', {cod_id_estado: $('#cod_id_estado').val(), cod_id_municipio: $(this).val(), acao: 'ler_prefeito'},
                                            function(result)
                                            {
                                                    $('#cod_id_prefeito').val(result[0]);
                                                    $('#ds_nome_prefeito').val(result[1]);
                                                    $('#ds_partido').val(result[2]);
                                            }
                            );
                    }
            });

            //Carrega estados ao iniciar a página
            $('#cod_id_estado').ajaxAddOption('lib/Listagens.php', {cod_id_pais: $('#cod_id_pais').val(), acao: 'ler_estados'}, false);

            $('#cod_id_prefeito').val('');
            $('#ds_nome_prefeito').val('');
            $('#ds_partido').val('');
            
            $('#ticker').bxSlider({
                    mode: 'fade',
                    speed: 1000,
                    pause: 10000,
                    auto: false,
                    controls: true,
                    auto_direction: 'left',
                    nextText: '<img src="img/bullet02.png" />',
                    prevText: '<img src="img/bullet02b.png" />',
                    width: 290,
                    wrapper_class: 'planeta3e_home',
                    pager: false
            });           
            
            
    }
);
    
function popIntranet( url ) 
{
    params  = 'width='+screen.width;
    params += ', height='+screen.height;
    params += ', top=0, left=0'
    params += ', fullscreen=yes';

    newwin=window.open(url,'windowname4', params);
    if (window.focus) {newwin.focus()}

    return false;
}
