Toolbar select button how to select an item

I’m trying to use, in the toolbar, a select button. I need to create different Item in the select button using different URL for each Item. My problem is how to return which item I selected in the select button to the function that send to the DB the appropriate action.
Anybody know how can I do that?
Below is my script.
Thanks in Advance

function initTOOLBAR() {
var toolbar = new dhtmlXToolbarObject(“toolbarObj”);

var opts = [[‘id1’, ‘obj’, ‘Primaricerca’,’’],[‘id2’, ‘obj’, ‘’,’’],[‘id3’, ‘obj’, ‘’,’’],[‘id4’, ‘obj’, ‘’,’’],[‘id5’, ‘obj’, ‘’,’’],[‘id6’, ‘obj’, ‘’,’’],[‘id7’, ‘obj’, ‘’,’’],[‘id8’, ‘obj’, ‘’,’’],[‘id9’, ‘obj’, ‘blob FDF’,’’],];

toolbar.addButtonSelect(“ricerca1”, 6, “Elenco Ricerche registrate”,opts, “”, “”);

toolbar.attachEvent(“onClick”, “doWithListOption”,“ricerca1”);
}

attachEvent takes only 2 parameters:

toolbar.attachEvent("onClick", doWithListOption); function doWithListOption(itemId){ /*your code here*/ }