
/**
 *	E-Mail Function Descriptions
 *
 *	Introduction
 *		The function CreateEMailAddress is just a helper
 *		function that makes an e-mail address out of the
 *		texts provided as parameters. It is seldom used
 *		on an HTML page. It's used internally by all the
 *		other functions that DO occur frequently on HTML
 *		pages. Each of the other functions displays a
 *		link on the web page. If the visitor clicks on
 *		the link, the function opens an e-mail window.
 *		The visitor then completes and sends the e-mail.
 *
 *	General Description of Parameters
 *		"name" should be the part of an e-mail address
 *			that comes BEFORE the @.
 *		"domain" should be the part of an e-mail address
 *			that comes AFTER the @.
 *		"text" is text that will appear on the page as
 *			the link for the user to click.
 *		"subject" is text that is to appear in the
 *			"subject" line.
 *
 *	Examples of Use
 *
 *	CreateEMailAddress( "abc", "xyz.com" );
 *		returns the string "abc@xyz.com"
 *
 *	OpenEMailPage( "abc", "xyz.com" );
 *		displays abc@xyz.com as a link for the user to
 *		click on. If the user clicks on that link, a
 *		new e-mail, pre-addressed to abc@xyz.com, is
 *		opened.
 *
 *	OpenEMailPageWithText( "abc", "xyz.com", "e-mail me" );
 *		displays "e-mail me" as a link for the user to
 *		click on. If the user clicks on that link, a
 *		new e-mail, pre-addressed to abc@xyz.com, is
 *		opened.
 *
 *	OpenEmailPageWithSubject( "abc", "xyz.com",
 *			"From our web site: " );
 *		displays abc@xyz.com as a link for the user to
 *		click on. If the user clicks on that link, a
 *		new e-mail, pre-addressed to abc@xyz.com and with
 *		"From our web site: " on the subject line, is
 *		opened.
 *
 *	OpenEMailPageWithText( "abc", "xyz.com", "e-mail me",
 *			"From our web site: " );
 *		displays "e-mail me" as a link for the user to
 *		click on. If the user clicks on that link, a
 *		new e-mail, pre-addressed to abc@xyz.com and with
 *		"From our web site: " on the subject line, is
 *		opened.
 *
 *	OpenEMailPageWithTextAndSubject( "abc", "xyz.com", "e-mail me",
 *			"From our web site: " );
 *		displays "e-mail me" as a link for the user to
 *		click on. If the user clicks on that link, a
 *		new e-mail, pre-addressed to abc@xyz.com and with
 *		"From our web site: " on the subject line, is
 *		opened.
 */

function CreateEMailAddress( name, domain )
{
	if( name == "" )
		name = "Webmaster";
	if( domain == "" )
		domain = "FriendsOfNACO.ca";
	return name + "@" + domain;
}

function OpenEMailPage( name, domain )
{
	document.write( "<a href=\"mailto:" +
		CreateEMailAddress( name, domain ) + "\">" +
		CreateEMailAddress( name, domain ) + "</a>" );
}

function OpenEMailPageWithText( name, domain, text )
{
	document.write( "<a href=\"mailto:" +
		CreateEMailAddress( name, domain ) +
		"\">" + text + "</a>" );
}

function OpenEMailPageWithSubject( name, domain, subject )
{
	document.write( "<a href=\"mailto:" +
		CreateEMailAddress( name, domain ) +
		"?subject=" + subject + "\">" +
		CreateEMailAddress( name, domain ) + "</a>" );
}

function OpenEMailPageWithTextAndSubject( name, domain, text, subject )
{
	document.write( "<a href=\"mailto:" +
		CreateEMailAddress( name, domain ) +
		"?subject=" + subject + "\">" +
		text + "</a>" );
}

function ContactWebmaster()
{
	OpenEMailPageWithTextAndSubject(
		"Webmaster",
		"SustainableLivingOttawaEast.ca",
		"Webmaster",
		"SLOE: " );
}
