var hello=
{
// modify hello.toString so we see when it gets dumped
toString:
    function()
    {
        return "[Object hello]"
    },
onLoad:
    function()
    {    
        // get button ..
        var button=document.getElementById("helloButton");
        if (!button)
            console.error("no #helloButton");
        // .. and register hello.onButton as click handler
        ff.event.add(button,"click",hello.onButton);
        console.debug("in onLoad: this = %o", this)
        
    },
onButton:
    function(event)
    {
        // Request a document via AJAX and send response to hello.onAnswer 
        ff.request({
            url: "hello-ajax.html",
            response: hello.onAnswer
        });
        console.debug("in onButton: this = %o", this)
    },
onAnswer:
    function(response)
    {
        // get page div
        var page=document.getElementById("page");
        if (!page)
            console.error("no #page");
        // get the response data as DOM nodes and append it to the page element
        ff.dom.append( page, response.html());
        
        console.debug("in onAnswer: this = %o", this)
        hello.foo();
    },
foo:
    function()
    {
        console.debug("in foo: this = %o", this)
    }
};

// Register hello.onLoad as onload handler
ff.event.onload(hello.onLoad);
