$(document).ready(function() {
	$("a#signUp").hover(
				// over
				function(){
					// store the original image src
					$(this).children(":first-child").attr( "originalsrc" , $(this).children(":first-child").attr("src") );
					
					// add -over to the image unless it is already -over
					if (!$(this).children(":first-child").attr("src").match(/-over/) ) {
						$(this).children(":first-child").attr( "src", $(this).children(":first-child").attr("src").replace(/\./, "-over.") );
					}
					
				},
				
				// out
				function(){
					// replace the original src
					$(this).children(":first-child").attr(
						"src", $(this).children(":first-child").attr("originalsrc")
					);
					
					$(this).children(":first-child").attr(
						"originalsrc", null
					);
				}
			);
	
	$('a#signUp, a.goback').click(function(){
		showBox();
		return false;
	});	

	$('.textBox').focus(function() {
		if (this.value == "ENTER YOUR EMAIL") {
			this.value = '';
		}
	});
	
	
});

	function showBox() {
		$("#thanks").hide();
		// show selected
		$("#formBox").fadeIn('fast');
	}

window.onload = function() {
		// preload
		$("a#signUp img").each(
			function() {
				if (!$(this).attr("src").match(/-over/) ) {
					$("<img>").attr( "src", $(this).attr("src").replace(/\./, "-over.") );
				}
			}
		);
}



		function submitEmail() {
		
			
			if (!document.emailForm.email.value)
				{
					alert('Please enter your Email.');
					document.emailForm.email.focus();
					return false;
				}	
				
			if (document.emailForm.email.value == "ENTER YOUR EMAIL")
				{
					alert('Please enter your Email.');
					document.emailForm.email.focus();
					return false;
				}						

		
		
			 var params = $("#emailForm").serialize();
			$.post("/cgi-bin/email.cgi", params,
			   	function(data){
				$("#formBox").hide();
				$("#formBox").after(data);
			});
			
			return false;
		}
