function validate_form (theform) {

var validform = true;

if ( (theform.fn.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply your first name.");
	theform.fn.focus();
}

if ( (theform.ln.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply your last name.");
	theform.ln.focus();
}

if ( (theform.select1.value == "storehouse[0]") && validform ) {
	validform = false;
	window.alert("You must supply a valid facility to create an account.");
	theform.select1.focus();
}

if ( (theform.phone.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply a contact phone number.");
	theform.phone.focus();
}




if ( (theform.email.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply a valid email address.");
	theform.email.focus();
}

if ( (theform.email.value.indexOf(" ") != -1) && validform ) {
	validform = false;
	window.alert("Your email address cannot contain spaces. Please correct the address.");
	theform.email.focus();
}

if ( (theform.email.value.indexOf("@") == -1) && validform ) {
	validform = false;
	window.alert("Your email address must contain the '@' symbol. Please correct the address.");
	theform.email.focus();
}

if ( (theform.email.value.indexOf(".") == -1) && validform ) {
	validform = false;
	window.alert("Your email address must contain at least 1 '.'. Please correct the address.");
	theform.email.focus();
}

if ( (theform.email.value.length > 50) && validform ) {
	validform = false;
	window.alert("Your email address cannot be more than 50 characters.");
	theform.email.focus();
}


if ( (theform.newregpass.value.length < 1) && validform ) {
	validform = false;
	window.alert("You must supply a password.");
	theform.newregpass.focus();
}

if ( (theform.newregpass.value.length > 50) && validform ) {
	validform = false;
	window.alert("Your billing address cannot be longer than 50 characters.");
	theform.newregpass.focus();
}

if ( (theform.newregpass.value != theform.newregpass2.value) && validform ) {
	validform = false;
	window.alert("Your password does not match, please retype again.");
	theform.newregpass2.focus();
}


if ( (theform.MgmtName.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply the name of your manager.");
	theform.MgmtName.focus();
}

if ( (theform.MgmtPhone.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply a contact phone number for your manager.");
	theform.MgmtPhone.focus();
}

if ( (theform.MgmtEmail.value.length == 0) && validform ) {
	validform = false;
	window.alert("You must supply a contact email address for your manager.");
	theform.MgmtEmail.focus();
}

return(validform);


} // end function validate_form //

