function decodeEmailsText(text)
{
	text = text.replace(/\[METTRE AROBASE\]/g, '@');
	text = text.replace(/\[METTRE POINT\]/g, '.');
	text = text.replace(/\[ENLEVER ÇA\]/g, '');
	return text;
}

function decodeEmailsElement(element)
{
	if (element.attr('href'))
		element.attr('href', decodeEmailsText(element.attr('href')));
	if (element.children().length == 0)
		element.text(decodeEmailsText(element.text()));
	else
	{
		element.children().each(function()
		{
			decodeEmailsElement($(this));
		});
	}
}

/**
 * Decode emails in the whole page
 */
function decodeEmails()
{
	$('.encoded-email').each(function()
	{
		decodeEmailsElement($(this));
	});
}

$(decodeEmails);
