| 
		
			Сообщение от B~Vladi
			
		
	 | 
	| 
		если у Вас есть что-то конкретное - говорите...
	 | 
	
prototype.1.6.1_rc2.js
str 3093
document.viewport = {
  getDimensions: function() {
    return { width: this.getWidth(), height: this.getHeight() };
  },
  getScrollOffsets: function() {
    return Element._returnOffset(
      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
      window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop);
  }
};
(function(viewport) {
  var B = Prototype.Browser, doc = document, element, property = {};
  function getRootElement() {
    if (B.WebKit && !doc.evaluate)
      return document;
    if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
      return document.body;
    return document.documentElement;
  }
  function define(D) {
    if (!element) element = getRootElement();
    property[D] = 'client' + D;
    viewport['get' + D] = function() { return element[property[D]] };
    return viewport['get' + D]();
  }
  viewport.getWidth  = define.curry('Width');
  viewport.getHeight = define.curry('Height');
})(document.viewport);
Единственный минус: не учитывается compatMode. Но это сейчас уже не столь актуально.