/**************************************************************************
File:     nospam.js (v1.0 08/03/2001)
Author:   Stephen Doolan (steve@javascriptguru.co.uk)
Site:     www.javascriptguru.co.uk

Details:

This script provides some simple way of putting emails on a web page
without getting them picked up by the ever present web-based email trawlers.

There are functions for works for both passive emails (ie just the mail displayed on the
page) and active emails (clickable emails that use the 'mailto' tag).

The most safe is the NSParanoid function, which creates a web-trawler safe clickable email,
provides a rolling status bar message, and lets you put suitable text as the link.  This may
be going over the top, so if you're happy putting the email address as the text in the link,
use the NSClickable function.

Use these functions as in this example:

=======================================================================
<!-- NSParanoid function -->
<script language="javascript">NSSafe('javascriptguru.co.uk', 'spam', 'The Guru')</script>


<!-- NSClickable function -->
<script language="javascript">NSClickable('javascriptguru.co.uk', 'spam')</script>


<!-- NSDisplay function -->
<a href="mailto:spam@javascriptguru.co.uk"><script language="javascript">NSDisplay('javascriptguru.co.uk', 'spam')</script></a>


<!-- NSMailto function -->
<a href="javascript:NSMailto('javascriptguru.co.uk', 'spam')">spam@javascriptguru.co.uk</a>
=======================================================================

Note that since the NSParanoid(), NSClickable() and NSDisplay() functions use document.write,
they may not work too well with Netscape (at least not until Netscape sort out their
resize / refresh bugs).  You may want to only use NSMailto and hide the mail address,
like so:

=======================================================================
you can always <a href="javascript:NSMailto('javascriptguru.co.uk', 'spam')">send me a mail</a>.
=======================================================================

See http://www.javascriptguru.co.uk/ for more info.

NB: This script can be used freely for any purpose, but the header must
    not be removed or altered.  Thanks.
**************************************************************************/


function NSParanoid(sDomain, sName, sDisplay)
// Creates a web-trawler safe clickable email with a suitable status bar message,
// but with something else being displayed on screen.
{
    var s = "";

    s += "<a href=\"javascript:NSMailto('";
    s += sDomain;
    s += "', '";
    s += sName;
    s += "')\" ";
    s += "onMouseOver=\"status='Contact Rhettoric Media'; return true;\" ";
    s += "onMouseOut=\"status=''; return true;\">";

    s += sDisplay;

    s += "</a>";

    document.write(s);
}


function NSClickable(sDomain, sName)
// Safely writes email address (with a suitable staus bar message), and
// uses NoSpamMailto() when clicked
{
    var s = "";

    s += "<a href=\"javascript:NSMailto('";
    s += sDomain;
    s += "', '";
    s += sName;
    s += "')\" ";
    s += "onMouseOver=\"status='Contact Rhettoric Media'; return true;\" ";
    s += "onMouseOut=\"status=''; return true;\">";

    document.write(s);

    NSDisplay(sDomain, sName);

    document.write("</a>");
}


function NSDisplay(sDomain, sName)
// This function displays an email, using a harmless span tag
// just to further muddle any web-trawler
{
    document.write(sName);
    document.write("<span>");
    document.write("@");
    document.write("</span>");
    document.write(sDomain);
}


function NSMailto(sDomain, sName)
// This function opens a mailer window (just as if the original
// href tag used 'mailto'
{
    var m = "mailto:" + sName + "@" + sDomain;
    document.location.replace(m);
}



