/*
 * Optimaster Framework - General Scripts
 * Copyright (C) 2010-2011 Krisztian Kocsis, Optimaster <krisztian.kocsis@optimaster.eu>
 * All rights reserved.
 */

function omTrimString(string) {
  var string = string.replace(/^\s\s*/, '');
  var matcher = /\s/;
  var index = string.length;

  while (matcher.test(string.charAt(--index)));

  return string.slice(0, index + 1);
}

function omRegisterExternalLinkHandlers() {
  var anchors = document.getElementsByTagName("a");

  for (var index = 0; index < anchors.length; index++) {
    var anchor = anchors[index];

    if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "external")) {
      anchor.onclick = function() {
        window.open(anchor.href, "_blank");
        return false;
      };
    }
  }
}

