//==========================================================================
// validateForm(): Validates the required elements in the form submitted  
//		have all been filled in.  
//
//		Input: none
//		Output: boolean (if false, an alert as well)
//==========================================================================
function validateForm(){

			if ( !validateText(document.contact.curun,'Current Username') ){
				return false;
			}
			else if ( !validateText(document.contact.curpwd,'Current Password') ){
				return false;
			}

			
			if ( !isEmpty(document.contact.un.value) ){
				if ( !validateTextLength(document.contact.un,'Username',2) ) {
					return false;
				}
			}	
			if ( !isEmpty(document.contact.pwd.value) ){
				if ( !validateTextLength(document.contact.pwd,'Password',4) ) {
					return false;
				}
			}	
			
			if ( !isEmpty(document.contact.email.value) ){
				if ( !validateEmail(document.contact.email) ){
					return false;
				}
			}
	
	return true;
}


//==========================================================================
// validatePhone(): Validates the phone number element in the form.
//==========================================================================
function validatePhone(objElement) {
	var strString = objElement.value;
	var strFilter  = /^([0-9])+([0-9])+([0-9])+\-([0-9])+([0-9])+([0-9])+\-([0-9])+([0-9])+([0-9])+([0-9])+$/;
	
	if ( strFilter.test(strString) ) {
		return true;
	}
	else {
		notifyInvalid(objElement,'You have entered an invalid phone number.\nPlease use the form ###-###-####');
		return false;
	}
}


//==========================================================================
// submitForm(): Validate the form and submits it if valid.
//==========================================================================
function submitForm() {
		
	if ( validateForm() ) {
		document.contact.submit();
		//return true;
	}
	else { return false; }
}


