$(function(){
$('[data-toggle="tooltip"]').tooltip({html:true});
});

$(function() {
  $("#register_btn").click(function() {
	var email = $("input#email").val();
	var username = $("input#username").val();
	var password = $("input#password").val();
	var recaptcha_challenge_field = $("input#recaptcha_challenge_field").val();
	var recaptcha_response_field = $("input#recaptcha_response_field").val();
	var confirm_password = $("input#confirm_password").val();
	
	var dataString = 'email='+ email +'&username='+ username + '&password=' + password+'&confirm_password='+ confirm_password+'&recaptcha_challenge_field='+ recaptcha_challenge_field + '&recaptcha_response_field=' + recaptcha_response_field;
	$("#register_btn").append(' <span class="fa fa-spinner fa-spin"></span>');
	$.ajax({
      type: "POST",
      url: 'ajax.php?case=register',
      data: dataString,
	  cache: false,
      success: function(result) {
		  setTimeout(
		  function() 
		  {
	    $("#register_btn span").remove();
		$("div#register-message").html(result);
		}, 2000);
      }
     });
    return false;
	});
});
