 /** 
  *  @author:    Danny Ng (http://www.dannytalk.com) 
  *  @date:      30/08/08 
  *  @updated:   26/09/08 
  *  @notes:     Free to use and distribute without altering this notice. Would appreciate a link back. 
  *  @usage:     Place the following code before the </body> tag and after google analytics code, 
  * 
  *              <script type="text/javascript" src="<PATH-TO-SCRIPT>"></script> 
  *              <script type="text/javascript"> 
  *                  dtalk_ga.applyVirtualExits(); 
  *              </script> 
  */  
 var dtalk_ga = {  
     applyVirtualExits: function() {  
         var trackPage = function(a)  
         {  
             var domain_name = document.location.toString().toLowerCase().split('/')[2];  
             var exit_domain = a.href.split('/')[2].toLowerCase();  
             if (domain_name.toLowerCase().indexOf(exit_domain) == -1)  
             {  
                 if (typeof pageTracker != 'undefined')  
                     pageTracker._trackPageview('/exit/' + a.href);  
             }  
         };  
         var anchors = document.getElementsByTagName('a');  
         for (var i = 0; i < anchors.length; i++)  
         {  
             if (anchors[i].href && anchors[i].href != (document.location + '#'))  
             {  
                 if (typeof anchors[i].onclick == 'undefined')  
                     anchors[i].onclick = function(e) {  
                         trackPage(this);  
                     };  
                 else if (typeof anchors[i].onclick == 'function')  
                 {  
                     var old_onclick = anchors[i].onclick;  
                     anchors[i].onclick = function(e) {  
                         old_onclick();  
                         trackPage(this);  
                     };  
                 }  
             }  
         }  
     }  
 };