$(function() {
	$(document).ready(function() {
		  var options = {
		    newsList: "#ticker2",
		    startDelay: 10,
		    placeHolder1: "[]"
		  }
		  $("#ticker2").newsTicker(options);
		});
	
	$("#dtnasc_txt").click(function() {
		$("#dtnasc_txt").setMask("99/99/9999");
	});

        function notiLoop(){
            var not = new Array();
            var total = 0;
            var atual = 2;
            $('#ticker-wrapper').css({
                height:'94px',
                overflow: 'hidden',
                position: 'relative'
            })
            $('#js-news li.news-item').each(function(i, v){
                $(this).attr('name', i+1).css({
                    height:'154px',
                    opacity:0,
                    display : 'block',
                    width: '100%',
                    top: 0,
                    left: 0,
                    position: 'absolute'
                });
                total++;
            });
            $('#js-news li[name=1]').fadeTo('normal', 1);
            setInterval(function(){
                $('#js-news li[name!='+atual+']').fadeOut('normal');
                $('#js-news li[name='+atual+']').fadeTo('normal', 1);
                if(atual == total)
                    atual = 1;
                else
                    atual++;
            }, 6000);
        }        
        if($('#js-news li').length > 1){
            notiLoop();
        }
        else {
        	$('#ticker-wrapper').css({
                height:'94px',
                position: 'relative'
           	});
        }
});
