Ext.onReady (function () {	

var code = new Ext.form.TextField({labelSeparator: '',name:'code', id: 'code',width:175});

var contactform = new Ext.form.FormPanel({
	renderTo: 'contactform',	
	width: 400,
	frame: true,
	border: true,
	labelWidth: 55,
  	items: [
		{xtype: 'hidden',name:'i', value:queryString('i')},
		{xtype: 'textfield',fieldLabel: 'Name',name:'name',anchor: '100%', value: sname},		
		{xtype: 'textfield',fieldLabel: 'Email',name:'email',anchor: '100%',vtype:"email", value:semail},
		{xtype: 'textfield',fieldLabel: 'Subject',name:'subject',anchor: '100%'},
		{xtype: 'textarea',fieldlabel: 'message',fieldLabel: 'Message',name: 'message',height: 200,width:325},
		{xtype:'box',anchor:'',autoEl:{children:[{tag:'img',src:'include/securimage/securimage_show.php', style: 'margin-left:60px;margin-top:10px;'},{tag:'div',html:'Enter text above', style: 'margin-left:110px'}]}},
		code
		
	],
	buttons: [{
		text: 'Send',
		handler: function() {
			if(contactform.getForm().isValid()) {
				contactform.getForm().submit({
				waitMsg: 'Sending ...',
				url:'contact_board.inc.php',
				success:function(form, action) { 
						Ext.Msg.alert('Status','eMail Sent.');
						contactform.getForm().reset();
						//window.location.reload();
				},
				failure: function(form, action) { 
					if(action.failureType == 'server'){
	                    obj = Ext.util.JSON.decode(action.response.responseText);
                        Ext.Msg.alert('Error', obj.errors.reason);
                    }else{
	                    Ext.Msg.alert('Error', 'Unable to send email at this time');
                    }

				
				}
			});
		}} 
	},{
	text: 'Clear', handler: function() { contactform.getForm().reset(); }
	}]

});


});		




