$(document).ready(function() {
	$('#forgotpasslink').click(function() {
		$('#forgotpassdata').show('fast');
	});

	$('#forgot_close').click(function() {
		$('#forgotpassdata').hide('fast');
	});

	$('#forgot_password').submit(function() {
		if($("#emailaddress").val() == '') {
			alert('Please enter your emailaddress.');
		}
		else {
			var re = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
			if (re.test($("#emailaddress").val())==false) {
				alert('You have entered a invalid emailaddress.');
			}
			else {
				return true;
			}
		}
		return false;
	});

	$('#forgot_password2').submit(function() {
		if($("#emailaddress2").val() == '') {
			alert('Please enter your emailaddress.');
		}
		else {
			var re = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
			if (re.test($("#emailaddress2").val())==false) {
				alert('You have entered a invalid emailaddress.');
			}
			else {
				return true;
			}
		}
		return false;
	});

 $("#account_menu_main").find('a').each(function()
 {
  var hrf = $(this).attr("href");
  $(this).attr("href", "/myaccount.php" + hrf);
 });
});
