/* Cryptomail 1.0 - 2011.04.18
/*
/* Created by Luca Pillonel
/* copyright www.oxima.ch
--------------------------------------*/

var Cryptomail = new Class({
	
	initialize : function(){
		$$('.cryptomail').each(function(el){
			var email = '';
			el.get('html').split('::').reverse().each(function(part, i){
				email += this.reverse(part);
				switch (i) {
					case 0 :
						email += '@'; break;
					case 1 :
						email += '.'; break;
				}
			}, this);
			
			el.empty();
			new Element('a', {
				href : 'mailto:'+email,
				html : email
			}).inject(el)
		}, this);
	},
	
	reverse : function(string){
		return string.split("").reverse().join("");
	}
});
