if($("a.fancybox[rel]").length!=0) {
	var rels = [];
	$("a.fancybox[rel]").each(function() {
		if(jQuery.trim($(this).context.rel)!='' && jQuery.inArray($(this).context.rel,rels)==-1) {
			rels.push($(this).context.rel);	
		}
	});
	if(rels.length!=0) {
		for(var i=0; i<rels.length; i++) {
			$("a.fancybox[rel='"+rels[i]+"']").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'inside',
				'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
					return '<div style="text-align:left !important">Bild ' +  (currentIndex + 1) + ' / ' + currentArray.length + ': ' + title + '</div>';
				}
			});
		}
	}
}
$("a.fancybox:not(a[rel])").fancybox();
