//.........................................................................................
//  File: RjScreen.js                                                Date:  Nov 14, 2008
//                            Application: Javascript Tools
//  Author: R. Berry
//
//  Functions:
//              getInnerDimensions()
//              getInnerWidth()
//              getInnerHeight()
//
//  Copyright 2008-2009 (c) Rawdon Berry
//
//  Modified: Apr 16 2009 to use window.RjScreen.isIE
//            Sep  6 2009 to use offsetWidth/offsetHeight rather than clientWidth/offsetHeight
//                        because offsetWidth/Height is compatible with innerWidth/Height
//                        whereas clientWidth/Height exclude the scroll bars if present
//.........................................................................................

//  Returns an object with the browser window area's innerWidth and innerHeight
//
function getInnerDimensions()
{
  if (typeof(window.RjScreen)=='undefined')
    window.RjScreen = { isIE: ((typeof( window.innerWidth ) != 'number') ? true : false) };
  else
  {
    if (typeof(window.RjScreen.isIE)=='undefined')
      window.RjScreen.isIE = (typeof( window.innerWidth ) != 'number') ? true : false;
  }

  var w = 0,
      h = 0;

  if (!window.RjScreen.isIE)
  { // Decent browser
    w = window.innerWidth;
    h = window.innerHeight;
  }
  else
  { // Of course, IE doesn't do innerWidth
    if ( document.documentElement && ( document.documentElement.offsetWidth || document.documentElement.offsetHeight ) )
    { //IE 6+ in 'standards compliant mode'
      w = document.documentElement.offsetWidth;
      h = document.documentElement.offsetHeight;
    }
    else
    {
      if ( document.body && ( document.body.offsetWidth || document.body.offsetHeight ) )
      { //IE 4 compatible
        w = document.body.offsetWidth;
        h = document.body.offsetHeight;
      }
    }
  }
  return( { innerWidth: w, innerHeight: h } );
}
function getInnerWidth()
{
  if (typeof(window.RjScreen)=='undefined')
    window.RjScreen = { isIE: ((typeof( window.innerWidth ) != 'number') ? true : false) };
  else
  {
    if (typeof(window.RjScreen.isIE)=='undefined')
      window.RjScreen.isIE = (typeof( window.innerWidth ) != 'number') ? true : false;
  }

  if (!window.RjScreen.isIE)
  { // Decent browser
    return(window.innerWidth);
  }
  // Of course, IE doesn't do innerWidth
  if ( document.documentElement && ( document.documentElement.offsetWidth || document.documentElement.offsetHeight ) )
  { //IE 6+ in 'standards compliant mode'
    return(document.documentElement.offsetWidth);
  }
  if ( document.body && ( document.body.offsetWidth || document.body.offsetHeight ) )
  { //IE 4 compatible
    return(document.body.offsetWidth);
  }
  return(0);
}
function getInnerHeight()
{
  if (typeof(window.RjScreen)=='undefined')
    window.RjScreen = { isIE: ((typeof( window.innerWidth ) != 'number') ? true : false) };
  else
  {
    if (typeof(window.RjScreen.isIE)=='undefined')
      window.RjScreen.isIE = (typeof( window.innerWidth ) != 'number') ? true : false;
  }

  if (!window.RjScreen.isIE)
  { // Decent browser
    return(window.innerHeight);
  }
  // Of course, IE doesn't do innerHeight
  window.RjScreen.isIE = true;
  if ( document.documentElement && ( document.documentElement.offsetWidth || document.documentElement.offsetHeight ) )
  { //IE 6+ in 'standards compliant mode'
    return(document.documentElement.offsetHeight);
  }
  if ( document.body && ( document.body.offsetWidth || document.body.offsetHeight ) )
  { //IE 4 compatible
    return(document.body.offsetHeight);
  }
  return(0);
}

