/* LiteTest email encode
* Version 0.9.1/com/brianblocker
* Author Jonas Hagstedt
* ##MODIFIED BY BRIANBLOCKER.com ON 4/29/2010##
* ##MODIFIED BY BRIANBLOCKER.com ON 5/16/2010##
* URI: http://www.litetest.com/Resources.aspx/EmailEncode
* Released with the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
(function($) 
{
	$.fn.emailencode = function(options) 
	{
		var settings = jQuery.extend(
		{
			atsign: "*",
			period: "."
		}, options);

		return this.each(function()
		{
			var $this = $(this),
					address = $this.attr("title"),
					formatedAddress = address.replace(settings.atsign, '@');
			
			formatedAddress = settings.period == "." ? formatedAddress : formatedAddress.replace(settings.period,'.');
			
			$this.attr('href', 'mailto:' + formatedAddress).html(formatedAddress);
		});
	};
})(jQuery);
