$(document).ready(function() {
	var emailRegEx = new RegExp("^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");

	$("#email-signup").find("td.input").find(":input").each(function() {
		if ($(this).val().length == 0)
			$(this).parent().find("label").css("display","block");
	});
	
	$(".first-focus").focus();

	$("#email-signup").find("td.input").find(":input").focus(function() {
		$(this).parent().find("label").css("display","none");
	});

	$("#email-signup").find("td.input").find(":input").blur(function() {
		if ($(this).val().length == 0)
			$(this).parent().find("label").css("display","block");
	});
	
	$("#email-signup").submit(function() {
		// Validate form
		var err = new Array();
		
		if ($(this).find("input#youremail").val().length == 0
			|| !emailRegEx.test($(this).find("input#youremail").val()))
			err.push("Please provide a valid email address.");

		if (err.length > 0) {
			alert(err.join("\n"));
			return false; 
		}
		
		return true;
	});
	
	$(".lightbox").fancybox({
				'autoScale'			: false,
				'width'				: '635px',
				'height'			: '360px',
				'transitionIn'		: 'fade',
				'transitionOut'		: 'fade',
				'titlePosition'		: 'over',
				'scrolling'			: 'no',	
				'onComplete'	:	function() {
					$("#fancybox-wrap").hover(function() {
						$("#fancybox-title").show();
							}, function() {
								$("#fancybox-title").hide();
								});
							}
	});
});

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,"",features);
}

