

//jQuery plugin - dynamic email transformer / spam preventor.
// takes text from inside the link and transforms it to mailto:-url
//like this: <a href="#whatever" class="emailMaybe">myaddress (at) mydomain.com</a> becomes
//<a href="mailto:myaddress@mydomain.com" ...
(function(jQuery){
  jQuery.fn.extend({
    textToMailTo:function() {
	return this.each(function(){
	   var link = $('<a></a>')
	   link.get(0).href = 'mailto:'+ jQuery.trim(jQuery(this).text().replace(/\s?\(at\)\s?/,'@'));
       $(this).wrap(link)
	});
    }
  });
}) (jQuery);

//do the email transform
jQuery(function(){
  jQuery('.js-email').textToMailTo();
}) 
