$.fn.autoLink = function() {
  this.contents()
    .filter(function() { return this.nodeType === 3})
    .each(function(i, node) {
      if (node.nodeValue.match(/https?:/)) {
        $(node).replaceWith(
          node.nodeValue.replace(/(https?:\/\/\S+)/g, "<a href=\"$1\">$1</a>")
        );
      }
    }
  );
  return this;
}

$(function(){
	$('.classad').autoLink();
	
	var regEx = /(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)/;
 
    $(".classad").filter(function() {
        return $(this).html().match(regEx);
    }).each(function() {
        $(this).html($(this).html().replace(regEx, "<a href=\"mailto:$1\">$1</a>"));
    });
});
