BFRC = {}; States = {}; Ext.BLANK_IMAGE_URL = '/ext2/images/default/s.gif'; Ext.onReady(function(){ Ext.namespace("Ext.ux.Toolbar.TextItem"); Ext.ux.Toolbar.TextItem = function(text){ Ext.ux.Toolbar.TextItem.superclass.constructor.call(this, text); }; Ext.extend(Ext.ux.Toolbar.TextItem, Ext.Toolbar.TextItem, { setText : function(text){ var element = Ext.get(this.el); element.update(text); } }); BFRC.text = new Ext.form.TextField({ width: 150 }); BFRC.drawText = function(id, config) { if(undefined == config) config = {}; config.applyTo = id; BFRC.text.cloneConfig(config); } BFRC.textArea = new Ext.form.TextArea({ width: 150, height: 100 }); BFRC.drawTextArea = function(id, config) { if(undefined == config) config = {}; config.applyTo = id; BFRC.textArea.cloneConfig(config); } BFRC.dataCombo = new Ext.form.ComboBox({ mode: 'remote', triggerAction: 'all', cls: 'select', disabledClass: 'select', emptyClass: 'select', fieldClass: 'select', focusClass: 'select', invalidClass: 'select', listClass: 'select', selectedClass: 'selectHi', displayField: 'text', valueField: 'value', editable: false, listWidth: 200, width: 120 }); BFRC.getFirstLabelForValue = function(combo) { var store = combo.store; var index = store.find('value', combo.getValue()); return store.getAt(index).get('text'); } BFRC.getFirstValueForLabel = function(combo, value) { if(!value) value = combo.getValue(); var store = combo.store; var index = store.find('text', value); return store.getAt(index).get('value'); } Ext.namespace('com.fcac.appointment'); com.fcac.appointment.states = [["AL","Alabama"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"]]; States.apptStateStore = new Ext.data.SimpleStore({ fields: ['value', 'text'], data: com.fcac.appointment.states }); Ext.namespace('com.fcac.state'); com.fcac.state.states = [["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["DC","District of Columbia"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"]]; States.stateStore = new Ext.data.SimpleStore({ fields: ['value', 'text'], data: com.fcac.state.states }); States.stateCombo = BFRC.dataCombo.cloneConfig({ mode: 'local', emptyText: 'SELECT STATE', width: 150 }); States.drawApptStates = function(formName, fieldName) { if(fieldName == null) fieldName = 'state'; var combo = States.stateCombo.cloneConfig({ id: fieldName, store: States.apptStateStore, applyTo: fieldName }); return combo; } States.drawStates = function(formName, fieldName) { if(fieldName == null) fieldName = 'state'; var formField = document.forms[formName][fieldName]; var selectedIndex = formField.selectedIndex; var fieldValue = formField[selectedIndex].value; var combo = States.stateCombo.cloneConfig({ id: fieldName, store: States.stateStore, transform: fieldName }); if(fieldValue != null) combo.setValue(fieldValue); return combo; } }); function setDisplay(info, value) { Ext.getDom("make" + info).className = value; Ext.getDom("model" + info).className = value; Ext.getDom("submodel" + info).className = value; } function hideInfo() { setDisplay("Info", "hide"); setDisplay("Field"); } function showInfo() { setDisplay("Field", "hide"); setDisplay("Info"); Ext.getCmp("year").setValue(Ext.getDom('yearValue').value); } function getOtherInfo() { var year = Ext.getDom('year'); var otherYear = Ext.getDom('yearOther'); var otherInfo = Ext.getDom('otherVehicleInfo'); var extraCurrent = Ext.getDom('extraVehicleCurrent'); var extraAnnual = Ext.getDom('extraVehicleAnnual'); var extraTires = Ext.getDom('extraVehicleTires'); hideInfo(); if(year.options[year.selectedIndex].value == "0") { otherYear.className = ""; otherInfo.className = ""; extraCurrent.className = "hide"; extraAnnual.className = "hide"; extraTires.className = "hide"; setDisplay("Select", "hide"); setDisplay("Other"); return; } otherYear.className = "hide"; otherInfo.className = "hide"; extraCurrent.className = ""; extraAnnual.className = ""; extraTires.className = ""; setDisplay("Select"); setDisplay("Other", "hide"); // getVehicleInfo('make'); }