
/* ============================================================================== */

function getWindowSize () {
  /* Code inspired from :
     http://forum.alsacreations.com/topic-5-24607-2-Fenetre-pop-up-en-Ajax.html
  */

  var db=(document.documentElement.clientWidth)?document.documentElement:document.body;  
  var windowWidth = (window.innerWidth)? window.innerWidth : db.clientWidth;
  var windowHeight = (window.innerHeight)? window.innerHeight: db.clientHeight;
  return {'width': windowWidth, 'height': windowHeight};
}


/* ============================================================================== */

function getWindowScroll () {
  /* Code inspired from :
     http://13thparallel.com/archive/viewport/
  */

  var scrollX = 0;
  var scrollY = 0;

  if( document.documentElement && document.documentElement.scrollTop ) {
    scrollX = document.documentElement.scrollLeft;
    scrollY = document.documentElement.scrollTop;
  }
  else if( document.body && document.body.scrollTop ) {
    scrollX = document.body.scrollLeft;
    scrollY = document.body.scrollTop;
  }
  else if( window.pageYOffset ) {
    scrollX = window.pageXOffset;
    scrollY = window.pageYOffset;
  }
  else if( window.scrollY ) {
    scrollX = window.scrollX;
    scrollY = window.scrollY;
  }

  return {'scrollX': scrollX, 'scrollY': scrollY};
}


/* ============================================================================== */

function asdebug (txt) {
  var debug = document.getElementById('asdebug');
  if(debug && txt) {
    debug.innerHTML = txt;
  }
}
