function listMBeans(qstring) {
    document.location = "jmx?command=list" +
            ((qstring ==  null) ? "" : ("&args=" + qstring));
}

function dumpMBean(beanname) {
    document.location = "jmx?command=dump&args=" + beanname;
}

function instantiate(theform) {
    var bufr = '';
    var els = theform.elements;
    var cname = theform.classname.value;
    var mbname = theform.entry.value;
    var first = true;
    var addctr = 0;
    var sign = (theform.paramtypelist 
            ? (' ' + theform.paramtypelist.value)
            : '');
    for (var i = 0; i < els.length; i++) {
        if (els[i].type != "text") continue;
        if (first) first = false;
        else bufr += '&' + "array" + addctr++ + '=' + els[i].value;
    }
    document.location =
            "jmx?command=instantiate&args=" + cname + ' ' + mbname
            + sign + bufr;
}

function classConstructors(classpath) {
    document.location = "jmx?command=classConstructors&args=" + classpath;
}

function invoke(theform) {
    var bufr = '';
    var els = theform.elements;
    var op = theform.op.value;
    var mbname = theform.mbname.value;
    var addctr = 0;
    var sign = (theform.paramtypelist 
            ? (' ' + theform.paramtypelist.value)
            : '');
    for (var i = 0; i < els.length; i++) {
        if (els[i].type != "text") continue;
        bufr += '&' + "array" + addctr++ + '=' + els[i].value;
    }
    window.open("", "resultsWindow",
            "directories=no,status=no,menubar=no,width=500,"
            + "height=100,scrollbars=yes,resizable=yes").location=
            "jmx?command=invoke&args=" + ' ' + mbname + ' ' + op + sign + bufr;
}

function set(theform) {
    var att = theform.att.value;
    var mbname = theform.mbname.value;
    var val = theform.entry.value;
    document.location = "jmx?command=attribute&args=" + mbname + ' '
            + att + ' ' + val;
}
