function axpopup() {
 var thref = document.activeElement.getAttribute("href");
 var turl = location.protocol + "//" + location.host + "/common/popup.html?" + thref;
 window.open(turl, "axpopup", "width=480,height=280,scrollbars=1,resizable=1,toolbar=0,menubar=0,location=0,directions=0,status=0");
 return false;
}

var addedPopup = false;
function addPopup() {
 var turl = location.protocol + "//" + location.host;
 var turl_n = turl.length;
 var oElements = document.getElementsByTagName("a");
 var n = oElements.length;
 for(i = 0; i < oElements.length; i++) {
  oElement = oElements[i];
  if (oElement.getAttribute("href").substring(0, turl_n) != turl) {
   oElement.setAttribute("onclick", axpopup);
  }
 }
 addedPopup = true;
}

var readyBound = false;
function bindReady(){
 if ( readyBound ) return;
 readyBound = true;

 // Mozilla, Opera and webkit nightlies currently support this event
 if ( document.addEventListener ) {
  // Use the handy event callback
  document.addEventListener( "DOMContentLoaded", function(){
   document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
   addPopup();
  }, false );

 // If IE event model is used
 } else if ( document.attachEvent ) {
  document.attachEvent("onreadystatechange", function(){
   if ( document.readyState === "complete" ) {
    document.detachEvent( "onreadystatechange", arguments.callee );
    addPopup();
   }
  });

  // If IE and not an iframe
  if ( document.documentElement.doScroll && window == window.top ) (function(){
   if ( addedPopup ) return;

   try {
    // If IE is used, use the trick by Diego Perini
    document.documentElement.doScroll("left");
   } catch( error ) {
    setTimeout( arguments.callee, 0 );
    return;
   }

   // and execute any waiting functions
   addPopup();
  })();
 }

 // A fallback to window.onload, that will always work
 window.onload = addPopup;
}

//bindReady();

