// NOTE: this file must be immediately proceeded by jquery.min.js

// http://blog.nemikor.com/2009/10/03/using-multiple-versions-of-jquery/

// save this jQuery version and revert control of "$" and "jQuery"
//NOT HIGH CONFLICT var jQuery_1_3_2 = $.noConflict(true);

// wrap in anonymous function so $ can be used within scope
//NOT HIGH CONFLICT (function($){

    // run when document ready
    $(function(){
    
        // adapted from http://drupal.org/project/google_analytics
        // Attach onclick event to all links.
        $('a').click( function() {
            var trackDownloadExtensions = "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zi";
            // Expression to check for absolute internal links.
            var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
            // Expression to check for download links.
            var isDownload = new RegExp("\\.(" + 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 (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 ($(this).is("a[href^=mailto:]")) {
                        // Mailto link clicked.
                        pageTracker._trackEvent("Mails", "Click", this.href.substring(7));
                    }
                    else {
                        // External link clicked.
                        pageTracker._trackEvent("Outgoing links", "Click", this.href);
                    }
                }
            } catch(err) {}
        });
        
    });
    
//NOT HIGH CONFLICT })(jQuery_1_3_2);

