$("document").ready(
	function()
	{
		$('#mailchimp_signup').submit(
			function()
			{
				$('#mailchimp_response').html('Saving your info...');
				// Prepare query string and send AJAX request
				// NOTE: You'll need to define what info your list will accept in your MailChimp account in 
				// Lists > click the desired list > list settings > Merge tags for personalization 
				//Event.stop(event); // Stop form from submitting when JS is enabled
				var query_string = '';

				$("input[type='checkbox'][name^='group']").each( 
				    function() 
				    { 
				        if (this.checked) 
				        { 
				            query_string += "&group[]=" + this.value; 
				        } 
				    }); 

				$.get('http://www.cactuslanguage.com/.scripts/store-address.php?ajax=true'+query_string,
						{
							 email: escape($('#email').val()),
							 fname: escape($('#fname').val()),
							 lname: escape($('#lname').val()),
							 ctype: escape($('#ctype').val()),
							 country:escape($('#country').val()),
							 dob:escape($('#dob').val()),
							 city:escape($('#city').val())
						 },
						 function(data)
						 {
							$('#mailchimp_response').html(data);
							if(data == "Success! Check your email to confirm sign up.")
								$('#mailchimp_signup').hide();
						 }
					);
				return false;
			}
		);
	}
)


