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 addr = document.getElementById('address');
		if( !addr.value )
		{
			errorInfo.errorTitle = 'Address is Required';
			errorInfo.message = 'You must enter your address.';
			errorInfo.label = 'Address Line 1';
			errorInfo.fields[0] = [addr.id,'style="width:200px;"'];
			rval = false;
		}
	}
	
	if( rval )
	{
		var city = document.getElementById('city');
		if( !city.value )
		{
			errorInfo.errorTitle = 'City is Required';
			errorInfo.message = 'You must enter your city.';
			errorInfo.label = 'City';
			errorInfo.fields[0] = [city.id,'style="width:100px;"'];
			rval = false;
		}
	}
	
	if( rval )
	{
		var state = document.getElementById('state');
		if( !state.selectedIndex )
		{
			errorInfo.errorTitle = 'State is Required';
			errorInfo.message = 'You must choose your state.';
			errorInfo.label = 'State';
			errorInfo.fields[0] = [state.id,''];
			rval = false;
		}
	}

	if( rval )
	{
		var zip = document.getElementById('zipCode');
		if( !zip.value )
		{
			errorInfo.errorTitle = 'ZIP Code is Required';
			errorInfo.message = 'You must enter your ZIP code.';
			rval = false;
		}
		else if( zip.value.length < 5 )
		{
			errorInfo.errorTitle = 'Short ZIP Code';
			errorInfo.message = 'The ZIP code entered is too short to be valid. Please ensure that the ZIP code you entered is 5 digits in length.';
			rval = false;
		}
		else if( zip.value.length > 5 )
		{
			errorInfo.errorTitle = 'Long ZIP Code';
			errorInfo.message = 'The ZIP code entered is too long to be valid. Please ensure that the ZIP code you entered is 5 digits in length.';
			rval = false;
		}
		else if( isNaN(zip.value) )
		{
			errorInfo.errorTitle = 'Invalid ZIP Code';
			errorInfo.message = 'The ZIP code entered includes non-numeric characters. Please ensure that your ZIP code includes only numbers.';
			rval = false;
		}
		
		if( !rval )
		{
			errorInfo.label = 'ZIP/Postal Code';
			errorInfo.fields[0] = [zip.id,'style="width:50px;"  onkeydown="return forceDigit( event );"'];
		}
	}
	
	if( rval )
	{
		var c1 = document.getElementById('areaAll');
		var c2 = document.getElementById('areaReservations');
		var c3 = document.getElementById('areaSpa');
		var c4 = document.getElementById('areaDining');
		var c5 = document.getElementById('areaFamily');
		var c6 = document.getElementById('areaOutdoor');
		var c7 = document.getElementById('areaRecreational');
		var c8 = document.getElementById('areaSpecial');
		var c9 = document.getElementById('areaCorporate');
		if( !( c1.checked || c2.checked || c3.checked || c4.checked || c5.checked || c6.checked || c7.checked || c8.checked || c9.checked ) )
		{
			errorInfo.errorTitle = 'Area(s) of Interest Required';
			errorInfo.message = 'Please select your areas of interest for which you would like to receive the occasional email from Buckberry Lodge.';
			errorInfo.label = 'Area(s) of Interest';
			errorInfo.fields[0] = [c1.id,'','val_checks','All'];
			errorInfo.fields[1] = [c2.id,'','val_checks','Reservations'];
			errorInfo.fields[2] = [c3.id,'','val_checks','Spa Treatments'];
			errorInfo.fields[3] = [c4.id,'','val_checks','Dining'];
			errorInfo.fields[4] = [c5.id,'','val_checks','Family Activities'];
			errorInfo.fields[5] = [c6.id,'','val_checks','Outdoor Adventures'];
			errorInfo.fields[6] = [c7.id,'','val_checks','Recreational Sports'];
			errorInfo.fields[7] = [c8.id,'','val_checks','Special Events'];
			errorInfo.fields[8] = [c9.id,'','val_checks','Corporate Group Information'];
			rval = false;
		}
	}
	
	return rval;
}

reg( forceDigit, 'keydown', document.getElementById('zipCode') );

var FORM = 'frmSS2';
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 ) );