docs: function (w, h, stage_elem) {
              Crafty.DOM.window.init();
  
              //fullscreen if mobile or not specified
              this.width = (!w || Crafty.mobile) ? Crafty.DOM.window.width : w;
              this.height = (!h || Crafty.mobile) ? Crafty.DOM.window.height : h;
  
              //check if stage exists
              if(typeof stage_elem === 'undefined')
                  stage_elem = "cr-stage";
  
              var crstage;
              if(typeof stage_elem === 'string')
                  crstage = document.getElementById(stage_elem);
              else if(typeof HTMLElement !== "undefined" ? stage_elem instanceof HTMLElement : stage_elem instanceof Element)
                  crstage = stage_elem;
              else
                  throw new TypeError("stage_elem must be a string or an HTMLElement");
  
              /**@
               * #Crafty.stage
               * @category Core
               * The stage where all the DOM entities will be placed.
               */
  
              /**@
               * #Crafty.stage.elem
               * @comp Crafty.stage
               * The `#cr-stage` div element.
               */
  
              /**@
               * #Crafty.stage.inner
               * @comp Crafty.stage
               * `Crafty.stage.inner` is a div inside the `#cr-stage` div that holds all DOM entities.
               * If you use canvas, a `canvas` element is created at the same level in the dom
               * as the the `Crafty.stage.inner` div. So the hierarchy in the DOM is
               * 
               * `Crafty.stage.elem`
               * <!-- not sure how to do indentation in the document-->
               *
               *     - `Crafty.stage.inner` (a div HTMLElement)
               *
               *     - `Crafty.canvas._canvas` (a canvas HTMLElement) 
               */
  
              //create stage div to contain everything
              Crafty.stage = {
                  x: 0,
                  y: 0,
                  fullscreen: false,
                  elem: (crstage ? crstage : document.createElement("div")),
                  inner: document.createElement("div")
              };
  
              //fullscreen, stop scrollbars
              if ((!w && !h) || Crafty.mobile) {
                  document.body.style.overflow = "hidden";
                  Crafty.stage.fullscreen = true;
              }
  
              Crafty.addEvent(this, window, "resize", Crafty.viewport.reload);
  
              Crafty.addEvent(this, window, "blur", function () {
                  if (Crafty.settings.get("autoPause")) {
                      if(!Crafty._paused) Crafty.pause();
                  }
              });
              Crafty.addEvent(this, window, "focus", function () {
                  if (Crafty._paused && Crafty.settings.get("autoPause")) {
                      Crafty.pause();
                  }
              });
  
              //make the stage unselectable
              Crafty.settings.register("stageSelectable", function (v) {
                  Crafty.stage.elem.onselectstart = v ? function () { return true; } : function () { return false; };
              });
              Crafty.settings.modify("stageSelectable", false);
  
              //make the stage have no context menu
              Crafty.settings.register("stageContextMenu", function (v) {
                  Crafty.stage.elem.oncontextmenu = v ? function () { return true; } : function () { return false; };
              });
              Crafty.settings.modify("stageContextMenu", false);
  
              Crafty.settings.register("autoPause", function (){ });
              Crafty.settings.modify("autoPause", false);
  
              //add to the body and give it an ID if not exists
              if (!crstage) {
                  document.body.appendChild(Crafty.stage.elem);
                  Crafty.stage.elem.id = stage_elem;
              }
  
              var elem = Crafty.stage.elem.style,
                  offset;
  
              Crafty.stage.elem.appendChild(Crafty.stage.inner);
              Crafty.stage.inner.style.position = "absolute";
              Crafty.stage.inner.style.zIndex = "1";
  
              //css style
              elem.width = this.width + "px";
              elem.height = this.height + "px";
              elem.overflow = "hidden";
  
              if (Crafty.mobile) {
                  elem.position = "absolute";
                  elem.left = "0px";
                  elem.top = "0px";
  
                  // remove default gray highlighting after touch
                  if (typeof elem.webkitTapHighlightColor != undefined) {
                      elem.webkitTapHighlightColor = "rgba(0,0,0,0)";
                  }
  
                  var meta = document.createElement("meta"),
                      head = document.getElementsByTagName("HEAD")[0];
  
                  //stop mobile zooming and scrolling
                  meta.setAttribute("name", "viewport");
                  meta.setAttribute("content", "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no");
                  head.appendChild(meta);
  
                  //hide the address bar
                  meta = document.createElement("meta");
                  meta.setAttribute("name", "apple-mobile-web-app-capable");
                  meta.setAttribute("content", "yes");
                  head.appendChild(meta);
                  setTimeout(function () { window.scrollTo(0, 1); }, 0);
  
                  Crafty.addEvent(this, window, "touchmove", function (e) {
                      e.preventDefault();
                  });
  
                  Crafty.stage.x = 0;
                  Crafty.stage.y = 0;
  
              } else {
                  elem.position = "relative";
                  //find out the offset position of the stage
                  offset = Crafty.DOM.inner(Crafty.stage.elem);
                  Crafty.stage.x = offset.x;
                  Crafty.stage.y = offset.y;
              }
  
              if (Crafty.support.setter) {
                  //define getters and setters to scroll the viewport
                  this.__defineSetter__('x', function (v) { this.scroll('_x', v); });
                  this.__defineSetter__('y', function (v) { this.scroll('_y', v); });
                  this.__defineGetter__('x', function () { return this._x; });
                  this.__defineGetter__('y', function () { return this._y; });
                  //IE9
              } else if (Crafty.support.defineProperty) {
                  Object.defineProperty(this, 'x', { set: function (v) { this.scroll('_x', v); }, get: function () { return this._x; } });
                  Object.defineProperty(this, 'y', { set: function (v) { this.scroll('_y', v); }, get: function () { return this._y; } });
              } else {
                  //create empty entity waiting for enterframe
                  this.x = this._x;
                  this.y = this._y;
                  Crafty.e("viewport");
              }
          }