function addDOMFunction(func)
{
 var counter = 0, timer = setInterval(function()
 {
  var readyFlag = false;
  counter++;
  
  if (typeof document.getElementsByTagName != "undefined" && (document.getElementsByTagName("body")[0] || document.body))
  {
   readyFlag = true;
   
   if (readyFlag)
   {
    clearInterval(timer);
    func();
   }
   
  }
  
  if (counter >= 40)
  {
   clearInterval(timer);
  }
  
  return true;
 }, 250);
 
 return true;
}

function addLoadListener(func, capture)
{
 
 if (typeof window.addEventListener != "undefined")
 {
  window.addEventListener("load", func, capture);
 }
 
 else if (typeof document.addEventListener != "undefined")
 {
  document.addEventListener("load", func, capture);
 }
 
 else if (typeof window.attachEvent != "undefined")
 {
  window.attachEvent("onload", func);
 }
 
 else
 {
  
  if (typeof window.onload != "function")
  {
   window.onload = func;
  }
  
  else
  {
   var oldFunc = window.onload;
   
   window.onload = function()
   {
    oldFunc();
    func();
    
    return true;
   };
   
  }
  
 }
 
 return true;
}