function paintBetaRibbon() {
    var host = location.host;
    var loc = location.pathname+"";
    levels=loc.split("/");
    rel="";
    for ( i=0; i<levels.length -3;i++) {
      rel=rel+"../";
    }
    rel = (rel=="") ? "/" : rel;
    if (! (host == "hmpdacc.org" || host == "www.hmpdacc.org")) {
        var docfrag=document.createDocumentFragment()
        var betaDiv=document.createElement("div")
        var imgElement=document.createElement("img")
        imgElement.setAttribute("src", rel+"images/beta.gif")
        imgElement.setAttribute("width", "134")
        imgElement.setAttribute("height", "134")

        betaDiv.appendChild(imgElement);
        betaDiv.id = 'beta'; 
        betaDiv.style.float = "left";
        betaDiv.style.position = "absolute";
        betaDiv.style.left = "0";
        betaDiv.style.top = "0";
        betaDiv.style.zIndex = 111;
        docfrag.appendChild(betaDiv); 
       document.getElementById("page_container").appendChild(docfrag)
    }
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(paintBetaRibbon);
