function validate_mailing(theform){
	var useremail;
	var name = theform.Name;
	var phone = theform.Phone;
	var email = theform.Email;

	useremail=isEmail(email.value);

	if (name.value==""){
		alert("Name cannot be blank.");
		name.focus();
		return false;
	}

	if (useremail==false){
		alert("Please enter your proper email address.");
		email.focus();
		return false;
	}

	if (phone.value==""){
		alert("Phone cannot be blank.");
		phone.focus();
		return false;
	}
}

function validate_inventory(theform, thefield){
	var partnumber = theform.txtPartNumber;

	if (partnumber.value==""){
		alert(thefield+" cannot be blank.");
		partnumber.focus();
		return false;
	}
}

function validate_contactus(theform){
	var useremail;
	var name = theform.Name;
	var email = theform.Email;
	var phone = theform.Phone;
	var comments = theform.FeedbackDescription;

	useremail=isEmail(email.value);

	if (name.value==""){
		alert("Name cannot be blank.");
		name.focus();
		return false;
	}

	if (useremail==false){
		alert("Please enter your proper email address.");
		email.focus();
		return false;
	}

	if (phone.value==""){
		alert("Phone cannot be blank.");
		phone.focus();
		return false;
	}

	if (comments.value==""){
		alert("Description of your needs cannot be blank.");
		comments.focus();
		return false;
	}
}

function validate_newpassword(theform){
	var oldpwd = theform.OldPassword;
	var pwd = theform.Password;
	var confpwd = theform.ConfPassword;

	if (oldpwd.value==""){
		alert("Please enter your old password.");
		oldpwd.focus();
		return false;
	}

	if (pwd.value==""){
		alert("Please enter your new password.");
		pwd.focus();
		return false;
	}
	else if (confpwd.value==""){
		alert("Please re-enter your password.");
		confpwd.focus();
		return false;
	}
	else{
		if ((pwd.value) != (confpwd.value)){
			alert("New password and confirm password does not match.");
			pwd.focus();
			return false;
		}
	}
}
