function validateRegsitrationForm() {
	var form = getE("theForm")
	// clear any existing error messages
	getE('feedBackArea').innerHTML = '';
	if (form) {
		if (!form.email.value.match(/\S/)) {
			addValidationErrorMessage('Email can not be blank.')
		} else {
			if (form.email.value != form.confirmEmail.value) {
				addValidationErrorMessage('Email addresses do not match.')
			}
		}
		if (!form.passwd.value.match(/\S/)) {
			addValidationErrorMessage('Password can not be blank.')
		} else if (form.passwd.value.length < 4) {
			addValidationErrorMessage('Passwords must be at least 4 characters.')

		} else if (form.passwd.value != form.confirmPasswd.value) {
			addValidationErrorMessage('Passwords do not match.')
		}

		if (!form.fname.value.match(/\S/)) {
			addValidationErrorMessage('First name can not be blank.')
		}
		if (!form.lname.value.match(/\S/)) {
			addValidationErrorMessage('Last name can not be blank.')
		}
		if (!form.address.value.match(/\S/)) {
			addValidationErrorMessage('Address 1 can not be blank.')
		}
		if (!form.city.value.match(/\S/)) {
			addValidationErrorMessage('City can not be blank.')
		}
		if (!form.state.value.match(/\S/)) {
			addValidationErrorMessage('Please select a state.')
		}
		if (!form.zip.value.match(/\S/)) {
			addValidationErrorMessage('Zip code can not be blank.')
		}
		if (!form.tenDigitNumber.value.match(/\S/)) {
			addValidationErrorMessage('You must either provide a valid 10 Digit number or get a new one.')
		}
		if (!form.agreed_to_terms.checked) {
			addValidationErrorMessage('You must click the check box indicating that you agree to the terms of use.')
		}
		if (getE('feedBackArea').innerHTML.length > 0) {
			window.location.href = "#errorsDisplay";
		} else {
			//submit the form
			form.submit();
		}
	} else {
	}
}
function addValidationErrorMessage(str) {
	getE('feedBackArea').innerHTML += "<p>" + str + "</p>";
}

function popLink(url) {
	var v = window
			.open(
					url,
					'vlogLink',
					'width=600,height=200,status=1,scrollbars=1,menubar=0,resizable=1,directories=0,toolbar=0,location=0');
	v.focus();
}

function autoTab(element, nextElement) {
	if (element.value.length == element.maxLength && nextElement != null)
		element.form.elements[nextElement].focus();
}

function getE(str) {
	return document.getElementById(str) ? document.getElementById(str) : false;
}

function checkPasswordLength() {
	var passWord = document.getElementById('passwordInput').value
	var feedBack = document.getElementById('passwordMesssage')
	if (passWord.length < 4) {
		feedBack.innerHTML = 'Password is too short.'
		feedBack.style.color = "#FF0000";
	} else if (passWord.length == 8) {
		feedBack.innerHTML = 'Password has reached max length.'
		feedBack.style.color = "#0052D2"; 
	} else {
		feedBack.innerHTML = 'Password OK.'
		feedBack.style.color = "#00FF00";
	}
}
