// COPYRIGHT NOTICE
// Copyright (c) Design Matrix, 2004, all rights reserved.
// http://www.designmatrix.com
// This file is provided without any warranty or liability whatsoever.
// Permission is granted to copy and modify this file provided that
// this COPYRIGHT NOTICE is included and modifications are noted.
// Download it here:
// http://www.designmatrix.com/services/javascript_email.html
// VERSION 1.3, 08/23/2006
// DESCRIPTION
// This Javascript illustrates methods to maintain a "database" of
// email addresses in one location, so that they only need to be
// maintained in one file rather than in many separate HTML files.
// THE DATABASE
// Define a database for the email addresses as a string array object.
// The form of each line is "First_Name Last_Name Email_Handle Domain".
// The number inside "[ ]" is the numerical index used in makeAddr().
// Change these examples for your own web site. Use "//" for comments.
var addr = new Array();
addr[0] = "Tom Fizzlebottom fizzle whistle.con";
addr[1] = "Dick Dinglewitz wizard oz.con";
addr[2] = "Mary Contrary silverbell gardengrow.con";
addr[3] = "Your Name you yourdomain.con";
addr[4] = "Contact Us info yourdomain.con";
// Note the backslash "\" for a "null" last name here.
addr[5] = "Webmaster \ webmaster yourdomain.con";
// To use an image instead of text for the link:
addr[6] = " contact your_domain.con";
//
// You can also define the email addresses in an array with named
// indices, similar to an associative array in Perl. The advantage of
// arrays with numerical indices is that they would be easier to use in
// loops. The advantage of the named indices is that they might be
// easier to remember for the makeAddr() function (i.e., so you don't
// have to look up the numerical index for a particular persons' email
// address). It appears that numerical and named indices may be mixed
// in one array but we recommend you use one or the other consistently.
addr["Tom"] = "Tom Fizzlebottom fizzle whistle.con";
addr["Dick"] = "Dick Dinglewitz wizard oz.con";
addr["Mary Contrary"] = "Mary Contrary silverbell gardengrow.con";
addr["Your Name"] = "Your Name you yourdomain.con";
// Note the backslash for a 'null' last name here.
addr["Info"] = "info@yourdomain.con \ info yourdomain.con";
addr["Webmaster"] = "webmaster@yourdomain.con \ webmaster yourdomain.con";
// THE PROGRAM SCRIPT
// Define some makeAddr() variables for the email HTML links.
var cmd = "mail" + "to:";
// Any of these work.
//var at = '@';
var at = '@';
// at sign is hex %40
//var at = escape('@');
//
// You can add any amount of extra HTML code to use in makeAddr().
// For example this variable writes an HTML break before the links:
// var preextra = "
";
// If your extra variables contain double quotes, you must escape them:
// var preextra = "