function getViewportHeight() { var height = self.innerHeight; // Safari, Opera var mode = document.compatMode; if ( (mode || $.browser.msie) && !$.browser.opera ) { // IE, Gecko height = (mode == 'CSS1Compat') ? document.documentElement.clientHeight : // Standards document.body.clientHeight; // Quirks } return height; } function getViewportWidth() { var width = self.innerWidth; // Safari, Opera var mode = document.compatMode; if ( (mode || $.browser.msie) && !$.browser.opera ) { // IE, Gecko width = (mode == 'CSS1Compat') ? document.documentElement.clientWidth : // Standards document.body.clientWidth; // Quirks } return width; }