1: /*
2: This function helps protect the
email address from the evil spam-bots that scan
3: web pages for email addresses.
Instead of using the email address directly, the
4: encoded value is stored in the html
and decoded when required.
5: */
6: function sendEmail(encodedEmail)
7: {
8: // The encodedEmail is a string
that contains the email address.
9: // Each character in the
email address has been converted into
10: // a two digit number (hex / base16).
This function converts the
11: // series of numbers
back into the email address and displays the
12: // email client with the mailto:
protocol.
13:
14: // holds the decoded email address
15: var email = "";
16:
17: // go through and decode
the email address
18: for (i=0; i < encodedEmail.length;)
19: {
20: // holds each letter (2 digits)
21: var letter = "";
22: letter = encodedEmail.charAt(i) + encodedEmail.charAt(i+1)
23:
24: // build the real email address
25: email += String.fromCharCode(parseInt(letter,16));
26: i += 2;
27: }
28:
29: // do the mailto: link
30: location.href = "mailto:" +
email;
31: }