function initScrollableGalleries()
{
	jQuery(".ScrollableGallery")
		.each(function()
			{
				var gallery = jQuery(this);
				var d = new Date();
				
				var uid = d.getTime();
				var galleryOverlayId = 'PhotoGallery_' + uid;
				
				var galleryOverlay = jQuery('<div class="PhotoGalleryOverlay" id="' + galleryOverlayId + '"></div>');
				
				galleryOverlay
					.html('<a class="prev" scroller="'+uid+'">prev</a><a class="next" scroller="'+uid+'">next</a><div class="info"></div><img class="progress" src="assets/common/img/scrollable-photo-gallery/loading.gif" />')
					.appendTo('body');
				
				gallery.find('a')
					.overlay({
						target: galleryOverlay,
						expose: '#f1f1f1'
					})
					.gallery({
						 	speed: 800,
							template: '<strong class="title">${title}</strong> <em class="description">${description}</em><span class="total">Image ${index} of ${total}</span>',  
							onBeforeLoad: function(overlay, el, info)
									{
										if(el)
										{
											var popupLink = el;
											var scrollerSelection = popupLink.parent();
											jQuery('.ScrollableGallery li').removeClass('active');
											scrollerSelection.addClass('active');
										}
									}
						});
			});

jQuery('#slideshow').cycle({
		fx: 'fade',
		timeout:       4000,
		speed:         2000
	});


}


jQuery(function()
{
	initScrollableGalleries();
})