Is your html supposed to be:
Code:
<div id="slideshow">
<div class="active"><a href="first.html"><img src="first.jpg" title="title1" border=0 ></a></div>
<div><a href="second.html"><img src="second.jpg" title="title2" border=0 ></a></div>
</div>
In the code you posted you have an extra nested div. Also, the title is an attribute of the img tag not the anchor. Finally, your if statement on the length is incomplete. Assuming the html above is correct, try:
Code:
var $active = $('#slideshow .active');
var $next = ($active.next().length > 0) ? $active.next() : $('#slideshow div:first');
var mytitle = $next.find('img').attr("title");