$(window).load(function() {
    $('ul.slideshow').cycle({
    	after: onAfter,
    	fit: true,
    	containerResize: false,
		width: '100%'
    });
    
    $(window).resize(function() {
    	$('ul.slideshow').css('height', $('ul.slideshow').find('li:visible:first').height());
    });
});

function onAfter(curr, next, opts, fwd) {
	var $ht = $(this).height();

	//set the container's height to that of the current slide
	$(this).parent().css('height', $ht);
	
	//Update the pagination
	$(this).parent().next('p.image-pagination').text('Image ' + (opts.currSlide + 1) + ' of ' + opts.slideCount);
}
