$(document).ready(function() {
  

  // Add pdf icons to pdf links
  $("a[href$='.pdf']:not(:has(img))").addClass("pdf");
   
  // Add txt icons to document links (doc, rtf, txt)
  $("a[href$='.doc']:not(:has(img)), a[href$='.txt']:not(:has(img)), a[href$='.rft']:not(:has(img))").addClass("txt");

// Add txt icons to pic links (png, jpg, gif, tif, eps)
//  $("a[href$='.tiff']:not(:has(img)), a[href$='.tif'], a[href$='.jpg']:not(:has(img)), a[href$='.eps']:not(:has(img)), a[href$='.gif'], a[href$='.rft']:not(:has(img))").addClass("bild");

  // Add zip icons to Zip file links (zip, rar)
  $("a[href$='.zip']:not(:has(img)), a[href$='.rar']:not(:has(img))").addClass("zip"); 
  
// Add pdf icons to xlslinks
  $("a[href$='.xls']:not(:has(img))").addClass("xls");

  // Add email icons to email links
  $("a[href^='mailto:']:not(:has(img))").addClass("email");

// Add icons to internal  file links (php, html)
  $(".m a[href$='.php']:not(:has(img)), .m a[href$='.html']:not(:has(img)), .r a[href$='.php']:not(:has(img)), .r a[href$='.html']:not(:has(img))")
.addClass("internal");



  


  //Add external link icon to external links - 
$('a').not('a:has(img)').filter(function()   
//$('a:not(:has(img)').filter(function() 
{
    //Compare the anchor tag's host name with location's host name
      return this.hostname && this.hostname !== location.hostname;
    }).addClass("external")
 .attr({ target: "_blank" });


  
   
});

