
// ======================================================================
//
//   XXX   XXX  XXXX  XXX XXXX  XXXXX  XXX
//  X   X X   X X   X  X  X   X X X X X   X
//  X     X     X   X  X  X   X   X   X
//   XXX  X     XXXX   X  XXXX    X    XXX
//      X X     X  X   X  X       X       X
//  X   X X   X X   X  X  X       X   X   X
//   XXX   XXX  X   X XXX X       X    XXX
//
// ======================================================================

String.prototype.trim = function() {
  return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, ""));
}

String.prototype.startsWith = function(str) {
  return (this.match("^" + str) == str);
}

String.prototype.endsWith = function(str) {
  return (this.match(str + "$") == str);
}

// ======================================================================
//
//  XXXX   XXX  XXXX  X   X XXXX   XXX
//  X   X X   X X   X X   X X   X X   X
//  X   X X   X X   X X   X X   X X
//  XXXX  X   X XXXX  X   X XXXX   XXX
//  X     X   X X     X   X X         X
//  X     X   X X     X   X X     X   X
//  X      XXX  X      XXX  X      XXX
//
// ======================================================================

function createPopup(width, height, resizable, scrollbars) {
  var popup = window.open("", "", "menubar=no,resizable="
    + resizable + ",scrollbars=" + scrollbars
    + ",width=" + width + ",height=" + height);
  return popup;
}

// ======================================================================
// show image
// ======================================================================

function showImage(image, width, height) {
  var popup = createPopup(width, height, "no", "no");
  var html = "<html><head><title>Epixx.org</title>"
  + "</head><body scroll=no><img style=position:absolute;"
  + "left:0px;top:0px; src=" + image + "></body></head><html>";
  popup.document.open();
  popup.document.write(html);
  popup.document.close();
}

