function getAvailableHeight() {
   if (typeof window.innerHeight != 'undefined') {
      return window.innerHeight; 
   } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0) {
      return document.documentElement.clientHeight;
   } else if (document.getElementsByTagName('body') != 'undefined' && document.getElementsByTagName('body').clientHeight != 'undefined') {
      return document.getElementsByTagName('body')[0].clientHeight;      
   } else {
      return screen.availHeight - 160;
   }
}

function getAvailableWidth() {
   if (typeof window.innerWidth != 'undefined') {
      return window.innerWidth;
   } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
      return document.documentElement.clientWidth;
   } else if (document.getElementsByTagName('body') != 'undefined' && document.getElementsByTagName('body').clientWidth != 'undefined') {
      return document.getElementsByTagName('body')[0].clientWidth;      
   } else {
      return screen.availWidth - 30;
   }
}
