var active = $('.active');
var next = ($('.active').next().length > 0) ? $('.active').next() : $('#siteNewsHead img:first');
I have 13 images contained in a div. The first one has a class called active, which means it is displayed.
The swap images function selects the active image and hides it, and makes the next image active.
However, when the page loads, the function only works correctly once, rather than looping.