var Window = require('./Window');
var Header = require('./Header');
var mkelm = require('../util/mkelm');


module.exports = WM;

var containerStyle = [
  'height: 100%',
  'display: flex',
  'flexWrap: wrap'
].join(';');


function WM () {
  if (!(this instanceof WM)) return new WM();

  this.container = mkelm('div', containerStyle);

  var body = document.body;
  body.appendChild(this.container);
  body.appendChild(new Header());

  this.windows = [];
}

WM.prototype.create = function (contents) {
  var win = new Window(contents)
  this.windows.push(win);
  document.body.appendChild(win);

  return win;
}

