jQuery(document).ready(function() {
	var user = "Email Address";
	$('#email').attr("value", user);
	$("#email").focus(function () {
		if($(this).attr("value") == user) {
			$(this).attr("value", "");
		}
	});
	$("#email").blur(function () {
		if($(this).attr("value") == '') {
			$(this).attr("value", user);
		}
	});
    $('#f1').submit(function() {
		
		var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
		if($('#email').val() == '' || $('#email').val() == user) {
            alert('Email address required.');
		} else if(re.test($('#email').val()) === false) {
			alert('You have invalid Email address. Please try again.'); 
        } else {
            $.post('/contact.php', decodeURIComponent($('#f1').serialize()), function(data) {
				if(data) {
					window.location.href = 'http://fishoil.com/thank-you.html';
				}
            });
        }
        return false;
    });
});

