
function validate_email( i, alerttxt ) {
    apos = i.value.indexOf( "@" );
    dotpos = i.value.lastIndexOf( "." );
    if ( apos < 1 || ( dotpos - apos ) < 2 ) {
        alert( alerttxt );
        return false;
    } else {
        return true;
    }
}

function validate_form( o ) {

    if ( validate_email( o.email, "Please enter a valid e-mail address." ) == false ) {
        o.email.focus();
        o.email.select();
        return false;
    }

    if ( o.first_name.value == null || o.first_name.value == "" ) {
        alert( "Please enter your first name." );
        o.first_name.focus();
        o.first_name.select();
        return false;
    }

    if ( o.location.value == null || o.location.value == "" ) {
        alert( "Please enter your first name." );
        o.location.focus();
        o.location.select();
        return false;
    }

    return true;

}
