function IsValidMail( str )
	{
		var	found = 0,
				nm = 0,
				ps = 0;

		for ( var i = 0; i < str.length - 1; i++ )	{
			if ( str.charAt( i ) == "@" )	{
				found++;
				ps = i;
				break;
 			}
 			if ( str.charAt( i ) == " " && nm )
 				return ( false );
	 		if ( !found && str.charAt( i ) != " " )
 				nm++;
		}
		if ( ( !nm ) || ( !found ) )
			return ( false );
		nm = 0;
		found = 0;
		for ( var i = ++ps; i < str.length - 1; i++ )	{
			if ( str.charAt( i ) == " " )
				return ( false );
			if ( str.charAt( i ) == "@" )
				return ( false );
			if ( str.charAt( i ) == "." )	{
				found++;
				break;
 			}
			nm++;
		}
		if ( nm && found )
			return ( true );
		return ( false );
	}
function ValidateInput(form)
	{

		if  ( ( form.NAME.value == "" ) ||
			  ( form.COMMENT.value == "" ) ||
			  ( form.EMAIL2.value == "" ) ||
			  ( form.EMAIL.value == "" ) )	{
			alert( "Please fill out all the obligatory fields (marked with an asterisk)" );
			return( false );
		}
		if (form.EMAIL.value != form.EMAIL2.value)
		{
			alert( "The 2 emails do not match" );
			return( false );
		}
		if ( !IsValidMail( form.EMAIL.value ) )	{
			alert( "The email address does not seem to be valid" );
			return( false );
		}
		return ( true );
	}
