function doAutotab(el)
{
        if (el.value.length >= el.size) {
        	var nx = nextElement(el);
            if (nx != null) {
                try {
                    nx.focus();
                } catch (e) {
                    // nop -- mozilla throws exception if new focus field
                    // has autocomplete data.
                }
            }
        }

}

function nextElement(el)
{
	var f = el.form;
	for (var i =0; i < f.length; i++) {
		if (f[i] == el) {
			i++;
			if (f[i] != null) {
				return f[i];
			} else {
				return null;
			}
		}
	}	

	return null;
}

function setAutotab()
{
	for (var i = 0; i < arguments.length; i++) {
		var elid = arguments[i];
		var el = document.getElementById(elid);
		if (el != null) {
			el.onkeyup=new Function("doAutotab(this);");
		}
	}
}

