
jQuery(document).ready(function() {
	var fileTypes = ['doc','xls','pdf','mp3'];
	$('a').each(function() {
	  var $a = $(this);
	  var href = $a.attr('href');
	  // see if the link is external
	  if ( (href.match(/^http/)) && (! href.match(document.domain)) ) {
	 
	    // if so, add the GA tracking code
	    $a.click(function() {
	      pageTracker._trackPageview('/outbound/' + href);
	    });
	  }
	  else{
		  // perhaps it's an internal link to a download
		  var hrefArray = href.split('.');
		  var extension = hrefArray[href.length - 1];
		 
		  if ($.inArray(extension,fileTypes) != -1) {
		    $a.click(function() {
		      // get the post title if there is one
		      // and add it to the string for tracking
		      pageTracker._trackPageview('/downloads/' + href);
		    });
		  }
	  }
	});
});