$(document).ready(function(){
	$('#sendEmail').submit(function() {
		$.ajax({
			type: "POST",
			url: "sendemail.php",
			data: "action=submit&email="+$('#email').val(),
			success: function(msg){
				if (msg == 'Success') {
					$('.email-form').empty().append('Thanks! You are now registered to start receiving the latest ET news.');
				} else if (msg == 'Invalid') {
					$('.searchbox .msg').empty().append('Error! Invalid email.');
				} else {
					$('.searchbox .msg').empty().append('Error! Please try again.');
				}
			}
		});
		return false;
	});				   
});
