function checkBefore( s ) {
	if ( true == confirm( s ) )
	{
		return true;
	}
	else
	{
		return false;
	}
}

function clickBefore( arrayOfString )
{
	for ( var i=0; i < (arrayOfString.length-1); i++ )
	{
		var theform = arrayOfString[i];
		alert(theform.toString());
		i++;
		var thesubmit = arrayOfString[i];
		alert(thesubmit.toString());
	}
	return true;
}

function isblank( s )
{
	for ( var i=0; i<s.length; i++ )
	{
		var c = s.charAt(i);
		if ( (c != ' ') && (c != '\n') && (c != '') )
			return false;
	}
	return true;
}

function checkFormElements( f )
{
	var msg;
	var empty_fields = "";
	var errors = "";

	for ( var i=0; i < f.length; i++ )
	{
		var e = f.elements[i];
		if ( ( ("text" == e.type) || ("textarea" == e.type) || ("password" == e.type) ) && !e.optional )
		{
			if ( (null == e.value) || ("" == e.value) || isblank(e.value) )
			{
				empty_fields += "\n	" + e.name;
				continue;
			}

			if (e.numeric || (null != e.min) || (null != e.max) )
			{
				var v = parseFloat(e.value);
				if ( isNaN(v) ||
					( (null != e.min) && (v < e.min) ) ||
					( (null != e.max) && (v > e.max) ) )
				{
					errors += "- The field " + e.name + " must be a number";
					if (null != e.min)
						errors += " that is greater than " + e.min;
					if (null != e.max && null != e.min)
						errors += " and less than " + e.max;
					else if (null != e.max)
						errors += " that is less than " + e.max;
					errors += ".\n";
				}
			}
		}
	} // for

	if (!empty_fields && !errors) 
		return true;
	
	msg =   "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~\n\n";
	msg += "French For Business\n";
	msg += "The form was not submitted because of the following error(s).\n";
	msg += "Please correct these error(s) and re-submit.\n"; 
	msg +=  "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~\n\n";

	if (empty_fields)
	{
		msg += "- The following required field(s) are empty: " + empty_fields + "\n";
		if (errors) msg += "\n";
	}

	msg += errors;
	
	alert(msg);

	return false;	
}
