
/**
 * from Simon Willison
 *
 * http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 **/

function addLoadEvent(func)
{
	//alert('addLoadEvent func');
  var oldonload = window.onload;
  if (typeof window.onload != 'function')
  {
    window.onload = func;
  }
  else
  {
    window.onload = function()
    {
      oldonload();
      func();
    }
  }
}

addLoadEvent(function()
{

        var emails = document.getElementsByTagName('span');
       
        if (!emails) {
			//alert('!emails');
			return;
		}
       
        var title = '';
        var search = [' CHEZ ', ' POINT '];
        var replace = ['@', '.'];
        var replaced_text = '';
       
        for (var i = 0; i < emails.length; i++)
        {
                /* get the text node
                 */
                var text = emails[i].childNodes[0];

                if (text && emails[i].className==='Obfuscated')
                {
                        /* search & replace text
                         */
                        replaced_text = text.nodeValue;
                       
                        for (var j = 0; j < search.length; j++)
                        {
                                var reg_exp = new RegExp(search[j], 'g');
                                replaced_text = replaced_text.replace(reg_exp, replace[j]);
                        }
                       
                        /* create anchor node
                         */
						if(do_link=='nolink'){
							var link = document.createElement('span');
						}
                        else var link = document.createElement('a');
                        link.setAttribute('title', title);
						if(do_link!=='nolink')
                        link.setAttribute('href', 'mailto:' + replaced_text);
                       
                        /* create new text node and append to anchor
                         */
                        var text_node = document.createTextNode(replaced_text);
                       
                        link.appendChild(text_node);
                       
                        /* swap in anchor for text
                         */
                        emails[i].replaceChild(link, emails[i].childNodes[0]);
                }
        }
}); 
