Extension talk:S5h adsense filter

I would like to achieve the following: If there are 2+ h2 headings on my page: Display the banner in front of the second one If there are no or just 1 h2 heading: Display the banner at the very end

I already got the banner in front of the headings:

But I don't get the rest done...