/*
  Projeto: Rafael Barreiros - Instrutor Vocal
  Desenvolvedor: Rafael Thomazetti
  URL: http://www.rafaelbarreiros.com.br
*/

$(function(){
  caminho = location.hash.replace(/#!\//, '');
  
  altura = document.documentElement.clientHeight;
  
  if(altura > 690) {
    $('#conteudo #contato').addClass('bottom');
  }
  
/* Rolagem Inicial caso /#!/xxx */
if (caminho != '') {
  $('html, body').animate({scrollTop: $('#' + caminho).offset().top - 70}, 1000);
}

$('#menu a').click(function(){
  div = $(this).attr('rel');
  $('html, body').animate({scrollTop: $('#' + div).offset().top - 70}, 1000);

  location.hash = '!/' + div;
  return false;
});

$("#fotos #fotos-interno").jCarouselLite({
      btnNext: ".next",
      btnPrev: ".prev",
      visible: 1,
      start: 0,
      circular: true,
      width: 600
});
  
/* ----- Formulário de Contato Ajax ----- */
$('#contato-mostra').hide();
$('#contato-carregando').hide();

$('#btn-enviar').live('click', function(){
  enviarContato();
});
  
function enviarContato(){
  $('#contato-mostra').html('');
  $('#contato-mostra').hide();
  $('#contato-carregando').fadeIn();

  $.post('/contato', {
    name: $('#nome').val(),
    email: $('#email').val(),
    phone: $('#telefone').val(),
    message: $('#mensagem').val()
  }, function(response){
    $('#contato-carregando').hide();
    $('#contato-mostra').html(response);
    $('#contato-mostra').fadeIn();
  });
}

  
});

/* ----- ShadowBox ----- */
Shadowbox.init({
  language : 'pt'
});

