/************************************************************************* dw_viewport.js version date July 2003 This code is from Dynamic Web Coding at http://www.dyn-web.com/ Copyright 2003 by Sharon Paine See Terms of Use at http://www.dyn-web.com/bus/terms.html Permission granted to use this code as long as this entire notice is included. Example usage (after body tag or after page loaded): viewport.getWinWidth(); alert(viewport.width) *************************************************************************/ 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(); } }