/*

    @author:        Bryan VanHaitsma
    @date:          2008-06-18
    @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 jquery code to be declared before this.
                    
                    requires latest google analytics code to be declared at 
                    the <body> tag so that no code is implemented following 
                    this.
                    
*/

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