// Function to validate all the inputs
	function Validate(  )
	{
		var MatriForm = this.document.form1;

		
		if ( MatriForm.txtemail.value == "" )
		{
			alert( "Please enter a valid E-mail ID" );
			MatriForm.txtemail.focus( );
			return false;
		}
		else
		{
			if ( !ValidateEmail( MatriForm.txtemail.value ) )
			{
				alert( "Invalid E-mail " + MatriForm.txtemail.value );
				MatriForm.txtemail.focus( );
				return false;
			}
			for ( var Idx = 0; Idx < MatriForm.txtemail.value.length; Idx++ )
			{
				if ( MatriForm.txtemail.value.charAt(Idx) == '	'
					|| MatriForm.txtemail.value.charAt(Idx) == ' '
					|| MatriForm.txtemail.value.charAt(Idx) == ','
					|| MatriForm.txtemail.value.charAt(Idx) == '/'
					|| MatriForm.txtemail.value.charAt(Idx) == '\\'
					|| MatriForm.txtemail.value.charAt(Idx) == ';' )
				{
					alert( "Blanks or other invalid characters are not allowed in the E-mail ID.\nPlease enter only one E-mail ID." );
					MatriForm.txtemail.focus( );
					return false;
				}
			}
		}
		if ( MatriForm.txtcomm.value == "" )
		{
			alert( "Please enter the Middle Name." );
			MatriForm.txtcomm.focus( );
			return false;
		}
		
		return true;
		
	}

	function ValidateEmail( Email )
	{
		var atCharPresent = false;
		var dotPresent = false;

		for ( var Idx = 0; Idx < Email.length; Idx++ )
		{
			if ( Email.charAt ( Idx ) == '@' )
				atCharPresent = true;
			if ( Email.charAt ( Idx ) == '.' )
				dotPresent = true;
		}

		if ( !atCharPresent || !dotPresent )
			return false;

		return true;
	}	
