	function validate_form(form)
	{
		var errorList = new Array();
		var errorIndex = 0;
		if (isEmpty('firstName'))                             { errorList[errorIndex] = 'First Name missing'; errorIndex++; }
		if (isEmpty('lastName'))                              { errorList[errorIndex] = 'Last Name missing'; errorIndex++; }
		if (isEmpty('organization'))                          { errorList[errorIndex] = 'Organization missing'; errorIndex++; }
		if (isEmpty('email'))                                 { errorList[errorIndex] = 'Email missing'; errorIndex++; } else {
		if (!validateEmail(document.getElementById('email'))) { errorList[errorIndex] = 'Email invalid'; errorIndex++; }}
		if (isEmpty('phone'))                                 { errorList[errorIndex] = 'Phone Number missing'; errorIndex++; }
		if (isEmpty('address'))                               { errorList[errorIndex] = 'Address missing'; errorIndex++; }
		if (isEmpty('city'))                                  { errorList[errorIndex] = 'City missing'; errorIndex++; }
		if (!isSelectionMade('state'))                        { errorList[errorIndex] = 'State missing'; errorIndex++; }
		if (isEmpty('zip'))                                   { errorList[errorIndex] = 'Zip code missing'; errorIndex++; }
		if (isEmpty('country'))                               { errorList[errorIndex] = 'Country missing'; errorIndex++; }
		if (!isSelectionMade('schoolSize'))                   { errorList[errorIndex] = 'School size missing'; errorIndex++; }
		if (!isSelectionMade('purchaseProjection'))           { errorList[errorIndex] = 'Purchase Projection missing'; errorIndex++; }
		if (isEmpty('trialStartDate'))                        { errorList[errorIndex] = 'Trial start date missing'; errorIndex++; }
		if (!document.getElementById('termsAgreed').checked)  { errorList[errorIndex] = 'You must agree to the trial terms'; errorIndex++; }
		
		if (errorList.length > 0)
		{
			var errorString = '';
			var i = 0;
			while (i < errorList.length)
			{
				errorString += '<li>' + errorList[i];
				i++;
			}
			document.getElementById('errors').innerHTML = errorString;
			return false;
		}
		else
		{
			return true;
		}
	}
	
	function isEmpty(fieldName)
	{
		return (document.getElementById(fieldName).value == '');
	}
	
	function isSelectionMade(fieldName)
	{
		var box = document.getElementById(fieldName);
		return (box.options[box.selectedIndex].value != -1);
	}
	
	function validateEmail(field)
	{
		if (field.value == '')
		{
		  return false;
		}
		else
		{
		
			apos = field.value.indexOf("@");
			dotpos = field.value.lastIndexOf(".");
			if (apos<1 || (dotpos-apos)<2) 
			{
				return false;
			}
			else 
			{
				return true;
			}
		}
	}

	function fmtDate(field)
	{
		if (field && field.value)
		{
			var d = parseDate(field.value);

			if (d == null)
			{
				field.style.backgroundColor = '#FF0000';
				field.value = "";
				field.focus();
			}
			else
			{
				field.value = formatDate(d,'MM/dd/yyyy');
				field.style.backgroundColor = '#FFFFFF';
			}
		}
		else
		{
			field.style.backgroundColor = '#FFFFFF';
		}
	}

	function clearError (fieldName)
	{
		var field = document.getElementById(fieldName);
		field.value = '';
		field.style.backgroundColor = '#FFFFFF';
	}
	