
function alertSignUp(email) {
	
	// capture the email address ajaxily here
	// then load the prefs fancybox
	
	var href = '/prefs?email=' + encodeURIComponent(email);
	if (typeof(currentLocation) != 'undefined') {
		if (typeof(currentLocation.state) != 'undefined') {
			href += '&state=' + currentLocation.state;
		}
		if (typeof(currentLocation.city) != 'undefined') {
			href += '&city=' + currentLocation.city;
		}
		if (typeof(currentLocation.zip) != 'undefined') {
			href += '&zip=' + currentLocation.zip;
		}
	}

	$.fancybox({
		'href' : href,
		'width' : '600px',
		'onComplete' : function() {
			$.fancybox.resize();
			$("#id_address").focus();
		}
	});
	return false;
}


$(function() {
	$("#alertSignUp").validate({
		submitHandler: function(form) {
			var email = $("#newCoupEmail").val();
			alertSignUp(email);	
		}	
	});
	$("#alertSignUpFt").validate({
		submitHandler: function(form) {
			var email = $("#newCoupEmailFt").val();
			alertSignUp(email);	
		}	
	});
	$("#alertSlideUp").validate({
		submitHandler: function(form) {
			var email = $("#newCoupEmailSU").val();
			alertSignUp(email);
			$.cookie("CMap_emailAlert", "SignedUp", { expires: 10000 });
			closeBtmAd();
		}	
	});
});

