How do I make window.opener work with a multi page dialog?

I created a web based application where the uder can add persons (from a search) to a document by the use of a popup window and the function

function selectPerson(userid) {

f = window.document.forms[0];

del = ';';

if (f.multi.value == '0')	eval('window.opener.document.all.'+f.updfield.value+'.value = userid;')

if (f.multi.value == '1') eval('window.opener.document.all.'+f.updfield.value+'.value = window.opener.document.all.'+f.updfield.value+'.value + del + userid;')

}

This works as intended, but as the database have grown larger the number of persons to choose from now requires more than one page in the dialog. I have tried to solve this by using the function:

@DbCommand(“Domino”; “ViewNextPage”)

The problem is that window.opener now no longer refers the the parent page, but the previos page of the search results. I could in principle use window.opener.opener and so on, but as i dont know the number of pages needed to display the results i am in need of a more generic approach

Thanks in advance

Kim Vogel