// Created by Shane Rushik June 2003
////////////////////////////////////////////////////////////////////
// This function returns the provided email address to be written in HTML
// Leave 'DisplayText' empty to display the email address on the page
// Otherwise, the function will return the MailTo URL with the provided 
// Text highlited as a link
// The code to call this function follows:
//------------------------------------------------------------------
//		<script language="JavaScript">
//		  <!-- Begin
// 		    document.write(cloakemail('info','companyname.com'));
// 		  // End -->
//		</script>
//
// --- OR . . . ----------------------------------------------------
//
//		<script language="JavaScript">
//		  <!-- Begin
// 		    document.write(cloakemail('info','companyname.com','Click here to Email us'));
// 		  // End -->
//		</script>
//------------------------------------------------------------------
// The above function will write the address info@companyname.com on the web page
////////////////////////////////////////////////////////////////////

function cloakemail(user,domain,DisplayText){

    // use ascii characters for "MAILTO:" to hide from spiders
    var asciiMAILTO = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;"; //-- Ascii for 'mailto:'

    // if DisplayText is empty, combine user & domain with ascii character for "@"
    if (DisplayText == null || DisplayText== "" ){ DisplayText = user +'&#64;' + domain;}

    return '<a href="' + asciiMAILTO + user + '&#64;' + domain + '">' + DisplayText + '</a>';
}

