<?xml version="1.0"?>

<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN" "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<overlay id="helpOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<!-- load some js that intercepts any onclick in the browser, and load
    external links in an external browser -->
    <script src="chrome://komodo/content/library/logging.js"        type="application/x-javascript"/>
    <script src="chrome://komodo/content/library/trace.js"          type="application/x-javascript"/>
    <script src="chrome://komodo/content/library/dialogs.js"        type="application/x-javascript"/>
    <script src="chrome://komodo/content/browse.js"                 type="application/x-javascript"/>
    <script src="chrome://komodo/content/library/windowManager.js"  type="application/x-javascript"/>

<script><![CDATA[
function onclick_handler(event) {
    if (event.target.nodeName.toLowerCase() != "a") {
        return;
    }

    var target = event.target.getAttribute("target");
    var url = event.target.getAttribute("href");
    if (url && (target == "_blank"
                // Not all of the Komodo docs external links specify
                // target="_blank".
                || url.match(/^\w+:\/\//)))
    {
        ko.browse.openUrlInDefaultBrowser(url);
        event.stopPropagation();
        event.preventDefault();
        event.cancelBubble = true;
    }
}

window.addEventListener("click", onclick_handler, true);
]]></script>

</overlay>
