/*
 * 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 cform = new Ext.form.Form({        
		labelAlign: 'top',
        labelWidth: 80,
		url:'cc-info-request.php'
    });
	
	
		
    cform.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: 'Email',
            name: 'email',
            vtype:'email',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Address',
            name: 'address',
            width:160,
			allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'City',
            name: 'city',
            width:160,
			allowBlank:true
        }),
		
		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:true
        }),

        new Ext.form.TextField({
            fieldLabel: 'Zip Code',
            name: 'zip',
            width:160,
			allowBlank:true
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Day Phone',
            name: 'dphone',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.TextField({
            fieldLabel: 'Night Phone',
            name: 'nphone',
            width:160,
			allowBlank:false
        }),
		
		new Ext.form.HtmlEditor({
            id:'add',
            fieldLabel:'Regarding Comments',
            width:516,
            height:200,
			allowBlank:true
		})		
		
    );
		
   
	cform.addButton('Submit', function() {
    	if (cform.isValid()) {
	    	cform.el.dom.submit();	
    	}
    });
	
	
    cform.addButton('Cancel');

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

    
});
