
// EXAMPLES:
// compose('clientcare','appleboxdesign','com', false, false)						// use email as display text, no subject
// compose('clientcare','appleboxdesign','com', 'Client Care', 'Online Inquiry')	// display text provided, subject provided

// composeSimple('clientcare','appleboxdesign','com', 'Online Inquiry')				// use in existing href

// Write a complete email link
function compose(address, domain, ext, display, subject) {
	var recipient = address+'&#64;'+domain+'.'+ext;	// Compose email address
	if (!display) {display = recipient;}			// If nothing to display, use email address
	if (subject) {									// If subject is provided, add subject to recipient address
		recipient += "?subject="+subject.replace(/ /g, "%20");
	}
	document.write('<a href="'+'ma'+'il'+'to:'+recipient+'">'+display+'</a>');	// Write link
}

// Use within existing HREF
function composeSimple(address, domain, ext, subject) {
	var recipient = address+'@'+domain+'.'+ext;		// Compose email address
	if (subject) {									// If subject is provided, add subject to recipient address
		recipient += "?subject="+subject.replace(/ /g, "%20");
	}
	window.location = 'ma'+'il'+'to:'+recipient;	// Write link
}