(function(){
 window.onload = function(){
	var utils = {getEl: function(id){ return document.getElementById(id); },
		setTxt: function(el, txt){ el.innerHTML = txt },
		setLink: function(el, href){ el.href= href;}}; 
	Email(utils.getEl('email-header'));
	Email(utils.getEl('email-contact'));
	function Email(el){
	if (!el){ return false; }
	var text = el.innerHTML;
	var data = {
		  user: text.match(/(\w+[^ \(])/i)[1],
		  site: text.match(/(\(at\)|@) ?(\w+) /i)[2],
		  domain: text.match(/(\(dot\)|\.) ?(\w{2,})/i)[2],
		  text: function(){return (this.user+'@'+this.site+'.'+this.domain)}
	};
	if (data.user && data.site && data.domain){
		    utils.setLink(el, 'mailto:'+data.text()+';');
		    utils.setTxt(el, data.text());
	}}
}})();

