/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';


    /*
     * ================  Form 3  =======================
     */


    var top = new Ext.FormPanel({
        labelAlign: 'top',
        frame:true,
        url:'order-form.php',
        title: 'Silahkan tulis rencana pesanan Anda',
        bodyStyle:'padding:5px 5px 0',
        width: 600,
        items: [{
            layout:'column',
            items:[{
                columnWidth:.5,
                layout: 'form',
                items: [{
                    xtype:'textfield',
                    fieldLabel: 'First Name',
                    name: 'fname',
					allowBlank:false,
                    anchor:'93%'
                }, {
                    xtype:'textfield',
                    fieldLabel: 'Company',
                    name: 'company',
                    anchor:'93%'
                }]
            },{
                columnWidth:.5,
                layout: 'form',
                items: [{
                    xtype:'textfield',
                    fieldLabel: 'Last Name',
                    name: 'lname',
                    anchor:'93%'
                },{
                    xtype:'textfield',
                    fieldLabel: 'Email',
                    name: 'email',
					allowBlank:false,
                    vtype:'email',
                    anchor:'93%'
                }]
            }]
        },{
            xtype:'textarea',
            id:'msg',
            fieldLabel:'Pesanan',
            height:200,
            anchor:'98%'
        }],

        buttons: [{  
text: 'Submit',  
handler: function(){  
top.form.submit({  
waitMsg: 'Saving...',  
success: function() {  
Ext.MessageBox.alert('Status','Order sent. Thank You !');  
},  
failure: function() {  
Ext.MessageBox.alert('Status','Failed to send order. Please check your input.');  
}  
});  
}  
}]  

    });

    top.render(document.getElementById("orderform"));


});