function decrypt_ml(eml){
	eml = eml.replace(/__/g, '@');
	eml = eml.replace(/_/g, '.');
	eml = eml.replace(
		/[a-zA-Z]/g, 
		function(chr){
			var cc = chr.charCodeAt(0);
			var minus = cc >= 97 ? 97 : 65;
			cc = (cc - minus + 13) % 26 + minus;
			return String.fromCharCode(cc);
		}
	);
	return eml;
}
/*Duplicate each <img>'s content from alt to title attribute (for FF users convinience)*/
var imgs=document.getElementsByTagName('img');
var email, l, l2;
if(imgs){
	l=imgs.length;
	for(var i=0;i<l;i++)
		imgs[i].title=imgs[i].alt;
}
var as=document.getElementsByTagName('A');
if(as){
	l=as.length;
	for(var i=0;i<l;i++){
		/*Make all <a class="external"> open in new window*/
		if(as[i].className.indexOf('external')!=-1)
			as[i].setAttribute('target','external');
		/*Most importantly, implement email addresses decryption (hi hackers, this is just what you need, I assume)*/
		if(/\/contact\/[a-zA-Z0-9_-]+($|\?)/.test(as[i].href)){
			eml = as[i].href.substr(as[i].href.lastIndexOf('/') + 1);
			var eml_add = '';
			if(eml.indexOf('?') != -1){
				eml_add = eml.substr(eml.indexOf('?'));
				eml = eml.substr(0, eml.indexOf('?'));
			}
			eml = decrypt_ml(eml);
			as[i].href = 'mai' + 'lto' + ":" + eml + eml_add;
			as[i].innerHTML = eml;
		}
	}
}
