﻿
function writeEmailAddress(fn, ln, dm)
{
	var email = fn + '.' + ln + '@' + dm;
	document.write('<a href="mailto:' + email + '">' + email + '</a>');
}

function replaceEmailAddresses()
{
    var emailData=document.getElementsByName("esource");
    var cells = document.body.getElementsByTagName('TD');
    for(cellIndex=0;cellIndex< cells.length;cellIndex++)
    {
	    if(cells[cellIndex].innerText.length > 0) 
	    {
		    if(cells[cellIndex].innerText.substring(0,5) == 'email')	// // ex. email234456
		    {
// 8/8/07 BC This line was commented out to prevent Key display at bottom of page.
// It was probably originally for debugging.
//document.writeln(cells[cellIndex].innerText + '<br />');
			    for(index=0;index < emailData.length;index++)
			    {
				    var items = emailData[index].value.split(',');
				    if(cells[cellIndex].innerText == 'email' + items[1])
				    {
					    var emailAddress = items[3] + '.' + items[2] + '@' + items[0];
					    cells[cellIndex].innerHTML = '<a href="mailto:' + emailAddress + '">' + emailAddress + '</a>';
					    break;
				    }
			    }
		    }
	    }
    }
}

