// JavaScript Document

// modified to handle both formmail and multiple email addresses
function noSpam() {
	var link = noSpam.arguments[0]; // text for the link
	var subject = noSpam.arguments[1]; // if there's a subject line to the message

	var myat = String.fromCharCode(64);   // @
	var mydot = String.fromCharCode(46);  // .
	var addr = '';

	// starting from the third argument,
	// read the segments and build the address:
	var i;
	var position = 0; // used to check progress to add @ dot comma
	for (i = 2; i < noSpam.arguments.length; i++) {
		if (position == 3) { // must be another email address so reset this and add comma
			position = 0;
			addr += ',';
		}
		if (position) {
			// check whether this element (any but the first)
			// comes after the @ or a dot:
			addr += (position == 1) ? myat : mydot;
		}
		addr += noSpam.arguments[i];
		position++;
	}

	var str = '';
	if (link) {
		if (link== 'formmail') {
			// you could break this down further so that
			// the 'recipient' is less apparent:
			str = '<INPUT TYPE=hidden NAME="recipient" VALUE="';
			
			str += addr;
			str += '">';
		}
		else {
			// you could break this down further so that
			// the 'mailto' is less apparent:
			str = '<a href="mailto:' + addr;
			
			if (subject) {
				// code to display the subject
				str += '?subject=' + subject;
			}
			
			str += '">';
	
			// if the first argument was literally 'addr', the text for the link
			// is the address itself, otherwise it's the text of the argument:
			str += (link == 'addr') ? addr : link;
			
			str += '<\/a>';  // close the tag
		}
	}
	else {
		// if the first argument is '' just print the address
		// without making it a link at all:
		str = addr;
	}

	document.write (str);
}
//-->

