viewport = {
  getIECanvas: function () {
    var canv = null;
    if (!window.opera && document.all && typeof document.body.clientWidth != "undefined") {
      var cm = document.compatMode && document.compatMode == "CSS1Compat";
      canv = cm? document.documentElement: document.body;
    } 
      return canv;
  },
  
  getWinWidth: function () {
    var canv;
    if ( canv = this.getIECanvas() ) this.width = canv.clientWidth;
    else this.width = window.innerWidth - 18;
  },
  
  getWinHeight: function () {
    var canv;
    if ( canv = this.getIECanvas() ) this.height = canv.clientHeight;
    else this.height = window.innerHeight - 18;
  },
  
  getScrollX: function () {
    var canv;
    if ( canv = this.getIECanvas() ) this.scrollX = canv.scrollLeft;
    else if (window.pageXOffset) this.scrollX = window.pageXOffset;
    else if (window.scrollX) this.scrollX = window.scrollX;
    else this.scrollX = 0;
  },
  
  getScrollY: function () {
    var canv;
    if ( canv = this.getIECanvas() ) this.scrollY = canv.scrollTop;
    else if (window.pageYOffset) this.scrollY = window.pageYOffset;
    else if (window.scrollY) this.scrollY = window.scrollY;
    else this.scrollY = 0;
  },
  
  getAll: function () {
    this.getWinWidth();   this.getWinHeight();
    this.getScrollX(); this.getScrollY();
  }
  
}
