/*
 * This function will process all anchors in the document and
 * sets the target to '_blank' for all of them that have a href
 * attribute and that have a rel attribute set to 'external'. 
 */
function processExternalAnchors() {
  if (! document.getElementsByTagName) return;

  var anchors = document.getElementsByTagName("a");
  for (var i = 0; i < anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external") {
      anchor.target = "_blank";
    }
  }
}

createExcerpt = function(s, start, end) {
  var re = new RegExp( '^([\\s\\S]){'+start+','+end+'}([\\s\\.])' );
  var excerpt = s.match(re);
  return excerpt[0]+'...';
}

