function formverify () {
    var valid = false;
    if(checkallfields()) {
       if(checkaccountid()) {
           valid=true;
       }
    }
    return valid;
}


function checkallfields() {
    // return true if all fields are non-blank
    var valid = false;

    // only need to have an account id
    if( document.frmNewAccount.account_id.value == "" ) {
        valid = false;
    } 
    else {
        valid = true;
    }   

    if( !valid ) {
        alert("please enter a desired account id");
    }
    return valid;
}

// http://www.javascriptkit.com/script/script2/acheck.shtml
function checkemail() {
    var valid = false;
    var str=document.frmNewAccount.email_address.value
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(str))
        valid = true;
    else{
        alert("the email address entered does not look to be valid")
    }
    return valid;
}

function checkaccountid() {
    var valid = false;
    var str=document.frmNewAccount.account_id.value
    // letters, number, and simple punctuation (-_ )
    var filter=/^[a-zA-z0-9 _-]+$/
    if (filter.test(str)) {
        valid = true;
    }
    else {
        alert("account ids can consist of the following characters: letters, numbers, -, _ and or a space");
        valid = false;
    }
    return valid;
}
