/* -------------------------------------------------------------- 
   
   JavaScript build on jQuery
  
-------------------------------------------------------------- */ 
$.easing.easeOutExpo = function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	};

//by default, the scroll is only done vertically ('y'), change it to both.
$.scrollTo.defaults.axis = 'y'; 

// E-mail defuscate
jQuery.fn.defuscate = function(settings) {
 settings = jQuery.extend({link: true}, settings);
 regex = /\b([A-Z0-9._%-]+)\([^)]+\)((?:[A-Z0-9-]+\.)+[A-Z]{2,6})\b/gi;
 classes = $(this).attr("class");
 mailto = '<a href="mailto:$1@$2" class="'+classes+'">$1@$2</a>';
 plain = "$1@$2";
 return this.each(function() {
 defuscated = $(this).html().replace(regex, settings.link ? mailto : plain)
 $(this).after(defuscated).remove();
 });
};


jQuery(function( $ ){
	
	$('body').removeClass('nojs');
				

	$('a[@href*="#"]').bind('click', function(){
		var $target = $(this).attr('href');
			$.scrollTo( $target , 800, {easing:'easeOutExpo', offset: {top:-50, left:0}} );
	});

	
	
	$('span.email').defuscate();
	
	$('a.mf').attr('title', 'Die Website der Medienfreunde besuchen');
	
});


