/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


jQuery(function(){
   jQuery('a').click(function(e){
       var target=this.href;
       //external
       var isexternal=target.indexOf(window.location.hostname) === -1,
            // .html & endet auf "/" ist kein download
           isdownload=target.match(/\.html/) || target.match(/\/$/)? false : true;
       
       if(isexternal){
            _gaq.push(['_trackEvent', 'External', 'Click', target]);
       }else{
           if(isdownload){
                var downloadtarget=target.replace(new RegExp('.*'+window.location.hostname+'/'),'');                              
                var extension = (/[.]/.exec(target)) ? /[^.]+$/.exec(target) : undefined;
                _gaq.push(['_trackPageview', downloadtarget]);
                _gaq.push(['_trackEvent', 'Download', 'Click - ' + extension, downloadtarget]);                
           }
       }
       
   });
});
