$(document).ready(function() {
    $('h1.imagereplace').each(function() {
      string = $(this).text();
      filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g,'');
      $(this).html('<img src="images/' + filename + '.jpg" alt="' + string + '" />');
    });
});