$(document).ready(function () {
	$("#sff .btn-send").click(function () {
		$.ajax({
		    type: "POST",
		    url: "/emails/magazine",
		    data: $('#sff form').serialize(),
		    success: function(msg){
				switch(msg) {
				case "data":
					$(".error").replaceWith('<div class="error"><p>Unknown error. Please try again.</p></div>');
				  break;
				case "validation":
					$(".error").replaceWith('<div class="error"><p>Please fill all form fields and be sure email is correct.</p></div>');
				  break;
				case "unsent":
					$(".error").replaceWith('<div class="error"><p>Unknown error. Please try again.</p></div>');
				  break;
				case "sent":
					$("#for-replace").replaceWith('<p style="color: #FF6600;">Thank you for you interest. We will you keep posted.</p>');
				  break;
			    default:
					$("#for-replace").replaceWith('<p style="color: #FF6600;">Thank you for you interest. We will you keep posted.</p>');
			      break;
				}
		    },
		    error: function() {
		    	alert('error !!!');
		    }
		});
    });
});
