
var $;

$(document).ready(function (){

    var $carousel = $('#banner-superior').flickity({
      // options
      cellAlign: 'center',
      imagesLoaded: true,
      autoPlay: 6000,
      selectedAttraction: 0.029,
      friction: 0.4,
      contain: true,
      pageDots: true,
      wrapAround: true
    });

    $(".navbar-toggle").click(function (e) {
        $('body').toggleClass('menu-aberto');
        e.stopPropagation();
    });
var $input    = document.getElementById('campo_file'),
    $fileName = document.getElementById('campo_file_name');
if($input){  
  $input.addEventListener('change', function() {
    $fileName.innerHTML = this.value;
  }, false);
}





$(".data").mask("99/99/9999");
  $(".cep").mask("99999-999");
  // $(".numero").mask("?9?9?9?9?9?9");
  $(".numero").keydown(function (e) {
        // Allow: backspace, delete, tab, escape, enter and .
        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
             // Allow: Ctrl+A, Command+A
            (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) || 
             // Allow: home, end, left, right, down, up
            (e.keyCode >= 35 && e.keyCode <= 40)) {
                 // let it happen, don't do anything
                 return;
        }
        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
            e.preventDefault();
        }
    });
  $(".cpf").mask("999.999.999-99");
  $(".cpfn").mask("99999999999");
  $(".cnpj").mask("99.999.999/9999-99");
  $('.cpf_cnpj').mask("999.999.999-99");

  $('.telefone').focusout(function(){
    var phone, element;
    element = $(this);
    element.unmask();
    phone = element.val().replace(/\D/g, '');
    if(phone.length > 10) {
      element.mask("(99) 99999-999?9");
    } else {
      element.mask("(99) 9999-9999?9");
    }
  }).trigger('focusout'); 



});