var secret;

jQuery(document).ready(function($)
{

        $(".secret").click(function() {

                $("#authBox").fadeIn('fast');
				secret = $(this).attr("id");

        });


});

function validateAuthBox()
{
		if (authBoxValid())  
		{ 
		 
			jQuery.post("newsletterinserter", { email: jQuery("input[name='email']").val() },function(){},"html");
			
			if (secret == "casestudies")
				location.href="case-studies";
				
			if (secret == "tool")
				location.href="tool";
		}
		else
		{
			jQuery("#authBoxError").html("Please Enter a Valid Name and Email.");
		}

}

function authBoxValid()
{
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (jQuery("input[name='fullName']").val() == "")
	{
		return false;
	}
	else if (!filter.test(jQuery("input[name='email']").val()))
	{
		jQuery("input[name='email']").val("");
		return false;
	}
	else 
	{
		return true;
	}
}


