$(document).ready(function() {
    /*
    Add an image for external links or links to downloadable documents 
    */
    var fileTypes = {
      pdf: 'pdf.gif',
      html: 'html.gif',
      htm: 'html.gif'
    };
     
    $('.newsletter-download ul li a').each(function() {
     
      var $a = $(this);
      var href = $a.attr('href');
 /*
      if (
        (href.match(/^http/)) &&
        (! href.match(document.domain))
      ) {
     
        // use a special image for external links
        var image = 'external.gif';
     
      } else {
*/
        // get the extension from the href
        var hrefArray = href.split('.');
        var extension = hrefArray[hrefArray.length - 1];
     
        var image = fileTypes[extension];
      //}
     
        if (image) {
        $a.css({
            'padding':'0 0 0 20px',
            'margin':'0 0 8px 0',
            'display':'block',
            'background':'transparent url(/fileadmin/layouts/main/public/gfx/download-icons/' + image + ') no-repeat left 2px',
            'line-height':'180%'
        });
        $a.parent().css({
            'list-style-image':'none'
        });
        $a.parent().parent().css({'padding':'0'});
      }
     
    });

        
});

