// Only links written to the page (already in the DOM) will be tagged
// Script can be called multiple times
 
function addLinkerEvents() {
        var as = document.getElementsByTagName("a");
        var extTrack = ["abraxane"];
        var extDoc = [".doc",".xls",".exe",".zip",".pdf",".js"];
 
        for(var i=0; i<as.length; i++) {
               var tmp;
               if(as[i].getAttribute("onclick"))tmp = as[i].getAttribute("onclick").toString();
               else tmp=null;
               // Tracking links off site - no GATC
               if (tmp != null && tmp.indexOf('urchinTracker') > -1) continue;
               for (var j=0; j<extTrack.length; j++) {
                       
                       if (as[i].href.indexOf("javascript:void(0)")==-1 && as[i].href.indexOf(extTrack[j]) == -1 && as[i].href.indexOf('corp.google.com') == -1  && as[i].href.indexOf('google-analytics.com') == -1 ) {
                               var splitResult = as[i].href.split("//");
                               
                               //as[i].setAttribute("onclick",((tmp != null) ? tmp : "") + "urchinTracker('/ext/" +as[i].href+ "');");
                               as[i].setAttribute("onclick",((tmp != null) ? tmp : "") + "urchinTracker('/ext/" +splitResult[1]+ "');");
                               //alert(splitResult[1])
                               break;
                       }
               }
 
               // Tracking electronic documents - doc, xls, pdf, exe, zip
               if (tmp != null && tmp.indexOf('urchinTracker') > -1) continue;
               for (var j=0; j<extDoc.length; j++) {
                       if (as[i].href.indexOf("javascript:void(0)")==-1 && as[i].href.indexOf(extTrack[0]) != -1 && as[i].href.indexOf(extDoc[j]) != -1) {
                               var splitResult = as[i].href.split(extTrack[0]);
                               //as[i].setAttribute("onclick",((tmp != null) ? tmp : "") + "urchinTracker('/downloads" +as[i].href+ "');");
                               as[i].setAttribute("onclick",((tmp != null) ? tmp : "") + "urchinTracker('/downloads" +splitResult[1]+ "');");
                               //alert(splitResult[1])
                               break;
                       }
               }
 
 
        }
 
}
