// $Id: googleanalytics.js,v 1.3.2.8 2009/03/04 07:25:47 hass Exp $

Drupal.behaviors.gaTrackerAttach = function(context) {

  // Attach onclick event to all links.
  $('a', context).click( function() {
    var ga = Drupal.settings.googleanalytics;
    // Expression to check for absolute internal links.
    var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
    // Expression to check for special links like gotwo.module /go/* links.
    var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
    // Expression to check for download links.
    var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");

    try {
      // Is the clicked URL internal?
      if (isInternal.test(this.href)) {
        // Is download tracking activated and the file extension configured for download tracking?
        if (ga.trackDownload && isDownload.test(this.href)) {
          // Download link clicked.
          var extension = isDownload.exec(this.href);
          pageTracker._trackEvent("Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, ''));
        }
        else if (isInternalSpecial.test(this.href)) {
          // Keep the internal URL for Google Analytics website overlay intact.
          pageTracker._trackPageview(this.href.replace(isInternal, ''));
        }
      }
      else {
        if (ga.trackMailto && $(this).is("a[href^=mailto:]")) {
          // Mailto link clicked.
          pageTracker._trackEvent("Mails", "Click", this.href.substring(7));
        }
        else if (ga.trackOutgoing) {
          // External link clicked.
          pageTracker._trackEvent("Outgoing links", "Click", this.href);
        }
      }
    } catch(err) {}
  });
}
;// $Id: jquery_popupwindow.drupal.js,v 1.1.2.3 2009/10/15 14:44:38 aaron Exp $

/**
 * Set specified links to popup with the preset settings.
 */
Drupal.behaviors.jqueryPopupWindow = function (context) {
  // Loop through each preset selector.
  for (preset in Drupal.settings.jqueryPopupwindowPresets) {
    // Only process a preset selector if we haven't already.
    $(Drupal.settings.jqueryPopupwindowPresets[preset]['preset'], context).addClass('jqueryPopupwindowProcessed').each(function() {
      // Create an array suitable for the popupwindow function.
      popup_options = Drupal.settings.jqueryPopupwindowPresets[preset]['options'];
      settings = new Array();
      settings[preset] = popup_options;

      // Create the popup window behavior.
      $(this).attr('rel', preset).popupwindow(settings);
    })
  }
}
;