<!--
// Anti-Spam Link Encoder
// Leon Mayne, 2002.
//
// Feel free to modify and redistribute this script / page,
// But please keep this heading intact.
// Just make sure you give me some credit for it!!
//

function encodeText(plainText) {
	var cEmail = '';
	for (i=0; i < plainText.length; i++) {
		var temp = plainText.charCodeAt(i);
		cEmail = cEmail + '&#' + temp + ';';
	}
	return cEmail;
}

function generate(){
	email = encodeText('mailto:' + document.userform.email.value)
	linkText = document.userform.linktext.value;
	if (document.userform.chkLinkText.checked){
		linkText = encodeText(linkText);
	}
	CEmail = '<a href="' + email + '">' + linkText + '</a>';
	if (document.userform.chkJS.checked){
		emailArray = document.userform.email.value.split('@');
		var allText = '<script language="javascript" type="text/javascript">\n';
		allText = allText + 'document.write(\'<a href="mailto:' + emailArray[0] + '\');\n';
		allText = allText + 'document.write(\'\@' + emailArray[1] + '">';
		if (document.userform.linktext.value == document.userform.email.value){
			allText = allText + emailArray[0] + '\');\n';
			allText = allText + 'document.write(\'\@' + emailArray[1];
		}else{
			allText = allText + document.userform.linktext.value;
		}
		allText = allText + '</a>\');\n</';	
		allText = allText + 'script>\n<noscript>\n';
		if (document.userform.chkNoLink.checked){
			allText = allText + 'Please enable JavaScript to view email link\n';
		}else{
			allText = allText + '<a href="' + email + '">' + linkText + '</a>\n';
		}
		allText = allText + '</noscript>';
	}else{
		var allText = '<a href="' + email + '">' + linkText + '</a>';
	}
	if (!document.userform.chkLinkText.checked && document.userform.linktext.value.search("@") != -1){
		msg = "WARNING: You have chosen not to encode the link text, which looks like an email ";
		msg = msg + "address. Be warned that it will be left in a rippable format.";
		alert (msg);
	}
	document.userform.cemail.value = allText
}

function selectText(){
	document.userform.cemail.focus();
	document.userform.cemail.select();
}

function copyValue(){
	document.userform.linktext.value = document.userform.email.value;
}
//-->
