//
// mung.js
// version 1.2
// Last updated 7th March 2004
//
// Functions to creates (hopefully) spam proof e-mail address links.
// In all cases, Contents is the HTML to be included between the opening
// and closing tags.  If missing, the address is printed.
// In all cases, the string in ExtraCode is added to 
// the anchor tag after the href value.  If missing, nothing is added.

var charPeriod = '&#46;';

// Pass User and Host for User@Host.com
function WonderfulThingCom(User, Host, Contents, ExtraCode, Tail) {
	GenerateMailto(User, Host + charPeriod + 'com', Contents, ExtraCode, Tail);
}

// Pass User and Host for User@Host.co.uk
function WonderfulThingCoUk(User, Host, Contents, ExtraCode, Tail) {
	GenerateMailto(User, Host + charPeriod + 'co' + charPeriod + 'uk', Contents, ExtraCode, Tail);
}

// Pass User and Host for User@Host.org.uk
function WonderfulThingOrgUk(User, Host, Contents, ExtraCode, Tail) {
	GenerateMailto(User, Host + charPeriod + 'org' + charPeriod + 'uk', Contents, ExtraCode, Tail);
}

function GenerateMailto(User, Domain, Contents, ExtraCode, Tail) {
	var charAtSign = '&#64;';
	var Address = User + charAtSign + Domain;
	
	document.write('<' + 'a' + ' ' + 'href="' + 'mail' + 'to:' + Address);
	if (Tail)
		document.write('?' + Tail);
	document.write('"');
	if (ExtraCode)
		document.write(" " + ExtraCode);
	document.write('>');
	if (Contents)
		document.write(Contents);
	else
		document.write(Address);
	
	document.write('</a>');
}
