$(document).ready(function() {
	var flag = true;
	var count = 0;
	while (flag){
		count++;
		if ($("a[rel=example_group" + count + "]").length == 0) flag = false;
	}
	for (var i = 1; i < count; i++){		$("a[rel=example_group" + i + "]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
			    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' <em>' + $(this).attr('title') + '</em></span>';
			}
		});	};
});