// put this part in a separate file ///////////////////////////////////////////////////////

// define regular expressions & errors

// e-mail
	// start with 1 or more characters
	// then @
	// then 1 or more characters
	// and end with . and 2 or more characters
	reEmail = /^\S+@\S+(\.\S{2,})$/;
	errEmail = "E-mail address appears to be the wrong format";

// password
	// 7 or more characters
	rePassword = /\w{7,}/;
	errPassword = "Password must be 7 or more alphanumeric characters";

// address
	// 1 or more characters (e.g., cannot be blank)
	reAddress = /\w+/;	
	errAddress = "Address cannot be blank";
	
// city
	// 1 or more characters (e.g., cannot be blank)
	reCity = /\w+/;	
	errCity = "City cannot be blank";

// Country
	// any number of characters, but not a "-" (which indicates -none-)
	reCountry = /^[^\-]/;
	errCountry = "You must choose a Country";
	
// Credit card
	// 4 characters, then optional space, then 4, opt space, 4, spc, 4
	reCreditCard = /^\d{4}\s*\d{4}\s*\d{4}(\s*\d{4})$/;
	errCreditCard = "Credit card must consist of 16 digits (spaces optional)";
	
// Generic can't be blank
	// 1 or more characters (e.g., cannot be blank)
	reGenericBlank = /\w+/;	

// Generic integer
	// must be numeric
	// i.e., consist only of numbers, not be blank
	reGenericInteger = /^[1234567890]+$/;

// Generic selection
	// any number of characters, but not a "-" (which indicates -none-)
	reGenericSelection = /^[^\-]/;

// Language (for platform/language dropdowns)
	// any number of characters, but not a "-" (which indicates -none-)
	reLanguage = /^[^\-]/;
	errLanguage = "You must select a language";

// name
	// 1 or more characters (e.g., cannot be blank)
	reName = /\w+/;	
	errName = "Name cannot be blank";
	
// password
	// 7 or more characters
	rePassword = /\w{7,}/;
	errPassword = "Password must be 7 or more alphanumeric characters";

// Phone
	// must be 7 or more numeric characters, dots, dashes, and spaces also okay
	rePhoneNumber = /[1234567890\(\)\-\.\s]{7,}/;
	errPhoneNumber = "Phone numbers must include area codes and can only contain numbers, dashes, dots, spaces, and parentheses.";

// Platform
	// any number of characters, but not a "-" (which indicates -none-)
	rePlatform = /^[^\-]/;
	errPlatform = "You must select a platform";

// State/province
	// must be 2 upper case characters
	reState = /[A-Z]{2}/;
	errState = "You must choose a state";
	
// Zip/postal codes
	// must be 5 numbers
	// followed by optional dash-then-four-numbers
	reZip = /[1234567890]{5}/;	
	errZip = "You must enter a valid ZIP code";	
	
function matchPattern (strText, regExp) {
	if ( regExp.test(strText)==true ) {
		return true;
	} else {
		return false;
	}
}

function validateField (txtField, reTest, objLabel, txtError) {
	if ( !(matchPattern (txtField, reTest)) ) { 
		errMsg += errNum + ". " + txtError + "\n";
		errNum++;
		objLabel.className = "errorHighlight";
	} else {
		objLabel.className = "noError";
	}
}