/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

/**/
Ext.BLANK_IMAGE_URL = 'ext/resources/images/default/s.gif';

Ext.onReady(function() {
	
	        Ext.QuickTips.init();				

    var fs = new Ext.FormPanel({
		id:'formpanel',
		renderTo: 'StudioID',
        labelAlign: 'top',
        bodyStyle:'padding:5px',
		region: 'north',
		border:false,
		frame:false,
        height: 660,
		buttonAlign: 'left',
        items: [{
            layout:'column',
            border:false,
            items:[{
                columnWidth:.50,
                layout: 'form',
                border:false,
                items: [{
                    xtype:'textfield',
                    fieldLabel: 'Firstname*',
                    name: 'first',
                    anchor:'95%',
					allowBlank: false
                },{
                    xtype:'textfield',
                    fieldLabel: 'Lastname*',
                    name: 'last',
                    anchor:'95%',
					allowBlank: false
                },{
                    xtype:'textfield',
                    fieldLabel: 'Company/Organization*',
                    name: 'company',
                    anchor:'95%',
					allowBlank: false,
					emptyText: 'Company Pty Ltd'
                },{
                    xtype:'textfield',
                    fieldLabel: 'Email*',
                    name: 'email',
                    vtype:'email',
                    anchor:'95%',
					allowBlank: false,
					emptyText: 'firstname.lastname@company.com'
                },{
					id:'product',
                    xtype:'combo',
                    fieldLabel: 'Product Name/Project Name*',
	                name: 'product',
                    anchor:'50%',	
					editable:false,
					emptyText: 'Select',
					allowBlank: false,
					store: new Ext.data.SimpleStore({
											fields: ['id','value'],
											data:[["OSS","rekry!Joom ERP for Joomla!"],
                                          ["OSS","Video Conference Plugin for Atlassian Confluence"],
                                          ["ZFEXT","ZF-Ext Template"]]
										}),
										displayField: 'value',
										mode: 'local',
										triggerAction: 'all'
                },{
					id:'type',
                    xtype:'combo',
                    fieldLabel: 'Issue type*',
	                name: 'type',
                    anchor:'50%',	
					editable:false,
					emptyText: 'Select',
					allowBlank: false,
					store: new Ext.data.SimpleStore({
											fields: ['id','value'],
											data:[["user-story","Feedback/User-story"],
                                          ["defect","Issue/Bug"],
                                          ["requirement","Feature Request/Requirement"]]
										}),
										displayField: 'value',
										mode: 'local',
										triggerAction: 'all'
                },{
					id:'city',
                    xtype:'textfield',
                    fieldLabel: 'City*',
                    name: 'city',
                    anchor:'95%',
					allowBlank: false
                },{
					id:'contry',
                    xtype:'textfield',
                    fieldLabel: 'Contry*',
                    name: 'country',
                    anchor:'95%',
					allowBlank: false
                },{
					id:'www',
                    xtype:'textfield',
                    fieldLabel: 'WWW-site',
                    name: 'www',
                    anchor:'95%'
                }, {

                        xtype: 'recaptcha'

                    ,    name: 'recaptcha'

                    ,    id: 'recaptcha'

                    ,    publickey: '6LfC3ggAAAAAALwskXwO_M6o-_HBbgsfsgQ_l9k0'

                    ,    theme: 'white'

                    ,    lang: 'en'

                }]
            },{
                columnWidth:.50,
                layout: 'form',
                border:false,
                items: [{
					id:'title',
                    xtype:'textfield',
                    fieldLabel: 'Title*',
                    name: 'title',
                    anchor:'95%',
					allowBlank: false
                },{
					id:'message',
                    xtype:'textarea',
                    fieldLabel: 'Message*',
	                name: 'message',
					height:200,
                    anchor:'95%',
					allowBlank: false
                },{
					id:'story',
                    xtype:'textarea',
                    fieldLabel: 'Tell story about using my product',
	                name: 'story',
					height:200,
                    anchor:'95%',
					allowBlank: true
                },{
					id:'bad',
                    xtype:'textarea',
                    fieldLabel: 'What is bad or good in my product',
	                name: 'bad',
					height:98,
                    anchor:'95%',
					allowBlank: true
                }]
            }]
         
        }],
		buttons: [{
            text: 'Submit',
			handler: function(){
            fs.getForm().submit({
								  url:'submit.php', 
								  waitMsg:'Posting...',
								  success: function (form, action){
									fs.getForm().reset();
									var json = Ext.util.JSON.decode(action.response.responseText);
									Ext.MessageBox.alert('Success',json.msg);
									},
								  failure: function (form, action){	
									var json = Ext.util.JSON.decode(action.response.responseText);
									Ext.MessageBox.alert('Failure',json.msg);
									}
								  });
        	}
        },{
            text: 'Reset',
			handler: function(){
            fs.getForm().reset();
        	}
        }]

    });

}); 
