function verifyForm( theForm )
{
	var retFlag = 1;
	// Get all the labels into an array
	var labels = document.getElementsByTagName('label');
	for (var i = 0; i < labels.length; i++) 
	{
		// the htmlFor should be the same as the id of its related form element
		if (labels[i].htmlFor != '') 
		{
			// Split it to see if it follows the pattern req_X_YYYY 
			// if idArray[0] = 'req' tells us it's required.  
			// X (idArray[1]) tells us how to check form element value: D - date, N - numerical, P - phone, E - email, T - Text, 
			// S - Select box
			
			var idName = labels[i].htmlFor;
			var idArray = idName.split('_');
			
			if( idArray[0] == 'req' )
			{	
			
				// Get the text that describes the form element - like First Name
				theText = labels[i].innerHTML;
				// If it's required, there's an * after it. We don't want to display that in the list of elements they haven't 
				// filled out
				var textArray = theText.split('*');
				theText = textArray[0];

				if( idArray[1] == 'S' )
				{
					if ( getObjectFormat( idName ).selectedIndex == 0 )
					{
						addError( 'you must make a selection from ' + theText );
					}
					
				}
				else if( idArray[1] == 'T' )
				{
					if( getObjectFormat( idName ).value.trim( ) == '' )
						addError( 'you must provide the ' + theText );
				}
				else if ( idArray[1] == 'D' )
				{
					validateDate( idName, theText );
				}
				else if ( idArray[1] == 'N' )
				{
					validateNumeric( idName, theText, 'int' );
				}
				else if ( idArray[1] == 'P' )
				{
					validatePhone( idName, theText, false );
				}
				else if ( idArray[1] == 'E' )
				{
					validateEmail( idName, theText );
				}
			}
		}
	}
	
	if( parseErrors( ) )
	{
		getObjectFormat(theForm).submit();
	}
}

function verifyAjaxForm( )
{
	var retFlag = 1;
	// Get all the labels into an array
	var labels = document.getElementsByTagName('label');
	for (var i = 0; i < labels.length; i++) 
	{
		// the htmlFor should be the same as the id of its related form element
		if (labels[i].htmlFor != '') 
		{
			// Split it to see if it follows the pattern req_X_YYYY 
			// if idArray[0] = 'req' tells us it's required.  
			// X (idArray[1]) tells us how to check form element value: D - date, N - numerical, P - phone, E - email, T - Text, 
			// S - Select box, Z - Zip, C - Credit Card
			
			var idName = labels[i].htmlFor;
			var idArray = idName.split('_');
			
			if( idArray[0] == 'req' )
			{	
		
				// Get the text that describes the form element - like First Name
				theText = labels[i].innerHTML;
				// If it's required, there's an * after it. We don't want to display that in the list of elements they haven't 
				// filled out
				var textArray = theText.split('<');
				theText = textArray[0];
	
				if( idArray[1] == 'S' )
				{
					if ( getObjectFormat( idName ).selectedIndex == 0 )
					{
						addError( 'you must make a selection from ' + theText );
					}
					
				}
				else if( idArray[1] == 'T' )
				{
					if( getObjectFormat( idName ).value.trim( ) == '' )
						addError( 'you must provide the ' + theText );
				}
				else if ( idArray[1] == 'D' )
				{
					validateDate( idName, theText );
				}
				else if ( idArray[1] == 'N' )
				{
					validateNumeric( idName, theText, 'int' );
				}
				else if ( idArray[1] == 'P' )
				{
					validatePhone( idName, theText, false );
				}
				else if ( idArray[1] == 'E' )
				{
					validateEmail( idName, theText );
				}
				else if ( idArray[1] == 'C' )
				{
					validateCreditCardNumber( idName );
				}
				else if ( idArray[1] == 'Z' )
				{
					validateZip( idName, theText );
				}
			}
		}
	}
	
	if( parseErrors( ) )
	{
		submitInquiry( );
	}
}


