Move up / move down agent

Does anyone have any example agent scripts that does something similar to the following (for a domino web application):

For a document in a view sorted by number, swap its number with another document -(move it up or down in the view).

Thanks,

Joel