
window.addEvent('domready', function() {
	// email transform
	var email = $$('.email');
	
	email.each(function(element) {
		
		var email_text = String(element.get('text'));
		var email_class = element.className + "-link";
		
		// Replace "-AT-" by "@"
		// by performing a global match, and the word "-AT-" will be replaced each time it is found
		var the_href = email_text.replace( /-AT-/g, "@"); 
		
		var new_email = new Element('a', {
			'href': 'mailto:' + the_href,
			'class': email_class,
			'title': 'Contact Olileo by email at' + the_href,
			'html': 'Contact Olileo by email'
		});
		
		//email.inject(element);
		element.empty();
		element.adopt(new_email);
	
	});
});
