/*

    @author:        Bryan VanHaitsma
    @date:          2008-07-15
    @description:   To search for specific file types in href attributes of
                    all <a>'s on the page and append a google analytics 
                    tracking code
                    
    @note:          !!!important!!!
    
                    requires 
                    
                    1.) jQuery code to be declared before this.
                    2.) jQuery noconflict mode 
                    
                        http://docs.jquery.com/Using_jQuery_with_Other_Libraries
                    
                    3.) place this code before any other js libraries
                        ie mootools, etc.
                    4.) latest google analytics code to be declared at 
                        the <body> tag so that no code is implemented following 
                        this.
                    
*/

jQuery('document').ready(function() {    
    jQuery('a').each(function(index) {
        var href_string = jQuery(this).attr('href');
        myregexp        = /\/(.*?)\.(avi|doc|jpg|mov|mp3|mpeg|pdf|png|ppt|txt|wav|wma|wmv|xls|zip)/;          
        var the_match   = myregexp.exec(href_string);
        
        if (the_match) {
            /* alert(the_match); */
            jQuery(this).attr({"onclick": "javascript: pageTracker._trackPageview('" + the_match[0] + "');"});
        }
    });
});