function addEvent(obj,event,f)
  {
   if (obj.addEventListener)
     {
      obj.addEventListener(event,f,false);
     }  
   else if (obj.attachEvent)
     {
      obj.attachEvent("on"+event,f);
     }
  }
  
function attachOnLoad(f)
  {
   addEvent(window,"load",f);
  }

function getPageWidth()
  {
   var max = 0;

   if (document.documentElement)
     {
      max = document.documentElement.scrollWidth;
     }
   if (document.body.scrollWidth > max)
     {
      max = document.body.scrollWidth;
     }

   return max;
  }
  
function getPageHeight()
  {
   var max = 0;

   if (document.documentElement)
     {
      max = document.documentElement.scrollHeight;
     }
   if (document.body.scrollHeight > max)
     {
      max = document.body.scrollHeight;
     }
     
   return max;
  }
  
function getAvailWidth()
  {
   if (self.innerWidth) // all except Explorer
     {
      return self.innerWidth;
     }
   else if (document.documentElement && document.documentElement.clientWidth) // Explorer 6 Strict Mode
     {
      return document.documentElement.clientWidth;
     }
   else if (document.body) // other Explorers
     {
      return document.body.clientWidth;
     }
  }
  
function getAvailHeight()
  {
   if (self.innerHeight) // all except Explorer
     {
      return self.innerHeight;
     }
   else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
     {
      return document.documentElement.clientheight;
     }
   else if (document.body) // other Explorers
     {
      return document.body.clientHeight;
     }
  }
