Ext.onReady( function(){
  Ext.QuickTips.init();

  // turn on validation errors beside the field globally
  Ext.form.Field.prototype.msgTarget = 'side';
  var fsf = new Ext.FormPanel({
    labelWidth: 105, // label settings here cascade unless overridden
    url:'data/contact.php',
    frame:true,
    title: 'Contact Us',
    bodyStyle:'padding:5px 5px 0',
    width: 700,
    items: [{
      xtype:'fieldset',
      title: 'Your Message',
      autoHeight:true,
      defaults: {width: 300},
      defaultType: 'textfield',
      items :[{
          fieldLabel: 'Name',
          name: 'name',
          allowBlank:false
        },{
          fieldLabel: 'Subject',
          name: 'subject',
          allowBlank: true
        },{
        	fieldLabel: 'Email',
        	name: 'email',
        	allowBlank: true
        },{
        	xtype: 'textarea',
        	fieldLabel: 'Message',
        	name: 'message',
        	width: 300,
        	allowBlank: true
        }]
    }]   
  });
  
  fsf.addButton('Send Message', function (){
		fsf.form.submit({waitMsg: 'Sending your message...'});
  });
  
  fsf.render('contact-form');
  
});