function IsEmpty( text )
{
    if( text.value.length == 0 ) 
        return( true );
    for( var i=0; i<text.value.length; ++i )  
    {
        var ch = text.value.charAt(i);
        if( ch != ' ' && ch != '\t' ) 
            return( false );
    }
    return( true );
}


function IsEmail( text )
{
    if( text.value.length == 0 ) 
        return( false );
    if( text.value.indexOf("@") == -1 || text.value.indexOf(".") == -1 )
        return( false );
    return( true );
}


function ValidateForm(F)
{
    if ( IsEmpty(F.accountnumber) )
        {
        alert("Please enter your account number.");
        F.accountnumber.focus();
        }
    else 
    if ( IsEmpty(F.firstname) )
        {
        alert("Please enter your first name.");
        F.firstname.focus();
        }
    else 
    if ( IsEmpty(F.lastname) )
        {
        alert("Please enter your last name.");
        F.lastname.focus();
        }
    else 
	if ( IsEmpty(F.email) || !IsEmail(F.email) )
        {
        alert("Please enter a valid e-mail address.");
        F.email.focus();
        }
    else     
	if ( IsEmpty(F.phone) )
        {
        alert("Please enter your phone number.");
        F.phone.focus();
        }
    else 
    if ( IsEmpty(F.password) )
        {
        alert("Please enter your desired password.");
        F.password.focus();
        }
    else 
	
    return( true );
    
    return( false );
}
