/* 
  
  Fonction réalisées par Jean-Claude Lanz, webmaster du CAS Neuchâtel (www.cas-neuchatel.ch) 

  Merci Jean-Claude !
  
*/

var key1 = "yJzdeB4CcDnmEFbZtvuHlI1hA8SiLo9MwfN3O6Y5QaRqKTjUpxVk2WgXrP7Gs0";
var key2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

function DecrypteMailTo()
{
	var hrefs = document.getElementsByTagName('A');
  for (i in hrefs)
  {
		if (hrefs[i] == null)
			continue;
        
    var href = hrefs[i].toString().toLowerCase();
		if (href.indexOf('mailto:') == 0)
		{
			var mailto = hrefs[i].getAttribute('href').substring(7);
			var newmailto = new String();
			var len = mailto.length;
			var sujet = '';
      if (mailto.indexOf('?') != -1)
      {
        len = mailto.indexOf('?');
        sujet = mailto.substr(len);
      }
        
			for (c = 0; c < len; c++)
			{
				var pos = key1.indexOf(mailto.charAt(c));
				if (pos != -1)
					newmailto += key2.charAt(pos);
				else
					newmailto += mailto.charAt(c);
			}
			hrefs[i].setAttribute('href', 'mailto:' + newmailto + sujet);
		}
  }
}

var enter = true;

function OnFocus()
{
	enter = false;
}
function OnBlur()
{
	enter = true;
}

function DesactiveEnterForTextArea()
{
	if (document.all)
	{
		var input = document.all.tags('textarea');
		for (i = 0; i < input.length ; i++)
		{
			input[i].onfocus = OnFocus;
			input[i].onblur = OnBlur;
		}
	}
}

function OnPageLoad()
{
	DecrypteMailTo();
	DesactiveEnterForTextArea();
}


