function gobutton(req){
    document.form1.request.value = req;
    document.form1.submit();
}

function sync() {

	fixBustedFrames();

    var logon = document.getElementById("USERPRF");

    if(logon)
        logon.focus();

    if (window.top['logo']) {
        if (document.forms['setbanner'])
            document.setbanner.submit();
    }
    
}

function compare(field1, field2){
    val1 = field1.value.toUpperCase();
    val2 = field2.value.toUpperCase();
    if (val1 != val2)
        return false;
    else
        return true;
}

function chgacct(){
    e1 = document.getElementById("email1");
    e2 = document.getElementById("email2");
    p1 = document.getElementById("newpass1");
    p2 = document.getElementById("newpass2");
    msg = "";

    if (!compare(e1, e2))
        msg = "- Email addresses do not match.\n";

    if (!compare(p1, p2))
        msg += "- Passwords do not match.\n";

    if (p1.value.length < 6 && p1.value.length > 0)
        msg += "- Password must 6 characters or longer.\n";

    if (msg != "")
        alert("Please correct the following errors:\n" + msg);
    else
        gobutton("subacct");

}

function pickoption(menu, seq){
    document.form1.menuname.value = menu;
    document.form1.menuseq.value = seq;
    gobutton("pickoption");
}

function selcust(cust, corp) {

    if(typeof(corp)!="undefined")
        document.form1.corpid.value = corp;

    document.form1.userclt.value = cust;
    submitCust();
}

function submitCust()
{
    if (document.form1.userclt.value.length == 0)
        alert("Please select or enter a customer.");
    else{
        gobutton("chgcust");
    }

}

function makeSecureLogon()
{
    var url = window.parent.location;
    if (url.protocol.toLowerCase() != "https:" && url.port != "81" && url.port != "82")
    {
        alert("You are being redirected to our secure logon.  After the new screen loads, please update your bookmarks if you do not wish to see this message again.");
        window.parent.location = 'https://www.data-management.com/dmicgih/dmimenu.htm';
    }
}

