<?xml version="1.0"?> 
<?xml-stylesheet href="xul.css" type="text/css"?> 

<!DOCTYPE window
[
<!ENTITY unknownWindow.title "Unknown File Type"> 
<!ENTITY startDownload "You have started to download a file of type">
<!ENTITY contentType.label "contentType goes here"> 
<!ENTITY dialogMore.label "More Info..."> 
<!ENTITY dialogPick.label "Pick App..."> 
<!ENTITY dialogSave.label "Save File..."> 
<!ENTITY dialogCancel.label "Cancel"> 

]> 

<window xmlns:html="http://www.w3.org/TR/REC-html40"
		xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        title="&unknownWindow.title;"
        width="425"
        height="180">

    <data>
        <broadcaster id="data.location" type="url" value="url...to be replaced"/>
        <broadcaster id="data.contentType" type="string" value="content-type...to be replaced"/>
        <!-- Commands: more/pick/save/close -->
        <broadcaster id="data.execute" command=""/>
        <!-- Temporary onLoad() trigger -->
        <broadcaster id="dialog.start" ready="false"/>
        <observes element="dialog.start" attribute="ready" onchange="onLoad()"/>
    </data>

    <html:script>
        var data;
        var dialog;

        function initData() {
            // Create data object and initialize.
            data = new Object;
            data.location      = document.getElementById("data.location");
            data.contentType   = document.getElementById("data.contentType");
            data.execute       = document.getElementById("data.execute");
        }

        function initDialog() {
            // Create dialog object and initialize.
            dialog = new Object;
            dialog.contentType = document.getElementById("dialog.contentType");
            dialog.more        = document.getElementById("dialog.more");
            dialog.pick        = document.getElementById("dialog.pick");
            dialog.save        = document.getElementById("dialog.save");
            dialog.cancel      = document.getElementById("dialog.cancel");
        }

        function loadDialog() {
            // Set initial dialog field contents.
            dialog.contentType.childNodes[0].nodeValue = " " + data.contentType.getAttribute( "value" );
        }

        function onLoad() {
            // Init data.
            initData();

            // Init dialog.
            initDialog();

            // Fill dialog.
            loadDialog();
        }

        function more() {
            // Have C++ code go to appropriate web page.
            data.execute.setAttribute("command","more");
        }

        function pick() {
            // Have C++ code prompt user for app and run it.
            data.execute.setAttribute("command","pick");
        }

        function save() {
            // Execute "save to disk" logic.
            data.execute.setAttribute("command","save");
        }

        function cancel() {
            // Close the window.
            data.execute.setAttribute("command","close");
        }

    </html:script>

    <html:div flex="100%">

    <html:table style="width:100%;">
        <html:tr>
            <html:td colspan="4">
                &startDownload;
                <html:div id="dialog.contentType" style="display:inline">
                    &contentType.label;
                </html:div>
            </html:td>
        </html:tr>
    
        <html:tr>
            <html:td style="width:25%">
                <html:button id="dialog.more" onclick="more()">&dialogMore.label;</html:button>
            </html:td>
            <html:td style="width:25%">
                <html:button id="dialog.pick" onclick="pick()">&dialogPick.label;</html:button>
            </html:td>
            <html:td style="width:25%">
                <html:button id="dialog.save" onclick="save()">&dialogSave.label;</html:button>
            </html:td>
            <html:td style="width:25%">
                <html:button id="dialog.cancel" onclick="cancel()">&dialogCancel.label;</html:button>
            </html:td>
        </html:tr>
    </html:table>

    </html:div>

</window>
