function el(id) 
	{
	if (document.getElementById) 
		{			
    	return document.getElementById(id);
		}
	return false;
	}


function test_submit_form()
	{
//	var last=el('host_submit_form').applicant_last_name.value;
//	var first=el('host_submit_form').applicant_first_name.value;
//	var submit_last=el('host_submit_form').submit_last_name.value;
//	var email=el('host_submit_form').submit_email.value;
	// try to match any valid email address (grabbed from web, seems to work)
//	var email_pattern =
//	 /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
//	var name_pattern =
//	 /^[a-zA-Z]+/;
	// match nothing or a file ending in .pdf
	var file_pattern =
	 /(^|\.pdf|\.PDF|\.Pdf)$/;
	// match a file ending in .pdf
	var file_count_pattern =
	 /^.+(\.pdf|\.PDF|\.Pdf)$/;
	// help us count how many files were actually attached
	var file_count = 0;

//	if (!name_pattern.exec(last) && !name_pattern.exec(first))
//		{
//		var msg	= "You must specify both a last name and a first name for the applicant.";
//		alert(msg);
//		return false;
//		}
//	if (!name_pattern.exec(last))
//		{
//		var msg	= "You must specify a last name for the applicant.";
//		alert(msg);
//		return false;
//		}
//	if (!name_pattern.exec(first))
//		{
//		var msg	= "You must specify a first name for the applicant.";
//		alert(msg);
//		return false;
//		}
//	if (!name_pattern.exec(submit_last))
//		{
//		var msg = "You must specify a last name for the submitter.";
//		alert(msg);
//		return false;
//		}
//	if (!email_pattern.exec(email))
//		{
//		var msg = "You must enter a valid email address for the submitter.";
//		alert(msg);
//		return false;
//		}

	var f=el('host_submit_form');

	for (var i = 0; i < f.elements.length; i++)
		{
		var e=f.elements[i];
		// FYI: this is broken as far as I can tell. This always
		// matches type="file". Chad 20070815
		if (e.type == "file")
			{
			var filename=e.value;
			if (!file_pattern.exec(filename))
				{
				var msg	= "Please submit only PDF files.";
				alert(msg);
				return false;
				}
			}
			if (file_count_pattern.exec(filename))
				{
				file_count++;
				}
		}

	if (!file_count)
		{
		var msg = "Please submit at least one file.";
		alert(msg);
		return false;
		}

	return true;
	
	}
