$(function() {
	$('#opt-in').submit(function() {
		$.post('../thanks-list.php', {
			mail: true, // this is for security purposes
			name: $('#name').val(), // our name field value
			email: $('#email').val(), // email field value
			aff_id: $('#aff_id').val() // and the affiliate ID
		}, function(data) { // 'data' is just a magic variable used for metadata
			if(data.success == true) { // if our form was submitted correctly
				$('#pop,#mask,#popWrap').remove(); // we hide the fields
			} else alert('Server did something bad. Really bad. Impossibly bad.'); // otherwise we alert accordingly
		}, 'json');	 // we will interpret our data as jSon so we may use json_encode()
		return false // we will interrupt the form submission so we don't leave the page
	});
});
