/*
These next three functions will find the width and height of the viewport, which is that part of the web browser that displays the web page, as opposed to the screen size, and call an image with a querystring indicating the viewport width and height so a set of measurements can be compiled.
*/

function getViewportWidth() {
  var width = 0;
  if (self.innerWidth) {
    width = self.innerWidth;
  }
  else if( document.documentElement && document.documentElement.clientWidth ) {
    width = document.documentElement.clientWidth;
  }
  else if( document.body && document.body.clientWidth ) {
    width = document.body.clientWidth;
  }
  else if( window.innerWidth ) {
    width = window.innerWidth - 18;
  }
  return width;
};
function getViewportHeight() {
  var height = 0;
  if (self.innerHeight) {
    height = self.innerHeight;
  }
    else if( document.documentElement && document.documentElement.clientHeight ) {
    height = document.documentElement.clientHeight;
  }
  else if( document.body && document.body.clientHeight ) {
    height = document.body.clientHeight;
  }
  else if( window.innerHeight ) {
    height = window.innerHeight - 18;
  }
  return height;
};
function recViewportSize_old () {
   var imgtag = "<img src='/IMAGES/viewport.gif?vw=" + getViewportWidth() + "&vh=" + getViewportHeight() + "&screenw=" + window.screen.width + "&screenh=" + window.screen.height + "' width='1' height='1' alt='' border='0' />";
   return imgtag;
};
function recViewportSize() {
	var myAjax = new Ajax.Request('vp.php',{parameters: 'viewportw='+getViewportWidth()+'&viewporth='+getViewportHeight()+"&screenw=" + window.screen.width + "&screenh=" + window.screen.height});
}
