/*
/email.js from phroggy.com 5.5

(C) 2009 Andy Lyttle, all rights reserved.
This code may be distributed and modified under the terms of
the GNU General Public License.
http://phroggy.com/opensource/
*/


/* 
	Look for <code id="email_address"> which contains an e-mail
	address obfuscated with HTML comments or irrelevant tags,
	and replace it with a clickable mailto: link.  Whitespace is
	stripped.  Tags (other than comments) must have an opening
	and a closing tag and may not be nested; their contents will
	be stripped.
*/
function create_mailto() {
	var code=document.getElementById('email_address');
	var addr=code.innerHTML.replace(/\s/gm,'').replace(/<![^>]*>/g,'');
	addr=addr.replace(/<[a-z][^>]*>[^<]*<\/[^>]*>/ig,'');
	if(addr) {
		var a=document.createElement('a');
		a.href='mailto:'+addr;
		a.appendChild(code.cloneNode(true));
		code.parentNode.replaceChild(a,code);
		// alert("DEBUG: "+addr);
	}
}
