
function validate(field) {
    var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.#,'$%!*()_-=+@[];:/ ";
    var ok = "yes";
    var temp;
    var invalid;
    for (var i=0; i<field.value.length; i++) {
        temp = "" + field.value.substring(i, i+1);
        if (valid.indexOf(temp) == "-1") {
            invalid = field.value.substring(i, i+1);
            ok = "no";
        }
    }
    if (ok == "no") {
        alert("Invalid entry!  Please use English characters and/or numbers only.");
        field.focus();
        field.select();
    }
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}

function MM_displayStatusMsg(msgStr) { //v2.0
    status=msgStr;
    document.MM_returnValue = true;
}

var c=0;
function CheckForm(obj) {
    if (obj.FirstName.value==""  || obj.LastName.value=="" || obj.Address.value=="" || obj.City.value=="" || obj.Zip.value=="" ) {
        alert("Please, fill in ALL required fields in the form!");
        return false;
    }
    else if ((!obj.AdultBaseball.checked && !obj.MensSoftball.checked && !obj.Basketball.checked && 
              !obj.Football.checked && !obj.Hockey.checked  && !obj.Cheerleading.checked && 
              !obj.Soccer.checked && !obj.Volleyball.checked && !obj.YouthBaseball.checked && !obj.WGSoftball.checked)) {
        alert("Please, select at least one catalog!");
        return false;
    }

    else if ( obj.Day_Number.value=="") {
        alert("Please, fill in either Daytime phone number!");
        return false;
    }
    else if (obj.Email.value=="") {
        if (c==1) {
            if(window.confirm("You still have not entered your e-mail address!\n\nDo you wish to send the request anyway?")!=1) {
                return false;
            }
        }
        if (c==0) {
            alert("Please, enter your e-mail address!");
            c=1;
            return false;
        }
    }
    else if (obj.Email.value!="" && obj.Email.value.indexOf("@")=="-1") {
        alert("Please, CORRECT your e-mail address!");
        return false;
    }
    else if (obj.class_id.value=="") {
        alert("Please, SELECT your sport!");
        return false;
    }
    else if (obj.Competition.value=="") {
        alert("Please, SELECT who are you ordering for!");
        return false;
    }
    else {
        return true;
    }
}

function if_us() {
    if (document.catalog.State.options[document.catalog.State.selectedIndex].value!="  ") document.catalog.Country.selectedIndex="224";
    if (document.catalog.State.options[document.catalog.State.selectedIndex].value=="  ") document.catalog.Country.selectedIndex="0";
}

function if_us_state() {
    if (document.catalog.Country.selectedIndex!="224") document.catalog.State.selectedIndex="54";
    if (document.catalog.Country.selectedIndex=="224") document.catalog.State.selectedIndex="0";
}
