/**
 * Obfuscate e-mail addresses to prevent harvesting by spam bots
 *
 * @package   TheBeastlyBeasts
 * @author    PBM Web Development <enquiries@pbm-webdev.co.uk>
 * @copyright 2006 PBM Web Development. All rights reserved.
 * @version   CVS: $Id: obfuscateemail.js,v 1.1 2006/07/29 12:21:08 Chris Exp $
 * @since     Release 1.0.0
 */

/**
 * Obfuscate e-mail addresses to prevent harvesting by spam bots
 *
 * Writes the e-mail address to the document at the point at which it is called.
 * There should be a <noscript> block with alternative text
 * for users that have not enabled JavaScript.
 *
 * @param   string  who     Who at the domain the e-mail address is for
 * @param   string  subject The subject of the e-mai;
 * @since   Release 1.0.0
 */
function obfuscateEmail(who, subject)
{
    var domain       = '@thebeastlybeasts.co.uk';
    var startSubject = '?subject=';
    
    if (subject)
    {
        document.write('<a href="mailto:' + who + domain + startSubject + subject + '" title="Send an e-mail to ' + who + domain + '">' + who + domain + '</a>');
    }
    else
    {
        document.write('<a href="mailto:' + who + domain + '" title="Send an e-mail to ' + who + domain + '">' + who + domain + '</a>');
    }
}