Ext.onReady(function(){
    var frms = Ext.select("form");
    var forms = {};
    var frmCfg;
    var frmsCfg = {
        "signUp": {
            success: function(){
                var disBod = Ext.getBody();
                var dh = Ext.DomHelper;
                var successBx = {
                    tag: 'div',
                    cls: 'subMsg',
                    id: 'sMsg',
                    cn: [{
                        tag: 'div',
                        cls: 'signUpSection',
                        cn: [{
                            tag: 'p',
                            html: 'Your information was successfully submitted'
                        }]
                    
                    }, {
                        tag: 'div',
                        cls: 'bttnBar',
                        cn: [{
                            tag: 'fieldset',
                            cn: [{
                                id: 'okBtn',
                                tag: 'button',
                                type: 'ok',
                                html: 'OK'
                            }]
                        }]
                    }]
                }
                var bdy = dh.append(disBod, successBx);
                var scrlTop = Ext.getBody().animate( // animation control object
                {
                    scroll: {
                        to: [0, 0]
                    }
                }, 0.35, // animation duration
 null, // callback
 'easeOut', // easing method
 'scroll' // animation type ('run','color','motion','scroll')    
);
                
                var okB = Ext.get('okBtn').on('click', function(evt, dom, opts){
                    Ext.get(dom.parentNode.parentNode.parentNode).remove()
                });
                
            },
            failure: function(){
            }
        },
        "contactUs": {
            success: function(){
                var disBod = Ext.getBody();
                var dh = Ext.DomHelper;
                var successBx = {
                    tag: 'div',
                    cls: 'subMsg',
                    id: 'sMsg',
                    cn: [{
                        tag: 'div',
                        cls: 'signUpSection',
                        cn: [{
                            tag: 'p',
                            html: 'Your message has been successfully sent'
                        }]
                    
                    }, {
                        tag: 'div',
                        cls: 'bttnBar',
                        cn: [{
                            tag: 'fieldset',
                            cn: [{
                                id: 'okBtn',
                                tag: 'button',
                                type: 'ok',
                                html: 'OK'
                            }]
                        }]
                    }]
                }
                var bdy = dh.append(disBod, successBx);
                var scrlTop = Ext.get('sMsg').animate( // animation control object
                {
                    scroll: {
                        to: [0, 0]
                    }
                }, 0.35, // animation duration
 null, // callback
 'easeOut', // easing method
 'scroll' // animation type ('run','color','motion','scroll')    
);
                
                var okB = Ext.get('okBtn').on('click', function(evt, dom, opts){
                    Ext.get(dom.parentNode.parentNode.parentNode).remove()
                });
                
            },
            failure: function(){
            }
        }
    };
    
    frms.each(function(el){
        el = Ext.get(el);
        frmCfg = {};
        if (el.dom.id && el.dom.id != 'lmfao') {
        
            frmCfg.el = el;
            frmCfg.id = el.dom.id;
            forms[el.dom.id] = new sglite.cmp.form(Ext.apply(frmsCfg[el.dom.id], frmCfg));
            
        }
    });
    
    var dnsty = Ext.select("#densityCalc");
    var dnConfig;
    var calcs = {};
    dnsty.each(function(el){
        el = Ext.get(el);
        dnConfig = {};
        dnConfig.el = el;
        dnConfig.id = el.dom.id;
        calcs[el.dom.id] = new sglite.cmp.densityCalc(dnConfig);
    });
    
    var rteRequestEl = Ext.select("#lmfao");
    var rtConfig;
    var rtCalcs = {};
    rteRequestEl.each(function(el){
        el = Ext.get(el);
        rtConfig = {}
        rtConfig.el = el;
        rtConfig.id = el.dom.id;
        rtCalcs[el.dom.id] = new sglite.cmp.rateRequest(rtConfig);
    });
    
});

