function validate() {
	
	theform = document.login;
	
	
	theform.username.required = true;
	theform.username.requiredError = 'The Username field must be filled in.';
	
	theform.password.required = true;
	theform.password.requiredError = 'The Password field must be filled in.';
	

//Here is where we call the getFormErrors function in the form_validation.js script to create the array

	var errors = getFormErrors(theform);
	if (errors.length > 0) {
		var errorMessage = 'The form was not submitted due to the following problem' + ((errors.length > 1) ? 's' : '') + ':\n\n';
		for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
			errorMessage += '* ' + errors[errorIndex] + '\n';
		}
		errorMessage += '\nPlease fix ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and resubmit the form.';
		alert(errorMessage);
		return false;
	}
	

	/* submit the form once all validation is complete */
	theform.submit();
}