window.onload = function () {
  var a = document.getElementsByTagName('a');

  for (i in a) {
    if (a[i].className === 'mOver') {
      a[i].onmouseover = function () {
        this.firstChild.src = this.firstChild.src.replace("_a.", "_b.");
	  }
      a[i].onmouseout = function () {
        this.firstChild.src = this.firstChild.src.replace("_b.", "_a.");
	  }
    }
  }
};


/*
 * Override JavaScripts' builtin typeOf function,
 * adds proper handling for Array and Null objects.
 */
function typeOf(val)
{
  var s = typeof val;
  if (s === 'object') {
    if (val) {
      if (typeof val.length === 'number' &&
         !(val.propertyIsEnumerable('length')) &&
         typeof val.splice === 'function')
        s = 'array';
    } else {
      s = 'null';
    }
  }
  return s;
}

/*
 * Provides a way to determine if an object has enumerable members
 */
function isEmpty(o)
{
  var retval = true;
  if (typeOf(o) === 'object') {
    for (var i in o) {
      var v = o[i];
      if (v !== undefined && typeOf(v) !== 'function') {
        retval = false;
      }
    }
  }
  return retval;
}

String.prototype.entityify = function () {
  return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
};

String.prototype.quote = function () {
  var l = this.length, o = '"';
  for (var i = 0; i < l; i++) {
    var c = this.charAt(i);
    if (c >= ' ') {
      if (c === '\\' || c === '"')
        o += '\\';
      o +=c;
    } else {
      switch (c) {
        case '\b':
          o += '\\b';
          break;
        case '\f':
          o += '\\f';
          break;
        case '\n':
          o += '\\n';
          break;
        case '\r':
          o += '\\r';
          break;
        case '\t':
          o += '\\t';
          break;
        default:
          c = c.charCodeAt();
          o += '\\u00' + Math.floor(c/16).toString(16) + (c % 16).toString(16);
      }
    }
  }
  return o + '"';
};

/*
 * facilitates variable substitution for strings.
 *
 */
String.prototype.supplant = function (o) {
  return this.replace(/{([^{}]*)}/g, function (a, b) {
    var r = o[b];
    return typeof r === 'string' || typeof r === 'number' ? r : a;
  });
};

String.prototype.trim = function () {
  return this.replace(/^\s+|\s+$/g, '');
};

