function initImagelistFunctions(elementscope) {
	$(".imagelist", elementscope).cycle({ fx: 'fade' });

	$("a.fancyboxtarget", elementscope).fancybox({
		'hideOnContentClick': true,
		'titlePosition': 'inside',
		titleFormat: function(title, currentArray, currentIndex, currentOpts) {
			if (currentArray.length > 1) {
				if (title)
					return '<div style="float: left;">' +  (currentIndex + 1) + ' / ' + currentArray.length + '</div> ' + title;
				else
					return (currentIndex + 1) + ' / ' + currentArray.length;
			}
			else
				return title;
		},
		onComplete:	function() {
            $(".imagelist").cycle('pause');
		},
		onClosed:	function() {
            $(".imagelist").cycle('resume');
		}
	});
}

$(document).ready(function()
{
	initImagelistFunctions();
});



