Having trouble with placing pagination in each Accordion panel.

jacq

The first pagination only works since the first panel is already open (panel 1), but when you click the second panel, you'll notice that the pagination doesn't work. I don't know much about Javascript, but I think I need an eventhandler (?) or an onclick function to make this work? Can someone help me mark up this code?