/*
 * Slideshow for proa.org
 *
 * Copyright (c) 2009 Pablo Ziliani
 * http://kultroom.com/
 * 
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Depends on de jQuery & jQuery Cycle
 *  - http://jquery.com
 *  - http://malsup.com/jquery/cycle
 *
 */
(function($){

$(document).ready(function() {
	$('.slideshow')
	.addClass('slideshow-loading')
	.children()
		.wrap('<div class="slide"></div>')
		.end()
	.find('img')
		.each(function(i){
			var $img    = $(this),
				caption = $img.attr('title');
			if (caption) {
				caption = caption.replace(/^([^-]+) - /, '<strong>$1</strong> - ');
				$img.after('<div class="caption">' + caption + '</div>');
			}
		});
	$('body').addClass('js');
});

$(window).load(function() {
	$('.slideshow')
	.removeClass('slideshow-loading')
	.cycle({
		timeout: 3000,
		pause: true
	});
});

})(jQuery);
