/*-------------------------------------------------+
| Adds classes to common document links for icons.|
| Requires jQuery                                 |
+-------------------------------------------------*/

(function ($) {
    $(document).ready(function () {
        $("a[href$='.doc']:not(a.imglink, a.action)").addClass("icon icon-doc");
        $("a[href$='.doc']").attr({ title: "Word document - Opens in a new window" });
      
        $("a[href$='.pdf']:not(a.imglink, a.action)").addClass("icon icon-pdf");
        $("a[href$='.pdf']").attr({ title: "Adobe PDF - Opens in a new window" });
      
        $("a[href$='.ppt']:not(a.imglink, a.action)").addClass("icon icon-ppt");
        $("a[href$='.ppt']").attr({ title: "PowerPoint presentation - Opens in a new window" });
      
        $("a[href$='.xls']:not(a.imglink, a.action)").addClass("icon icon-xls");
        $("a[href$='.xls']").attr({ title: "Excel spreadsheet - Opens in a new window" });
      
        $("a[href$='.zip']:not(a.imglink, a.action)").addClass("icon icon-zip");
        $("a[href$='.zip']").attr({ title: "ZIP file - Opens in a new window" });
        $("a[href$='.rar']").attr({ title: "RAR file - Opens in a new window" });
      
      	// Make links to files open in new windows
        $("a[href$='.doc'], a[href$='.pdf'], a[href$='.xls'], a[href$='.zip'], a[href$='.rar']").attr({ target: "_blank" });
    });
})(jQuery);
