function ValidatorGetControl(id) {
    var control;
    control = document.all[id];
    if (typeof(control.value) == "string") {
        return control;
    }
    if (typeof(control.tagName) == "undefined" && typeof(control.length) == "number") {
        var j;
        for (j=0; j < control.length; j++) {
            var inner = control[j];
            if (typeof(inner.value) == "string" && (inner.type != "radio" || inner.status == true)) {
                return inner;
            }
        }
    }
    else {
        return ValidatorGetControlRecursive(control);
    }
    return "";
}

function ValidatorGetControlRecursive(control)
{
    if (typeof(control.value) == "string" && (control.type != "radio" || control.status == true)) {
        return control;
    }
    var i, ctrl;
    for (i = 0; i<control.children.length; i++) {
        ctrl = ValidatorGetControlRecursive(control.children[i]);
        if (ctrl.value != "") return ctrl;
    }
    return "";
}

