$(function(){
	// main menu
	$("ul#nav").superfish({
		delay:200
		});
		
	// get from CMS_CONFIG global, default to 5 if no setting
	// CMS_CONFIG is on elements/default_head.ctp
	var embedded_num_thumbs = CMS_CONFIG.embedded_num_thumbs ? parseInt(CMS_CONFIG.embedded_num_thumbs) : 5;
	
	// find embedded albums and assign id's + galleriffic
	$('.embedded-album-container').each(function(i){
		var id = i;
		$(this).find('.embedded-album').attr('id', 'embedded-album-'+id);
		$(this).find('.embedded-album-slideshow').attr('id', 'embedded-album-slideshow-'+id);
		$(this).find('.embedded-album-thumbs').attr('id', 'embedded-album-thumbs-'+id);
		$('#embedded-album-'+id).galleriffic('#embedded-album-thumbs-'+id, {
			imageContainerSel: '#embedded-album-slideshow-'+id,
			numThumbs: embedded_num_thumbs
		});
	});
});