function validate_submition_form_public(f) {
	
	if (f.Contact_FullName.value.length == 0){
		alert('Please enter your name to continue.');
		f.Contact_FullName.focus();
		return false;
	}
	if (f.Contact_WorkPhone.value<10 || !isNumeric(f.Contact_WorkPhone.value)) {
		alert('Please enter your work phone to continue.');
		f.Contact_WorkPhone.focus();
		return false;
	}
	if (!IsValidEmail(f.Contact_Email.value)) {
		alert('Please enter a valid email address to continue.');
		f.Contact_Email.focus();
		return false;
	}
	if (!document.getElementById('Pay_With_CC').checked && !document.getElementById('Pay_With_Invoice').checked) {
		alert('Please select a payment method.');
		f.Pay_With_CC.focus();
		return false;
	}
	if (document.getElementById('Behalf_of_Company_Yes').checked) {
		
		if (f.company_rep_name.value.length == 0){
			alert('Please enter a company name to continue.');
			f.company_rep_name.focus();
			return false;
		}
		
	}
	if (f.submission_title.value.length == 0){
		alert('Please enter a title to continue.');
		f.submission_title.focus();
		return false;
	}
	if (f.submission_dateline.value.length == 0){
		alert('Please enter a dateline to continue.');
		f.submission_dateline.focus();
		return false;
	}
	if (f.submission_tagline.value.length == 0){
		alert('Please enter a tagline to continue.');
		f.submission_tagline.focus();
		return false;
	}
	if (f.submission_body.value.length == 0){
		alert('Please enter body text to continue.');
		f.submission_body.focus();
		return false;
	}
	if (!document.getElementById('terms_agreement_yes').checked) {
		alert('You must agree to the Submission Terms and Conditions before submitting.');
		return false;
	}
	
	/*
	$('input:text').each(function(i){
		var max_length = parseInt($(this).attr('maxlength'));
		var current_length = this.length;
		if (current_length > max_length) {
			alert('The '+this.name+' field exceeds the maximum value of
		}
	});
	*/
	return true;
}

function validate_submition_form_nonpublic(f) {
	
	if (f.Contact_FullName.value.length == 0){
		alert('Please enter your name to continue.');
		f.Contact_FullName.focus();
		return false;
	}
	if (f.Contact_WorkPhone.value<10 || !isNumeric(f.Contact_WorkPhone.value)) {
		alert('Please enter your work phone to continue.');
		f.Contact_WorkPhone.focus();
		return false;
	}
	if (!IsValidEmail(f.Contact_Email.value)) {
		alert('Please enter a valid email address to continue.');
		f.Contact_Email.focus();
		return false;
	}
	if (!document.getElementById('Pay_With_CC').checked && !document.getElementById('Pay_With_Invoice').checked) {
		alert('Please select a payment method.');
		f.Pay_With_CC.focus();
		return false;
	}
	if (document.getElementById('Behalf_of_Company_Yes').checked) {
		
		if (f.company_rep_name.value.length == 0){
			alert('Please enter a company name to continue.');
			f.company_rep_name.focus();
			return false;
		}
		
	}
	if (f.submission_title.value.length == 0){
		alert('Please enter a title to continue.');
		f.submission_title.focus();
		return false;
	}
	if (f.submission_dateline.value.length == 0){
		alert('Please enter a dateline to continue.');
		f.submission_dateline.focus();
		return false;
	}
	if (f.submission_tagline.value.length == 0){
		alert('Please enter a tagline to continue.');
		f.submission_tagline.focus();
		return false;
	}
	if (f.submission_body.value.length == 0){
		alert('Please enter body text to continue.');
		f.submission_body.focus();
		return false;
	}
	if (!document.getElementById('terms_agreement_yes').checked) {
		alert('You must agree to the Submission Terms and Conditions before submitting.');
		return false;
	}
	
	/*
	$('input:text').each(function(i){
		var max_length = parseInt($(this).attr('maxlength'));
		var current_length = this.length;
		if (current_length > max_length) {
			alert('The '+this.name+' field exceeds the maximum value of
		}
	});
	*/
	return true;
}

function isNumeric(val) {
	var ValidChars = "0123456789.-()";
	for (i=0; i<val.length; i++) if (ValidChars.indexOf(val.charAt(i)) == -1) return false;
	return true;
}

function IsValidEmail(val) {
	var iLen = val.length;
	if 	((iLen < 6) || (val.indexOf('@') < 1) || ((val.charAt(iLen - 3) != '.') && (val.charAt(iLen - 4) != '.') && (val.charAt(iLen - 5) != '.')) ) return false;
	return true;
}