//funzioni per codifica e decodifica
var key = "BAD4@.56CEGFHIJKLVWdfTUhijXYZbacemngMNOPQRSopqrstuvz018923klwxy7";
var base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@.0123456789";
function generateLink(encoded)
{
	document.write("<a hr"+"ef=\"ma"+"ilto"+":"+decode(encoded)+"\">"
	+decode(encoded)+"</"+"a>");
}
function decode(str)
{
	return codec(key, base, str);
}
function codec(from, to, str)
{
	var codedResult = "";
	for (i = 0; i < str.length; i++)
	{
		current = str.charAt(i);
		idx = from.indexOf(current);
		nextVal = (idx == -1) ? current : to.charAt(idx);
		codedResult += nextVal;
	}
	return codedResult;
}
