/* ---------------------------------------------------------------------------------------- Graceful E-Mail Obfuscation - JavaScript function (decodes e-mail addresses) Last updated: July 31th, 2007 by Roel Van Gils Modified: January 30, 2009 and September 18, 2009 by Sean Valencourt ---------------------------------------------------------------------------------------- */ window.addEvent('domready', geo); function geo() { 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 = $$('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 } } ala_links.each( function(element) { // Loop through the anchors element.addEvent('click', function() { geo_decode(this); }); element.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; }