// JavaScript Document

// check second form values
function checkForm()
{
//	alert ("no");
//	return false;
	
	// instantiate object
	fv = new formValidator();
	
	// perform checks
	// check for empty name field
	if (fv.isEmpty(document.form.name.value))
	{
		fv.raiseError("Please enter the Client name");
	}
	if (document.form.contact )
		{
	// check for empty title field
	if (fv.isEmpty(document.form.contact.value))
	{
		fv.raiseError("Please enter a contact name");
	}
		}
	if (document.form.company )
		{	
	// check for empty org field
	if (fv.isEmpty(document.form.company.value))
	{
		fv.raiseError("Please enter your company or organization");
	}
		}
		// check for tel number
	if (fv.isEmpty(document.form.phone1.value))
	{
		fv.raiseError("Please enter a telephone number");
	}
	
	// check for empty email address
	if (fv.isEmpty(document.form.email.value))
	{
		fv.raiseError("Please enter an email address");
	}
	
	// check for valid email address format
	if (!fv.isEmpty(document.form.email.value) && !fv.isEmailAddress(document.form.email.value))
	{
		fv.raiseError("Please enter a valid email address");
	}
	
//	if (!fv.isEmpty(document.form.postcode.value) && !checkPostCode(document.form.postcode.value)) {
// 		 fv.raiseError("Please enter a valid zip code or postal code");
//  	}

	
	// all done
	
	// if errors, display, else proceed
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	{
	
		return true; 
	}
	
}
