var $toobar = function (id, doc) {
    if((id)&&((typeof id == "string")||(id instanceof String))){
        if (!doc) { doc = document; }
        var ele = doc.getElementById(id);
        // workaround bug in IE and Opera 8.2 where getElementById returns wrong element
        if (ele && (ele.id != id) && doc.all) {
            ele = null;
            // get all matching elements with this id
            eles = doc.all[id];
            if (eles) {
                // if more than 1, choose first with the correct id
                if (eles.length) {
                    for (var i=0; i < eles.length; i++) {
                        if (eles[i].id == id) {
                            ele = eles[i];
                            break;
                        }
                    }
                    // return 1 and only element
                } else { ele = eles; }
            }
        }
        return ele;
    }
    return id; // assume it's a node
}

function autoCompleteToolbar(id) {
	var tomid	= Utils.trim($toobar(id).value);

	if(Utils.isNumber(tomid) && tomid.length == 11)return;

	var constant = "@tom.com";
	if(tomid.length > 0 && tomid.indexOf("@") == -1) $toobar(id).value = tomid + constant;
	return;
}
