/*
 * yui-ext
 * Copyright(c) 2006, Jack Slocum.
 */


// create the LayoutExample application (single instance)
var LayoutExample = function(){
    // everything in this space is private and only accessible in the HelloWorld block
    
    // define some private variables
    var dialog, showLink;
    
    
    // return a public interface
    return {
        init : function(){
             showLink = getEl('showLink');
             // attach to click event
             showLink.on('click', this.showDialog, this, true);
                        
        },
        
        showDialog : function(){
            if(!dialog){ // lazy initialize the dialog and only create it once
                dialog = new YAHOO.ext.LayoutDialog("hello-dlg", { 
                        modal:true,
                        width:300,
                        height:190,
                        shadow:true,
                        minWidth:300,
                        minHeight:190
                      });
                dialog.addKeyListener(27, dialog.hide, dialog);
                                
                var layout = dialog.getLayout();
                dialog.beginUpdate();
                dialog.endUpdate();
            }
            dialog.show(showLink.dom);
        }
    };
}();


// when the DOM is ready, without waiting for images and other resources to load
YAHOO.ext.EventManager.onDocumentReady(LayoutExample.init, LayoutExample, true);
