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, width: 95, listWidth: 150 }); BFRC.getFirstLabelForValue = function(combo) { var store = combo.store; var record = combo.findRecord(combo.valueField || combo.displayField, combo.getValue()); var index = store.indexOf(record); 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"],["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.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 a State', width: 150 }); States.drawApptStates = function(formName, fieldName) { if(fieldName == null) fieldName = 'state'; var combo = States.stateCombo.cloneConfig({ id: fieldName, store: States.apptStateStore, transform: 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 show(elem) { document.getElementById(elem).style.display = 'block'; } function hide(elem) { document.getElementById(elem).style.display = 'none'; } //4752-Make field is not getting enabled on changing the year field in fleet care. //Fixing createContextualFragment issue in IE9. if (typeof Range.prototype.createContextualFragment == "undefined") { Range.prototype.createContextualFragment = function(html) { var startNode = this.startContainer; var doc = startNode.nodeType == 9 ? startNode : startNode.ownerDocument; var container = doc.createElement("div"); container.innerHTML = html; var frag = doc.createDocumentFragment(), n; while ( (n = container.firstChild) ) { frag.appendChild(n); } return frag; }; }