$(function(){
      if($('body.front').length)
      {
            $('#noticias').fadeSlide();
            $('#trigger-calendario').live('click',function(){
                  if($('#eventos .descricao .wrapper').is(':visible'))
                  {
                        $(this).parent().css('background-position', '-517px -534px');
                        $('#eventos .descricao .wrapper').fadeOut(400, function(){
                              $('#eventos #calendario').fadeIn(400);
                        });
                  }
                  else
                  {
                        $(this).parent().css('background-position', '-517px -508px');
                        $('#eventos #calendario').fadeOut(300, function(){
                              $('#eventos .descricao .wrapper').fadeIn(300);
                        });
                  }
            });
            
            $('#calendario a').live('click', function(){
                  var year = $(this).attr('ano');
                  var month = $(this).attr('mes');
                  $('#calendario').load(ROOT_REL + 'var/www/AjaxCalendario.php', {
                        ano:year,
                        mes:month
                  });
            });
            $('.hasevent').live('click', function(e){
                  var id = $(this).attr('id');

                  $.post(ROOT_REL+'var/www/AjaxEvento.php',{
                        id:id
                  },
                  function(data){
                        $('#trigger-calendario').parent().css('background-position','-517px -508px');
                        $('#eventos .img').html(data.img);
                        $('#eventos .wrapper').html(data.wrapper);

                        $('#eventos #calendario').fadeOut(400, function(){
                              $('#eventos .descricao .wrapper').fadeIn(400);
                        });
                  },'json');
            });
            
            
            
      }
      $('#contato_telefone, .Telefone').mask('(99) 9999-9999');
      $('.Cep').mask('99999-999');
      $('.Nascimento').mask('99/99/9999');
	  $('#ASF_CNPJ').mask('99.999.999/9999-99');
      $('.c-box').colorbox({
            current: "Imagem {current} de {total}",
            previous: "Anterior",
            next: "Próximo",
            close: "Fechar",
			maxHeight: "95%",
			maxWidth: "95%",
      });
});

