/**********************************************************************
  NP_SpamImmunizer - Nucleus plugin for immunizing email addresses
                     against spam

  This is the JavaScript support file for the plugin. Include it into
  your HTML page where you want to use the plugin with

      <script type="text/javascript" src="NP_SpamImmunizer.js">

  See NP_SpamImmunizer.php for more instructions.

  Released under the terms of the GPL.

  Copyright (c) 2003 by Till Gerken <till@tantalo.net>

  See http://www.tillgerken.de for further information.
**********************************************************************/

function decrypt_mailto(str)
{
	var low = 0;
	var high = 0;
	var retval = "";

	for(var i = 0; i < str.length; i += 2)
	{
		high = str.charCodeAt(i) - 48;
		low = str.charCodeAt(i + 1) - 48;

		if(high > 9)
			high -= 7;

		if(low > 9)
			low -= 7;

		retval += String.fromCharCode((high << 4) | low);
	}

	return retval;
}

function linkto_decrypt_mailto(str)
{
	window.location.href = "mailto:" + decrypt_mailto(str);
}
