$(document).ready(function() {

  // Add target="_blank" to all links with class external
  $("a.external").attr("target", "_blank");

  // Add spam protection to all mailto links
  $("span.nospam").each(function(index) {
    var _mail = ($("span.u", this).text() +
        "@" +
        $("span.d", this).text())
        .replace(/\s+/g, "")
        .replace(/\[dot\]/g, ".");
    $(this).after(
        $("<a></a>")
        .attr("href", "mailto:" + _mail)
        .html(_mail)
        .addClass("nospam")
    ).remove();
  });

  // Add overlay function to contact images
  $(".contact").hover(function() {
    $(".overlay", this).hide();
  }, function() {
      $(".overlay", this).show();
  });

});
