/*
 * Ext JS Library 1.1.1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.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 fs = new Ext.form.Form({	
        width:700,
		labelAlign: 'right',
        labelWidth: 80,
		url:'rfp.php'
    });
	
	
		
    fs.fieldset(
        {legend:'Contact Information'},
        new Ext.form.TextField({
            fieldLabel: 'First Name',
            name: 'first',
            width:160,
			allowBlank:false
        }),

        new Ext.form.TextField({
            fieldLabel: 'Last Name',
            name: 'last',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Title',
            name: 'title',
            width:160
        }),

        new Ext.form.TextField({
            fieldLabel: 'Company',
            name: 'company',
            width:160
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Address',
            name: 'address',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'City',
            name: 'city',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.ComboBox({
            fieldLabel: 'State',
            hiddenName:'state',
            store: new Ext.data.SimpleStore({
                fields: ['abbr', 'state'],
                data : Ext.exampledata.states // from states.js
            }),
            displayField:'state',
            typeAhead: true,
            mode: 'local',
            triggerAction: 'all',
            emptyText:'Select a state...',
            selectOnFocus:true,
            width:160,
			allowBlank:false
        }),

        new Ext.form.TextField({
            fieldLabel: 'Zip Code',
            name: 'zip',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Email',
            name: 'email',
            vtype:'email',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Telephone',
            name: 'telephone',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Fax',
            name: 'fax',
            width:160
        })        
		
    );
	
	fs.fieldset(
        {legend:'Preferred arrival and departure dates', hideLabels:false},		  
		
		new Ext.form.DateField({
            fieldLabel: 'Arrival',
            name: 'arrival',
            width:160,
            allowBlank:false
        }),
		
		new Ext.form.DateField({
            fieldLabel: 'Departure',
            name: 'departure',
            width:160,
            allowBlank:false
        })		
			
        
    );
	
	/*fs.add(
        fs.column({width: 30, labelWidth: 0, labelSeparator: ''},
            new Ext.form.Radio({
                boxLabel: 'foo',
                name: 'radioField',
                inputValue: 'yes'
            })
        ),
        fs.column({width: 30, labelWidth: 0, labelSeparator: ''},
            new Ext.form.Radio({
                boxLabel: 'bar',
                name: 'radioField',
                inputValue: 'no'
            })
        )),*/
	
	
	fs.fieldset(
        {legend:'Are these dates flexible', hideLabels:true},		  
		
		new Ext.form.Radio({
            boxLabel:'Yes',			
            name:'radio1', 
			inputValue: "Yes"
        }),
        new Ext.form.Radio({
            boxLabel:'No',
            name:'radio1', 
			inputValue: "No"
        })
			
        
    );
	
	fs.fieldset(
        {legend:'Additional Information', labelAlign: 'top'},
        new Ext.form.TextField({
            fieldLabel: 'Number of sleeping rooms needed',
            name: 'rooms',			
            width:242,
			allowBlank:true
        }),

        new Ext.form.TextField({
            fieldLabel: 'Number of people attending',
            name: 'attendees',
            width:242,
			allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Meeting room requirements',
            name: 'requirements',
            width:242,
			allowBlank:true
        }),

        new Ext.form.TextField({
            fieldLabel: 'Food &amp; Beverage needs',
            name: 'food',
            width:242,
			allowBlank:true
        })		
		
    );
	
	
	fs.container({legend:'Additional Information', labelAlign: 'top'},
        new Ext.form.HtmlEditor({
            id:'add',
            fieldLabel:'If the dates are flexible please provide additional information here',
            width:516,
            height:200,
			allowBlank:true
			})
		);	
	
	
	fs.fieldset(
        {legend:'Guest Room needs per night', labelAlign: 'top'},
        
		new Ext.form.DateField({
            fieldLabel: 'Day 1',
            name: 'day1',
            width:160,
            allowBlank:true
        }),	
		
		new Ext.form.TextField({
            fieldLabel: 'Number of rooms',
            name: 'd1-roomnumber',			
            width:160,
			allowBlank:true
        }),

        new Ext.form.DateField({
            fieldLabel: 'Day 2',
            name: 'day2',
            width:160,
            allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Number of rooms',
            name: 'd2-roomnumber',
            width:160,
			allowBlank:true
        }),		
		
		new Ext.form.DateField({
            fieldLabel: 'Day 3',
            name: 'day3',
            width:160,
            allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Number of rooms',
            name: 'd3-roomnumber',
            width:160,
			allowBlank:true
        }),
		
		new Ext.form.DateField({
            fieldLabel: 'Day 4',
            name: 'day4',
            width:160,
            allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Number of rooms',
            name: 'd4-roomnumber',
            width:160,
			allowBlank:true
        }),
		
		new Ext.form.DateField({
            fieldLabel: 'Day 5',
            name: 'day5',
            width:160,
            allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Number of rooms',
            name: 'd5-roomnumber',
            width:160,
			allowBlank:true
        }),
		
		new Ext.form.DateField({
            fieldLabel: 'Day 6',
            name: 'day6',
            width:160,
            allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Number of rooms',
            name: 'd6-roomnumber',
            width:160,
			allowBlank:true
        })
		
		
		
    );
		
   
	fs.addButton('Submit', function() {
    	if (fs.isValid()) {
	    	fs.el.dom.submit();	
    	}
    });
	
	
    fs.addButton('Cancel');

    fs.render('form-ct3');
    fs.el.un('submit', fs.onSubmit, fs);
    fs.el.dom.setAttribute('action', fs.url);

    
});
