$(document).ready(function() {
		// Building a little popup form
		/*
		Here are our steps
		1. Hijack the link so it pulls the form instead of the regular link
		2. Put the form right where our mouse is +/-
		3. Hijack the submit event so it ajax's the server and gets an ok back
		4. When the ok comes back close the form
		*/
		
		// steps 1 and 2
		$('div#mini_signup p a.signup').click(function(e) { 
				var x_pos = e.pageX - 150; 
				$('div#mini_signup form').css('left', x_pos);
				$('div#mini_signup form').css('top', '10px');
				$('div#mini_signup form').slideDown(); 
				return false;
		});
		
		// a close the form link
		$('div#mini_signup form fieldset div a').click(function() {
				$('div#mini_signup form').slideUp();
		});
		
		// step 3 and 4
		$('div#mini_signup form').submit(function() {
				// add a loading graphic to submit button to show activity
				$('div#mini_signup form input[@type*=submit]').html('<img src="images/ajax-loader.gif">');
				// post the data
				var my_name = $('input#name').val();
				var my_email = $('input#email').val();
				$.post("contact/signup", { name: my_name, email: my_email }, function(data) {
						alert('We Received your Signup - Thanks!');
						$('div#mini_signup form').slideUp(); 
				});
				return false;
		});		

});