/* ---------------------------------------------------------------------------------------- Graceful E-Mail Obfuscation - JavaScript function (decodes e-mail addresses) Last updated: July 31th, 2007 by Roel Van Gils Modified: January 30, 2009 by Sean Valencourt ---------------------------------------------------------------------------------------- */ function addOnloadEvent(fnc) { if (typeof window.addEventListener != "undefined") { window.addEventListener( "load", fnc, false ); } else if ( typeof window.attachEvent != "undefined" ) { window.attachEvent( "onload", fnc ); } else { if ( window.onload != null ) { var oldOnload = window.onload; window.onload = function ( e ) { oldOnload( e ); window[fnc](); }; } else { window.onload = fnc; } } } function addClickEvent(myElement, fnc) { if (typeof myElement.addEventListener != "undefined") { myElement.addEventListener( "click", fnc, false ); } else if ( typeof myElement.attachEvent != "undefined" ) { myElement.attachEvent( "onclick", fnc ); } else { if ( myElement.onclick != null ) { var oldOnclick = myElement.onclick; myElement.onclick = function ( e ) { oldOnclick( e ); myElement[fnc](); }; } else { myElement.onclick = fnc; } } } function addMouseOverEvent(myElement, fnc) { if (typeof myElement.addEventListener != "undefined") { myElement.addEventListener( "mouseover", fnc, false ); } else if ( typeof myElement.attachEvent != "undefined" ) { myElement.attachEvent( "onmouseover", fnc ); } else { if ( myElement.onmouseover != null ) { var oldOnmouseover = myElement.onmouseover; myElement.onmouseover = function ( e ) { oldOnmouseover( e ); myElement[fnc](); }; } else { myElement.onmouseover = fnc; } } } /* function AddOnload(myfunc) { if(window.addEventListener) { window.addEventListener('load', myfunc, false); } else if(window.attachEvent) { window.attachEvent('onload', myfunc); } } if (window.onload) { var func = window.onload; window.onload = function() { func(); geo(); } } else { window.onload = geo; } */ //document.getElementById("copyRight").onload = geo(); //addOnloadEvent(geo); document.addEvent('domready', geo); function geo() { if (!document.getElementsByTagName) // Check for browser support return false; if (rot13) // Initiate ROT13 only if needed var ala_map = rot13init(); var tooltip_js_on = "Send e-mail"; var tooltip_js_off = "To reveal this e-mail address, you'll need to answer a simple question"; var ala_links = document.getElementsByTagName('a'); // Get all anchors function geo_decode(ala_anchor) { // function to recompose the orginal address var ala_href = ala_anchor.getAttribute('href'); var ala_address = ala_href.replace(/.*contact\/([a-z0-9._%-]+)\+([a-z0-9._%-]+)\+([a-z.]+)/i, '$1' + '@' + '$2' + '.' + '$3'); var ala_linktext = ala_anchor.innerHTML; // IE Fix if (ala_href != ala_address) { ala_anchor.setAttribute('href','mailto:' + (rot13 ? str_rot13(ala_address,ala_map) : ala_address)); // Add mailto link ala_anchor.innerHTML = ala_linktext; // IE Fix } } for (var l = 0 ; l < ala_links.length ; l++) { // Loop through the anchors /*ala_links[l].onclick = function() { // Encode links when clicked geo_decode(this); }*/ ala_links[l].addEvent('click', function() { geo_decode(this); }); /*addClickEvent(ala_links[l], function() { geo_decode(ala_links[l]); });*/ /*ala_links[l].onmouseover = function() { // Display tooltip when links are hovered if (this.getAttribute('title') == tooltip_js_off) { // Set custom tooltip if specified this.setAttribute('title',tooltip_js_on); geo_decode(this); // Encode links when hovered (so that the address appears correctly in the browser's status bar) } }*/ /*addMouseOverEvent(ala_links[l], function() { // Display tooltip when links are hovered if (ala_links[l].getAttribute('title') == tooltip_js_off) { // Set custom tooltip if specified ala_links[l].setAttribute('title',tooltip_js_on); geo_decode(ala_links[l]); // Encode links when hovered (so that the address appears correctly in the browser's status bar) } });*/ ala_links[l].addEvent('mouseover', function() { // Display tooltip when links are hovered if (this.getAttribute('title') == tooltip_js_off) { // Set custom tooltip if specified this.setAttribute('title',tooltip_js_on); geo_decode(this); // Encode links when hovered (so that the address appears correctly in the browser's status bar) } }); } } var rot13 = 1; function rot13init() { var l_ala_map = new Array(); var s = "abcdefghijklmnopqrstuvwxyz"; for (var i = 0 ; i < s.length ; i++) l_ala_map[s.charAt(i)] = s.charAt((i+13)%26); for (var i = 0 ; i < s.length ; i++) l_ala_map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase(); return l_ala_map; } function str_rot13(a,l_ala_map) { var s = ""; for (var i = 0 ; i < a.length ; i++) { var b = a.charAt(i); s += (b>='A' && b<='Z' || b>='a' && b<='z' ? l_ala_map[b] : b); } return s; }