$(document).ready(function(){
    
    //Banner TOPO
    $('#bannerPrincipal li:not(#bannerPrincipal li:first-child)').hide();
    var rotatoInd = 1;
    
    function randImages()
    {
        var listaImagens = $('#bannerPrincipal li');
       
           
           if(rotatoInd < listaImagens.length)
           {
                rotatoInd++;
                var itemAtual = $('#bannerPrincipal li:nth-child('+ rotatoInd +')');
                itemAtual.fadeIn(500);    
                $('#bannerPrincipal li:nth-child('+ rotatoInd - 1+')').fadeOut(500);
           }
           else
           {
                var itemAtual = $('#bannerPrincipal li:first');
                itemAtual.fadeIn(500);
                $('#bannerPrincipal li:nth-child('+ rotatoInd +')').fadeOut(500);
                rotatoInd = 1;
           }
    }
    
   	setInterval(function()
	{
		randImages();
	}, 5000);    
  
    //Inicio PrettyPhoto
	$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});

	//Image Galery
	$(".photo a").prepend("<span></span>");
    
    $('.listaCDs li~li').css({
        'background' : 'url(imagens/divisorProg.jpg) no-repeat center top',
        'padding-top' : '25px'
    });
    
   	// validação de Forms
	$('.validaForm').validate({
		// define regras para os campos
		rules: {
			txtNome: {
				required: true,
				minlength: 2
			},
            txtEmail: {
				required: true,
				email: true
			},
            selCD: {
				required: true
			},
            txtMensagem: {
                required:true,
                minlength:5                
                            
            }            
		},
		// define messages para cada campo
		messages: {
			txtNome:     "Informe seu nome!",
            txtEmail:    "Informe um e-mail v&aacute;lido!",
            selCD:       "Informe qual CD voc&ecirc; deseja!",
            txtMensagem: "Informe o conte&uacute;do da sua mensagem!"                        
		}
	});   
});
