if (window.jQuery)
// Replace outbound links  
jQuery(function($) {
  $('a').each(function() {
      var href = $(this).attr('href');
      if(typeof href == "undefined") return;
      if (href.match(/^http/) && !href.match(document.domain)) {
          $(this).click(function() {
              if (typeof window.pageTracker != "undefined")
                  pageTracker._trackPageview('/outgoing/' + href);
              else if(typeof _gaq != "undefined") 
                  _gaq.push(['_trackPageview', '/outgoing/' + href]);
          });
      }
  });
  $('form').each(function() {
      var href = $(this).attr('action');
      if(typeof href == "undefined") return;
      if (href.match(/^http/) && !href.match(document.domain)) {
          $(this).submit(function() {
            var fields = $(this).serialize() ? $(this).serialize() : "";               
              if (typeof window.pageTracker != "undefined")
                  pageTracker._trackPageview('/outgoing/' + href + "?" + fields);
              else if (typeof _gaq != "undefined")
                  _gaq.push(['_trackPageview', '/outgoing/' + href + "?" + fields]);                  
          });
      }
  });
});
