﻿/*Created by Kay 10/07/08 - for attaching javasript and general javascript functionality*/

//Add the event fAddEvent on the window load
fAddEvent(window, "load", fAttachEvent);

//Create the event which adds an event listener to the window
function fAddEvent(obj, evType, fn){ if(obj.addEventListener){ obj.addEventListener(evType, fn, false); return true; } else if(obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else return false; }


function fAttachEvent() {    
    //loop through each link and update the mailto href
    var maildivider="[in]" //enter divider you use to divide your email address strings
    
    for (i=0; i<=(document.links.length-1); i++){
    
    if (document.links[i].href.indexOf(maildivider)!=-1)
    
    document.links[i].href=document.links[i].href.split(maildivider)[0]+"@"+document.links[i].href.split(maildivider)[1]
    
    }    

    return; 
}