<!-- begin comment
// Check Form
function checkForm(thisform) {
	if (validText(thisform.Company.value) != true) {
		alert ("Please enter your COMPANY name correctly.");
		thisform.Company.focus(); thisform.Company.select(); return false;
	}
	if (validText(thisform.Name.value) != true) {
		alert ("Please enter your NAME correctly (do not use special characters).");
		thisform.Name.focus(); thisform.Name.select(); return false;
	}
	if (thisform.Address.value == null || thisform.Address.value == "") {
		alert ("Please enter your ADDRESS (do not use special characters and/or punctuation).");
		thisform.Address.focus(); thisform.Address.select(); return false;
	}
	if (validText(thisform.City.value) != true) {
		alert ("Please enter your CITY correctly (do not use special characters).");
		thisform.City.focus(); thisform.City.select(); return false;
	}
	if (validZip(thisform.Zip.value) != true) {
		alert ("Please enter your ZIP code.");
		thisform.Zip.focus(); thisform.Zip.select(); return false;
	}
	if (validText(thisform.Country.value) != true) {
		alert ("Please enter your COUNTRY correctly (do not use special characters).");
		thisform.Country.focus(); thisform.Country.select(); return false;
	}
	if (validPhone(thisform.Phone.value) != true) {
		alert ("Please enter your PHONE number correctly. (only digits, no spaces/dashes)");
		thisform.Phone.focus(); thisform.Phone.select(); return false;
	}
	if (validEmail(thisform.Email.value) != true) {
		alert ("Please enter your EMAIL address correctly.");
		thisform.Email.focus(); thisform.Email.select(); return false;
	}
	return true;
}


// Functions *******************************************************************
function validText(text) {
	invalidChars = "1234567890~!@#$%^&*()_`-=[]\{}|;':,./<>?";
	// at least 2 characters
	if (text.length < 2) {
		return false;
	}
	// does it contain any invalid characters?
	for (i = 0; i < invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (text.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	return true;
}

function validAddress(text) {
	invalidChars = "~!@$%^&*()_`=[]\{}|;':,.<>?";
	// at least 2 characters
	if (text.length < 3) {
		return false;
	}
	// does it contain any invalid characters?
	for (i = 0; i < invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (text.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	return true;
}

function validZip(text) {
	validChars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	// at least 4 digits
	if (text.length < 2) {
		return false;
	}
	// does it contain only valid characters?
	for (i = 0; i < number.length; i++) {
		checkDigit = number.charAt(i);
		if (validChars.indexOf(checkDigit,0) == -1) {
			return false;
		}
	}
	return true;
}

function validPhone(phone) {
	validChars = "+1234567890";
	// can't be less then 10 digits
	if (phone.length < 10) {
		return false;
	}
	// does it contain only valid characters?
	for (i = 0; i < phone.length; i++) {
		phoneChar = phone.charAt(i);
		if (validChars.indexOf(phoneChar,0) == -1) {
			return false;
		}
	}
	return true;
}

function validEmail(email) {
	invalidChars = "~!#$%^&*()`=[]\{}|;':,<>?";
	// cannot be empty
	if (email == "") {
		return false;
	}
	// does it contain any invalid characters?
	for (i = 0; i < invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	// there must be one "@" symbol
	atPos = email.indexOf("@",1);
	if (atPos == -1) {
		return false;
	}
	// and only one "@" symbol
	if (email.indexOf("@",atPos+1) != -1) {
		return false;
	}
	// and at least one "." after the "@"
	periodPos = email.indexOf(".",atPos);
	if (periodPos == -1) {
		return false;
	}
	// must be at least 2 characters after the "."
	if (periodPos+3 > email.length)	{
		return false;
	}
	return true;
}
// end comment -->
