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


function test_submit_form()
	{
	var last=el('host_submit_form').last_name.value;
	var first=el('host_submit_form').first_initial.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(last) && !name_pattern(first))
		{
		var msg	= "You must specify both a last name and a first initial.";
		alert(msg);
		return false;
		}
	if (!name_pattern(last))
		{
		var msg	= "You must specify a last name.";
		alert(msg);
		return false;
		}
	if (!name_pattern(first))
		{
		var msg	= "You must specify a first initial.";
		alert(msg);
		return false;
		}
	if (!email_pattern(email))
		{
		var msg = "You must enter a valid email address.";
		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 20070816
		if (e.type == "file")
			{
			var filename=e.value;
			if (!file_pattern(filename))
				{
				var msg	= "Please submit only PDF files.";
				alert(msg);
				return false;
				}
			}
			if (file_count_pattern(filename))
				{
				file_count++;
				}		
		}

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

	return true;
	
	}
