/*
 * yui-ext
 * Copyright(c) 2006, Jack Slocum.
 */


// create the HelloWorld application (single instance)
var HelloWorld = function(){
    // everything in this space is private and only accessible in the HelloWorld block
    
    // define some private variables
    var dialog, showBtn;
    
    var toggleTheme = function(){
        getEl(document.body, true).toggleClass('ytheme-gray');
    };
    // return a public interface
    
// shopping-cart-dlg
    return {
        init : function(){
             showBtn = getEl('show-dialog-btn');
             //--showBtn = getEl(e);
             // attach to click event
             showBtn.on('click', this.showDialog, this, true);
             
             //getEl('theme-btn').on('click', toggleTheme);
        },
        
        showDialog : function(){
            if(!dialog){ // lazy initialize the dialog and only create it once
                dialog = new YAHOO.ext.BasicDialog("shopping-cart-dlg", { 
                        //modal:true,
                        autoTabs:true,
                        width:700,
                        height:600,
                        shadow:true,
                        minWidth:400,
                        minHeight:350,
                        proxyDrag: true
                });
                dialog.addKeyListener(27, dialog.hide, dialog);
                dialog.addButton('Close', dialog.hide, dialog);
                //dialog.addButton('Submit', dialog.hide, dialog).disable();
            }
            dialog.show(showBtn.dom);
        }
    };
}();

// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
YAHOO.ext.EventManager.onDocumentReady(HelloWorld.init, HelloWorld, true);


////------------------------------------------------------

var sss = function(){

    var dialog2, showBtn2;
    
    return {
        init : function(){
             showBtn2 = getEl('show-dialog-btn2');

             showBtn2.on('click', this.showDialog, this, true);
             //getEl('theme-btn').on('click', toggleTheme);
        },
        
        showDialog : function(){
            if(!dialog2){ // lazy initialize the dialog and only create it once
                dialog2 = new YAHOO.ext.BasicDialog("hello-dlg2", { 
                        //modal:true,
                        autoTabs:true,
                        width:240,
                        height:480,
                        shadow:true,
                        minWidth:240,
                        minHeight:250,
                        proxyDrag: true,
						   x: 710, //(defaults to center screen if blank)
						   y: 130
                });
                dialog2.addKeyListener(27, dialog2.hide, dialog2);
                dialog2.addButton('Close', dialog2.hide, dialog2);
            }
            dialog2.show(showBtn2.dom);
        }
    };
}();

// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
YAHOO.ext.EventManager.onDocumentReady(sss.init, sss, true);