function imagesLoaded($selector){

	var maxHeight = 0;

	jQuery.each($selector.find('img'), function(i, obj) {
		if ( jQuery(obj).height() > maxHeight ) {
			maxHeight = jQuery(obj).height();
		}
	});

	if (maxHeight > 0) {
		jQuery($selector).height(maxHeight + 10).css('overflow','hidden');
	}

	jQuery($selector).innerfade({
		speed: 'slow',
		timeout: 4000,
		type: 'sequence',
		containerheight: maxHeight
	});

}

jQuery(document).ready(function(){

	if ( typeof jQuery('.product-images') != 'undefined' ) {
		jQuery('.product-images').onImagesLoad({
			selectorCallback: imagesLoaded
		});
	}

});
