/******/
// no-spam Email Address Obfuscator 0.2
// Copyright 2008 Eric Reif, http://crazydrumguy.com
//
// Licensed under the 
// Creative Commons Attribution-Noncommercial 3.0 license
// found at http://creativecommons.org/licenses/by-nc/3.0/
// 
// Please do not remove this notice or attempt to sell this code.
/*******/

function printObfuscated () {
	fullEmail	= document.form.email.value;
	user		= fullEmail.substring(0,fullEmail.indexOf("@"));
	domain		= fullEmail.substring(fullEmail.indexOf("@") + 1, fullEmail.lastIndexOf("."));
	ext			= fullEmail.substring(fullEmail.lastIndexOf(".") + 1);
	
	if ((document.form.link.length == 0) || (document.form.link.value == "Link text (defaults to your email address)")) {
		linkText = fullEmail;
	}
	else {
		linkText = document.form.link.value;
	}
	
	aTag		= '<a href=\"mailto:' + fullEmail + '\">' + linkText + '</a>';
	
	outText		= '<script type=\"text/javascript\">\n';
	outText		+= '<!-- \n';
	outText		+= '// no-spam Email Address Obfuscator, Eric Reif, http://crazydrumguy.com \n';
	outText		+= 'document.write(String.fromCharCode(';
	
	for(i = 0; i < aTag.length; i++) {
		outText	+= aTag.charCodeAt(i);
		outText += (i < aTag.length-1 ? "," : ")")
	}
	
	outText		+= ') \n';
	outText		+= '// --> \n';
	outText		+= '</script> \n';
	outText		+= '<noscript>Sorry, this email address is protected from spammers by JavaScript. You must have JavaScript enabled to see it.</noscript>';
	
	document.form.sourceBox.value = outText;
}