
    // CHANGE THIS TO THE REDIRECT URL
    var myNextPage="http://www.shopusmilcom.com/store/index.php";

    // global variables
    var testresults = false;
    var hasDomain = 0;
    // generic email pattern
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

function checkEmail(){
    // get the value of the texbox
    var str=document.forms[0].email.value;

    // compare it to the email pattern
    if (filter.test(str)) {
        // this is a valid email, see if has the “.mil” domain extension
        hasDomain=str.indexOf(".mil");
        if (hasDomain>0) {
            //  this is a .mil domain
            testresults=true;
        } else { 
            // see if has the “.gov” domain extension
            hasDomain=str.indexOf(".gov");
            if (hasDomain>0) {
                //  this is a .gov domain
                testresults=true;
            }
        }
    } // filter test

    if (testresults==true) {
        location.href = myNextPage;
    } else {
        alert("You are not authorized to continue!");
    }
}
