function checkFirstName(textElement) {
	if (checkForAlphaWithSpaces(textElement.value) == 2) {
		alert("You must enter a first name.");
		textElement.focus();
		return false;
	} else if (checkForAlphaWithSpaces(textElement.value) == 0) {
		alert("First name must contain a alphabets and spaces only.");
		textElement.focus();
		return false;
	}
	return true;
}

function checkPassword(textElement) {
	var ch = "";
	var flag = 1;
	str = trim(textElement.value);
	if (str.length < 4) 
	{
		alert("Please enter a password that is at least 4 characters.");
		textElement.focus();
		return false;
	} else {
		return true;
	}
}

function checkLastName(textElement) {
	if (checkForAlphaWithSpaces(textElement.value) == 2) {
		alert("You must enter a last name.");
		textElement.focus();
		return false;
	} else if (checkForAlphaWithSpaces(textElement.value) == 0) {
		alert("Last name must contain a alphabets and spaces only.");
		textElement.focus();
		return false;
	}
	return true;
}

function checkAddress1(textElement) {
	if (checkForAddress(textElement.value) == 2) {
		alert("You must enter an address.");
		textElement.focus();
		return false;
	} else if (checkForAddress(textElement.value) == 0) {
		alert("You must enter a valid address.");
		textElement.focus();
		return false;
	}
	return true;
}
 
function checkPhoneNumber(textElement,expectedlength) {
	textElement.value=textElement.value.replace(/-/g,'');
	textElement.value=textElement.value.replace(/ /g,'');
	textElement.value=textElement.value.replace(/\(/g,'');
	textElement.value=textElement.value.replace(/\)/g,'');
	if (checkForPhone(textElement.value,expectedlength) == 0) {
		alert("You must enter a phone number.");
		textElement.focus();
		return false;
	} else if (checkForPhone(textElement.value,expectedlength) == 2) {
		window.alert("You must enter a valid phone number.");
		textElement.focus();
		return false;
	}
	return true;
}
function checkFaxNumber(textElement,expectedlength) {
	textElement.value=textElement.value.replace(/-/g,'');
	textElement.value=textElement.value.replace(/ /g,'');
	textElement.value=textElement.value.replace(/\(/g,'');
	textElement.value=textElement.value.replace(/\)/g,'');
	if (checkForPhone(textElement.value,expectedlength) == 0) {
		alert("You have selected to have your sales receipt sent via fax.  Please fill in a vaild fax number.");
		textElement.focus();
		return false;
	} else if (checkForPhone(textElement.value,expectedlength) == 2) {
		window.alert("You have selected to have your sales receipt sent via fax.  Please fill in a vaild fax number.");
		textElement.focus();
		return false;
	}
	return true;
}

function checkCity(textElement) {
	if (checkForAlphaWithSpaces(textElement.value) == 2) {
		alert("You must enter a city.");
		textElement.focus();
		return false;
	} else if (checkForCity(textElement.value) == 0) {
		window.alert("City must contain letters and spaces only.");
		textElement.focus();
		return false;
	}
	return true;
}

function checkEmail(textElement) {
	if (checkForEmail(textElement.value) == 2) {
		alert("You must enter an e-mail address.");
		textElement.focus();
		return false;
	} else if (checkForEmail(textElement.value) == 0) {
		window.alert("You must enter a valid e-mail address.");
		textElement.focus();
		return false;
	}
}
function checkState2(textElement) {
	if (checkForAlphaWithSpaces(textElement.value) == 2) {
		alert("You must enter a state.");
		document.forms.thisForm.state.focus();
		return false;
	}
}

function checkState(textElement) {
//	if (checkForAlphaWithSpaces(textElement.value) == 2) {
//		alert("You must enter a state.");
//		textElement.focus();
//		return false;
//	} else if (checkForAlphaWithSpaces(textElement.value) == 0) {
//		alert("State must contain letters and spaces only.");
//		textElement.focus();
//		return false;
//	}	
    if (textElement=="0") {
		alert("You must enter a state.");
		document.forms.thisForm.state.focus();
		return false;
	}
}

function checkZip(textElement) {
	textElement.value=textElement.value.replace(/-/g,'');
	textElement.value=textElement.value.replace(/ /g,'');
	if (checkForZip(textElement.value) == 2) {
		alert("You must enter a zip code.");
		textElement.focus();
		return false;
	} else if (checkForZip(textElement.value) == 0) {
		alert("Zip must contain numbers only.");
		textElement.focus();
		return false;
	}
}

function checkZipCountry(textElement,country) {
	textElement.value=textElement.value.replace(/-/g,'');
	textElement.value=textElement.value.replace(/ /g,'');
	if (checkForZipCountry(textElement.value,country) == 2) {
		alert("Your zip code and country selection do not match. Please re-enter or call us at 1-800-548-7231.");
		textElement.focus();
		return false;
	} else if (checkForZipCountry(textElement.value,country) == 0) {
		alert("Zip must contain numbers only.");
		textElement.focus();
		return false;
	} else if (checkForZipCountry(textElement.value,country) == 4) {
		alert("Canadian Postal Codes must begin with a Letter.");
		textElement.focus();
		return false;
	}	
}

function checkCountry(textElement) {
	if (checkForAlphaWithSpaces(textElement.value) == 2) {
		alert("You must enter a country.");
		textElement.focus();
		return false;
	} else if (checkForAlphaWithSpaces(textElement.value) == 0) {
		alert("Country must contain letters and spaces only.");
		textElement.focus();
		return false;
	}
}


