/*
	A simple email obfuscator. Usage is simple:
	
	<script>document.write(obfuscate('com','example','test','how'));</script>
	
	com 	= 	the domain extension. Can be any valid top level domain (test@example.COM)
	example = 	the actual domain. (test@EXAMPLE.com)
	test	= 	the email user name (TEST@example.com)
	how		= 	'm' builds the whole mailto:link; default uses href.location for onclick (non-link usage)
	text	= 	text to be displayed in the link if not the email. !!! Is NOT OBFUSCATED !!! If blank, shows email

	This won't stop email harvesters that can interpret javascript, but most are cheap pieces of junk
	written by second rate Windows programmers trying to make a buck. 
	
	I can be reached at obfuscate('com','frankmarion','business','m','Send mail!');  :)
	
*/

function obfuscate(ext,dom,adr,how,text,subj) {
	var i;
	var obfEmail;
	var email = adr+'\@'+dom+'\.'+ext;
	var how;
	var text;
	obfEmail = '';

	for (i=0; i<email.length; i++) {
		var code = email.charCodeAt(i);
		if (chars[code]) {
			obfEmail = obfEmail + '&#';
			if (code < 100) {obfEmail = obfEmail + '0';}
				obfEmail = obfEmail + code + ';';
			} else {
				obfEmail.value = obfEmail + email.charAt(i);
			}
		}
	
		if (how == 'm') {
			if (text !='' && text != null) {
				return '<a href="mailto:'+obfEmail+'">'+text+'</a>';
			} else {
				return '<a href="mailto:'+obfEmail+'">'+obfEmail+'</a>';
			}
		} else {
			document.location.href='mailto:'+email; return false;
		}
	}

		var chars = new Array (255);
		var i;
		for (i=0; i<chars.length; i++) {
		  chars[i] = false;
		}
		for (i=32; i<127; i++) {
		  chars[i] = true;
	}

// End