/* encrypted email for each class "encryptedEmailLink" */
(function($) {
$.fn.yasp = function () {
	$(this).each(function () {
		var textAsASCII = '&#'+$(this).text().replace(/[,]+/g, ";&#")+';';
		if ($(this).attr("ref")=='link')
			$(this).replaceWith('<a href="mailto:'+textAsASCII+'">'+textAsASCII+'</a>');
		else
			$(this).replaceWith(textAsASCII);
	});
};
})(jQuery);

$(document).ready(function() {

	// emails verschluesselt ausgeben
	$('.encryptedEmailLink').yasp();

	// popUps für Erklärung der Tatzen
	$("a[rel=popover]").popover({
		offset: 10,
		delayIn: 1000,
		delayOut: 300
	}).click(function(e){
		e.preventDefault();
	});

	$('.fancybox_image').fancybox({
		titlePosition: 'over',
		transitionIn: 'elastic',
		transitionOut: 'elastic'
	});

	// open twitter widget links in another window
	$(".twtr-widget a[href^='http']").live("click", function(e) {
		e.preventDefault();
		if($(this).attr("target")===undefined) {
			window.open($(this).attr('href'));
		} else {
			document.location.href = $(this).attr('href');
		}
	});

});
