function formatTitle(title, currentArray, currentIndex, currentOpts) {
	var obj = currentArray[ currentIndex], href = $(obj).attr('href'), rel = $(href.substr(href.indexOf("#"))), video = 0 < $(rel).length;
	if ('undefined' == typeof($(obj).data('descr'))) {
		var content = $(video ? rel.children(':not(video,img)') : $(obj).find('span').children()).clone(true), titleEl = content.first();
		titleEl.replaceWith($('<h3>' + title + '</h3>'));
		$(obj).data('descr', content);
	}
	return $('<div />').append($(obj).data('descr'));
}
jQuery(function($){
	$('a[href$=".jpg"],a[href$=".png"],a[href$=".gif"],a[rel^="lightbox"]').fancybox({'titleFormat':formatTitle});
	$('a[href^="http"]:not([href*="www.elbmotion.de"])').unbind('click').click(function(){window.open(this.href);return false;})
});
