sglite.cmp.rateRequest = function(config){
    /**
     * @cfg {String} config Config with the following properties
     * id, cls, html, el
     */
    //---------------------------------------------------------------------------------------
    // private
    //---------------------------------------------------------------------------------------
    var that = this;
    var config = config ||
    {};
    var container;
    var dh = Ext.DomHelper;
    var validateEvent = "blur";
    var calFrm;
    var dnstyBod = {
        tag: 'div',
        cn: [{
            tag: 'fieldset',
            cls: 'snoop',
            cn: [{
                tag: 'div',
                cls: 'bdyDvdr',
                cn: [{
                    tag: 'h4',
                    html: 'Company'
                }]
            }, {
                tag: 'div',
                cls: 'signUpSection',
                cn: [{
                    tag: 'fieldset',
                    cn: [{
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Company Name:'
                        }, {
                            tag: 'input',
                            type: 'text',
                            allowBlank: 'false',
                            name: 'companyName'
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'NCA Member No:'
                        }, {
                            tag: 'input',
                            type: 'text',
                            allowBlank: 'false',
                            name: 'memNo'
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Requestor&#39;s Name:'
                        }, {
                            tag: 'input',
                            type: 'text',
                            allowBlank: 'false',
                            name: 'requName'
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Requestor&#39;s email:'
                        }, {
                            tag: 'input',
                            type: 'text',
                            allowBlank: 'false',
                            name: 'requPhone'
                        }]
                    }]
                
                }]
            }, {
                tag: 'div',
                cls: 'bdyDvdr',
                cn: [{
                    tag: 'h4',
                    html: 'Shipment Details'
                }]
            }, {
                tag: 'div',
                cls: 'signUpSection',
                cn: [{
                    tag: 'fieldset',
                    cn: [{
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Mode:'
                        }, {
                            tag: 'select',
                            allowBlank: 'false',
                            name: 'mode',
                            cn: [{
                                tag: 'option',
                                value: 'LTL',
                                html: 'LTL'
                            }, {
                                tag: 'option',
                                value: 'LTL Refrigerated',
                                html: 'LTL Refrigerated'
                            }, {
                                tag: 'option',
                                value: 'Truckload Dry Van',
                                html: 'Truckload Dry Van'
                            }, {
                                tag: 'option',
                                value: 'Truckload Refrigerated',
                                html: 'Truckload Refrigerated'
                            }, {
                                tag: 'option',
                                value: 'Container',
                                html: 'Container'
                            }, {
                                tag: 'option',
                                value: 'Small Package',
                                html: 'Small Package'
                            }, {
                                tag: 'option',
                                value: 'Intermodal',
                                html: 'Intermodal'
                            }, {
                                tag: 'option',
                                value: 'Air',
                                html: 'Air'
                            }, {
                                tag: 'option',
                                value: 'Ocean',
                                html: 'Ocean'
                            }]
                        
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Country:'
                        }, {
                            tag: 'select',
                            allowBlank: 'false',
                            name: 'country',
                            cn: [{
                                tag: 'option',
                                value: 'USA',
                                html: 'USA'
                            }, {
                                tag: 'option',
                                value: 'CANADA',
                                html: 'canada'
                            }]
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Origin Postal Code:'
                        }, {
                            tag: 'input',
                            type: 'text',
                            vtype: 'alphanum',
                            allowBlank: 'false',
                            name: 'originPostalCode'
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Destination Postal Code: '
                        }, {
                            tag: 'input',
                            allowBlank: 'false',
                            type: 'text',
                            vtype: 'alphanum',
                            name: 'destPostalCode'
                        }]
                    }]
                
                }]
            }, {
                tag: 'div',
                cls: 'itemSection',
                cn: [{
                    tag: 'fieldset',
                    cls: 'itmPad',
                    cn: [{
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Pallet Count: '
                        }, {
                            tag: 'input',
                            allowBlank: 'false',
                            type: 'text',
                            vtype: 'num',
                            name: 'quantity'
                        }]
                    }, {
                        tag: 'div',
                        cn: [{
                            tag: 'label',
                            html: 'Weight: '
                        }, {
                            tag: 'input',
                            type: 'text',
                            vtype: 'num',
                            allowBlank: 'false',
                            name: 'weight'
                        }]
                    }, {
                        tag: 'div',
                        cls: 'freightClass',
                        cn: [{
                            tag: 'label',
                            html: 'Class: '
                        }, {
                            tag: 'select',
                            name: 'freightClass',
                            allowBlank: 'false',
                            cn: [{
                                tag: 'option',
                                value: '',
                                html: '...'
                            }, {
                                tag: 'option',
                                value: '50',
                                html: '50'
                            }, {
                                tag: 'option',
                                value: '55',
                                html: '55'
                            }, {
                                tag: 'option',
                                value: '60',
                                html: '60'
                            }, {
                                tag: 'option',
                                value: '65',
                                html: '65'
                            }, {
                                tag: 'option',
                                value: '70',
                                html: '70'
                            }, {
                                tag: 'option',
                                value: '77.5',
                                html: '77.5'
                            }, {
                                tag: 'option',
                                value: '85',
                                html: '85'
                            }, {
                                tag: 'option',
                                value: '92.5',
                                html: '92.5'
                            }, {
                                tag: 'option',
                                value: '100',
                                html: '100'
                            }, {
                                tag: 'option',
                                value: '110',
                                html: '110'
                            }, {
                                tag: 'option',
                                value: '125',
                                html: '125'
                            }, {
                                tag: 'option',
                                value: '150',
                                html: '150'
                            }, {
                                tag: 'option',
                                value: '175',
                                html: '175'
                            }, {
                                tag: 'option',
                                value: '200',
                                html: '200'
                            }, {
                                tag: 'option',
                                value: '250',
                                html: '250'
                            }, {
                                tag: 'option',
                                value: '300',
                                html: '300'
                            }, {
                                tag: 'option',
                                value: '400',
                                html: '400'
                            }, {
                                tag: 'option',
                                value: '500',
                                html: '500'
                            }]
                        }, {
                            tag: 'input',
                            type: 'hidden',
                            name: 'firstName',
                            value: 'yahoo'
                        }, {
                            tag: 'input',
                            type: 'hidden',
                            name: 'lastName',
                            value: ''
                        }, {
                            tag: 'input',
                            type: 'hidden',
                            name: 'email',
                            value: ''
                        }, {
                            tag: 'input',
                            type: 'hidden',
                            name: 'phone',
                            value: ''
                        }, {
                            tag: 'input',
                            type: 'hidden',
                            name: 'desc',
                            value: ''
                        }]
                    }]
                
                }]
            }, {
                tag: 'div',
                cls: 'checkBoxSection',
                id: 'accessorials',
                cn: [{
                    tag: 'fieldset',
                    cn: [{
                        tag: 'div',
                        cls: 'accessLbl',
                        html: 'Accessorials:'
                    }, {
                        tag: 'div',
                        cls: 'signUpSection',
                        cn: [{
                            tag: 'fieldset',
                            cn: [{
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Residential Delivery'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'RES',
                                    value: 'Residential Delivery'
                                }]
                            
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Freeze Protect'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'FRP',
                                    value: 'Freeze Protect'
                                }]
                            
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Guaranteed Delivery'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'GUAR',
                                    value: 'Guaranteed Delivery'
                                }]
                            
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Inside Delivery'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'IND',
                                    value: 'Inside Delivery'
                                }]
                            }]
                        
                        }]
                    }, {
                        tag: 'div',
                        cls: 'signUpSection',
                        cn: [{
                            tag: 'fieldset',
                            cn: [{
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Liftgate Delivery'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'LFD',
                                    value: 'Liftgate Delivery'
                                }]
                            
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Sort and Segregate'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'SAS',
                                    value: 'Sort and Segregate'
                                }]
                            
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'School Delivery'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'SCD',
                                    value: 'School Delivery'
                                }]
                            
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Tradeshow Delivery'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'TSD',
                                    value: 'Tradeshow Delivery'
                                }]
                            }, {
                                tag: 'div',
                                cn: [{
                                    tag: 'label',
                                    html: 'Call for Appointment'
                                }, {
                                    tag: 'input',
                                    type: 'checkbox',
                                    name: 'APT',
                                    value: 'Call for Appointment'
                                }]
                            }]
                        
                        }]
                    }]
                
                }]
            }, {
                tag: 'div',
                cls: 'bttnBr',
                cn: [{
                    tag: 'fieldset',
                    cn: [{
                        tag: 'div',
                        cn: [{
                            tag: 'button',
                            type: 'reset',
                            html: 'Clear'
                        }, {
                            tag: 'button',
                            type: 'submit',
                            html: 'Submit'
                        }, {
                            tag: 'input',
                            type: 'hidden',
                            name: 'method',
                            value: 'send'
                        }]
                    
                    }]
                }]
            }]
        }]
    };
    
    
    
    
    //<option value="ABW">Aruba</option>
    //Ext.get('pInp').dom.options[Ext.get('test').dom.selectedIndex].text
    //---------------------------------------------------------------------------------------
    // private methods
    //---------------------------------------------------------------------------------------
    function construct(){
        container = Ext.get(config.el);
        var bdy = dh.append(container, dnstyBod);
        var nookie = Ext.get('lmfao');
        
        
        var frmsCfg = {
            "lmfao": {
                success: function(rsp){
                    //Ext.getBody().scrollTo('top', 0);
                    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 response = rsp;
                    var rtrnObj = Ext.decode(response.data)
                    if (rtrnObj.total == 0) {
                        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: 'Please contact the NCA Shipping Program for a custom quote at 541-330-0222. '
                                }]
                            
                            }, {
                                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()
                        });
                    }
                    else {
                        var sDh = Ext.DomHelper;
                        
                        var daBod = Ext.get("rteReq");
                        var likeRate = 'Like what you see?<br /><a href="' + sglite.config.url + sglite.config.webPath + 'signUp">Click here</a> to sign up for the NCA shipping program, or <a href="' + sglite.config.url + sglite.config.webPath + 'submitInfo">contact us</a> for more information. ';
                        var rsltSec = {
                            tag: 'div',
                            id: 'rsltSectn',
                            cn: [{
                                tag: 'div',
                                cls: 'bdyDvdr',
                                cn: [{
                                    tag: 'h4',
                                    html: 'Your Rate   $' + rtrnObj.total
                                }]
                            
                            }, {
                                tag: 'div',
                                style: 'padding: 0 40px',
                                html: likeRate
                            }]
                        }
                        
                        var bdy = sDh.insertBefore(el, rsltSec);
                        var frmDisVar = Ext.get(el).hide(true)
                        // debugger;
                    }
                },
                failure: 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: 'There were no rates returned for the shipment you entered. There may have been an error with the data you entered. '
                            }]
                        
                        }, {
                            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()
                    });
                    
                }
            }
        
        };
        
        el = nookie;
        var sputnik = {};
        frmCfg = {};
        var frmCfgPlzWrk;
        if (el.dom.id) {
            frmCfg.el = el;
            frmCfg.id = el.dom.id;
            frmCfg.preprocess = function(){
                var accessSection = Ext.get('accessorials');
                var stinkyPete;
                var demRaskallyValz = {
                    accessorials: {}
                };
                stinkyPete = accessSection.select('input').elements;
                Ext.each(stinkyPete, function(itm, ix){
                    if (itm.checked) {
                        demRaskallyValz.accessorials[itm.name] = itm.value
                    }
                });
                return demRaskallyValz;
            };
            sputnik[el.dom.id] = new sglite.cmp.form(Ext.apply(frmsCfg[el.dom.id], frmCfg));
        }
    };
    
    
    //---------------------------------------------------------------------------------------
    // public methods
    //---------------------------------------------------------------------------------------
    
    //---------------------------------------------------------------------------------------
    // public properties
    //---------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------
    // constructor work
    //---------------------------------------------------------------------------------------
    // before constructor, add element to dom
    
    sglite.cmp.rateRequest.superclass.constructor.call(this, config);
    construct();
};// end object
Ext.extend(sglite.cmp.rateRequest, Ext.Element);


