FormVal.prototype.validate = function( errorInfo )
{
	var rval = true;
	
	if( rval )
	{
		var f = document.getElementById('firstName');
		if( !f.value )
		{
			errorInfo.errorTitle = 'First Name is Required';
			errorInfo.message = 'You must enter your first name.';
			errorInfo.label = 'First Name';
			errorInfo.fields[0] = [f.id,'style="width:100px;"'];
			rval = false;
		}
	}
	
	if( rval )
	{
		var f = document.getElementById('lastName');
		if( !f.value )
		{
			errorInfo.errorTitle = 'Last Name is Required';
			errorInfo.message = 'You must enter your last name.';
			errorInfo.label = 'Last Name';
			errorInfo.fields[0] = [f.id,'style="width:200px;"'];
			rval = false;
		}
	}
	
	if( rval )
	{
		var email = document.getElementById('email');
		if( email.value !== '' )
		{
			var i = email.value.indexOf('@');
			if( i != -1 && i > 0 )
			{
				var j = email.value.indexOf('.',i);
				if( j == -1 || j == i + 1 || email.value.length == j + 1 )
				{
					rval = false;
				}
			}
			else
			{
				rval = false;
			}
			
			if( !rval )
			{
				errorInfo.errorTitle = 'Invalid Email Address';
				errorInfo.message = 'The email address entered is invalid. Ensure your address contains the \'@\' character and includes at least one \'.\' after the \'@\' character. If you do not wish to provide this information, please leave this fields blank.';
			}
			
		}
		else
		{
			errorInfo.errorTitle = 'Email is Required';
			errorInfo.message = 'You must enter your email address.';
			rval = false;
		}
		
		if( !rval )
		{
			errorInfo.label = 'Email Address';
			errorInfo.fields[0] = [email.id,'style="width:220px;"'];
		}
	}
	
	if( rval )
	{
		var r1 = document.getElementById('prefEmail');
		var r2 = document.getElementById('prefPhone');
		if( !( r1.checked || r2.checked ) )
		{
			errorInfo.errorTitle = 'Contact Preference Required';
			errorInfo.message = 'In order for us to respond to your inquiry, you must tell us how you prefer to be contacted.';
			errorInfo.label = 'Preferred Contact Method';
			errorInfo.fields[0] = [r1.id,'','val_radios','Email'];
			errorInfo.fields[1] = [r2.id,'','val_radios','Phone'];
			rval = false;
		}
		else if( r2.checked )
		{
			var p = document.getElementById('phone');
			if( p.value === '' )
			{
				errorInfo.errorTitle = 'Phone Number Required for Contact';
				errorInfo.message = 'In order for us to contact you by phone, you must provide us with a phone number to call.';
				errorInfo.label = 'Home Phone';
				errorInfo.fields[0] = [p.id,'style="140px" onkeydown="return forceDigit( event );"'];
				rval = false;
			}
		}
	}
	
	if( rval )
	{
		var p = document.getElementById('phone');
		if( p.value !== '' )
		{
			if( isNaN( p.value ) )
			{
				errorInfo.errorTitle = 'Invalid Phone Number';
				errorInfo.message = 'Please enter your phone number with numerical digits only. Do not include any dashes, brackets, or parentheses.';
				rval = false;
			}
			else if( p.value.length !== 10 )
			{
				errorInfo.errorTitle = 'Invalid Phone Number Length';
				errorInfo.message = 'You must provide us with a ten digit phone number, which includes your three digit area code.';
				rval = false;
			}
			
			if( !rval )
			{
				errorInfo.label = 'Home Phone';
				errorInfo.fields[0] = [p.id,'style="width:140px;" onkeydown="return forceDigit( event );"'];
				rval = false;
			}
		}
	}
	
	if( rval )
	{
		var f = document.getElementById('topic');
		if( !f.selectedIndex )
		{
			errorInfo.errorTitle = 'Topic is Required';
			errorInfo.message = 'You must choose a topic.';
			errorInfo.label = 'Topic';
			errorInfo.fields[0] = [f.id,''];
			rval = false;
		}
	}
	
	if( rval )
	{
		var f = document.getElementById('inquiry');
		if( !f.value )
		{
			errorInfo.errorTitle = 'Inquiry is Required';
			errorInfo.message = 'You must enter an inquiry.';
			errorInfo.label = 'Inquiry';
			errorInfo.fields[0] = [f.id,'style="height:80px;width:300px;"'];
			rval = false;
		}
	}
	
	return rval;
}

reg( forceDigit, 'keydown', document.getElementById('phone') );

var FORM = 'frmSS3';
var c = new ValCntlr( 'c' , FORM );
reg( function(event){ if( !c.subMainForm() ){if(event.preventDefault){event.preventDefault()}else{event.returnValue=false;}} }, 'submit', document.getElementById( FORM ) );