Have a look at this example… could be what you want. May eventually need a little tweaking though. But the general functionality should fit.