$(document).ready(function() {

   /* attach a submit handler to the form */
  $("form#contato").submit(function(event) {

    /* stop form from submitting normally */
    event.preventDefault(); 
        
    /* get some values from elements on the page: */
    var $form = $( this ),
	getnome = $form.find( 'input[name="nome"]' ).val();
	getemail = $form.find( 'input[name="email"]' ).val();
	getmensagem = $form.find( 'textarea[name="mensagem"]' ).val();
        url = $form.attr( 'action' );

    /* Send the data using post and put the results in a div */
    $.post( url, { nome: getnome, email: getemail, mensagem: getmensagem },
      function( data ) {
          var content = $( data ).find( '#sucesso' );
	  console.info(data);
          $( "#contato" ).empty().append( data );
      }
    );
  });

  //tootip script
  $("#interaja-conosco ul li a").hover(function() {
    var thisItem = $(this);
    thisItem.parent().append('<div id="tooltip">' + thisItem.attr('rel') + '</div>');
        
    $('#tooltip').css({
        'position' : 'absolute',
        'z-index' : 2,
        'top' : (thisItem.position().top - $(this).height() - 35) + 'px',
        'border' : '1px solid #ccc',
        'background' : '#fff',
        'padding' : '10px'
    });
  }, function() {
    $('#tooltip').remove();
  });

  $("#interaja-conosco ul li a").click(function(e) {
      if($(this).attr('href') == '#') {
        e.preventDefault();
    }
  });

});

