// <script type="text/javascript">
<!--  to hide script contents from old browsers

window.onload = init;

function init()
{
	setup_email();
}

/**************************************************************************************************
This function sets up a links associated with class names to send email. Email address cannot
be read by spambots. email_array is an associative array. Each array corresponds to 1 email address.

To use in html code, as an exampke, add <span class="emailAmyChurckrow">Email Amy</span> where each
email address class starts with email****. This code is different than the email_display_link code
in that any text can be displayed between the <span> tags (e.g. "Email Amy") until the user hovers
over the text, then it will change to the actual email address (e.g. amy@gmail.com).

To add another email address, add to email_array.

This function is called by PHP code to set up email_array.
**************************************************************************************************/
email_array = new Array();

function define_emails(email_name, email_address)
{
	email_array[email_name] = email_address;
}

/**************************************************************************************************
This function sets up a links associated with class names to send email. Email address cannot
be read by spambots. email_array is an associative array. Each array corresponds to 1 email address.

To use in html code, as an exampke, add <span class="emailMichele"></span> where each
email address has an email**** associated with it.

To add another email address, add to email_array.
**************************************************************************************************/

function setup_email()
{
	// Get all <span> tags
	var tags = document.getElementsByTagName("span");

	for (var i = 0; i < tags.length; i++)
	{
        // Get className of <span> tag
		var cname = tags[i].className;

		// Now look for classes that begin with 'email'
		var s = cname.indexOf('email');

		// If <span> tag and class starts with 'email'
     	if (s == 0)
        {
        	// Get index to email_array (strip off 'email')
        	index = cname.substring(5);
        	insert_email(tags[i], index);
		}
	}
}

/**************************************************************************************************
This function sets up a links associated with class names to send email. Email address cannot
be read by spambots. email_array is an associative array. Each array corresponds to 1 email address.

To use in html code, as an exampke, add <span class="emailMichele"></span> where each
email address has an email**** associated with it.

To add another email address, add to email_array and add another case statement.
**************************************************************************************************/
function insert_email(tag, index)
{
	var email_array = new Array();
	email_array['Craig'] = 'cbrown005, comcast, net';

	var temp = email_array[index];

	// Remove any spaces, leave commas
    while (temp.indexOf(' ') != -1)
    	temp = temp.replace(' ', '');

	// Split email string by commas
    var temp = temp.split(',');

	address = temp[0] + '@' + temp[1] + '.' + temp[2];

    tag.innerHTML = '<a href="mailto:' + address + '">' + address + '</a>';
}


// end hiding contents from old browsers  -->
// </script>