Ext.BLANK_IMAGE_URL='/global-img/spacer.gif';Ext.namespace('DJIndexes');DJIndexes.RBP={};DJIndexes.RBP.LiteratureCenter=function(){return{init:function(){var literaturetabs=new Ext.TabPanel({renderTo:'literaturecenter',width:950,activeTab:0,frame:true,defaults:{autoHeight:true},items:[{contentEl:'marketingmaterials',title:'Marketing Materials'},{contentEl:'research',title:'Research'},{contentEl:'rulebooks',title:'Rulebooks'}]});}}}();DJIndexes.RBP.ContactForm=function(){var form,_form;var config={formType:'case',debugMode:window.debugMode||false,title:'Contact Form',formDiv:'contact-form',formWidth:400,fieldWidth:250,dataStore:[],postURL:'/DataProxy/ContactForm.cfc',regions:[['asiaPacific','Asia/Pacific'],['europe','Europe'],['latinAmerica','Latin America'],['middleEast','Middle East'],['northAmerica','North America']],hiddenFields:[{name:'subject',value:'RBP Indexes'}],additionalParams:[{name:'00N60000001N3cm',value:'RBP Contact Form'}],messages:{missing:{email:'Please enter your e-mail address',company:'Please enter your company name',name:'Please enter your full name',region:'Please select the region of the world in which you are located',description:'Please enter your question or comment'},invalid:{form:'Please complete the information requested in the highlighted fields.',email:'The e-mail address you have entered is not properly formatted.'},submission:{success:{title:'Thank you',message:'Thank you for your inquiry. We will respond to you as soon as possible.'},failure:{title:'An error has occurred',message:'An error occurred while submitting your request, please try again.'}}}};return{init:function(){Ext.QuickTips.init();Ext.form.Field.prototype.msgTarget='side';this.createDataStores();this.createForm();},createDataStores:function(){var regionRecord=new Ext.data.Record.create([{name:'regionId'},{name:'regionName'}]);config.dataStore['region']=new Ext.data.Store({autoLoad:true,data:config.regions,reader:new Ext.data.ArrayReader({},regionRecord)});},createForm:function(){form=new Ext.form.FormPanel({renderTo:config.formDiv,url:config.postURL,method:'post',baseParams:{method:'webToCase',type:config.formType,debug:config.debugMode},frame:true,title:config.title,width:config.formWidth,defaults:{width:config.fieldWidth},items:this.createFormFields(),buttons:this.createButtons()});_form=form.getForm();_form.on('actioncomplete',function(){this.displayMessage(config.messages.submission.success);this.resetForm();},this);_form.on('actionfailed',function(){this.displayMessage(config.messages.submission.failure);},this);},createButtons:function(){var buttons=[new Ext.Button({minWidth:80,text:'SEND',type:'submit',scope:this,handler:this.validateForm}),new Ext.Button({minWidth:80,text:'Cancel',type:'reset',scope:this,handler:this.resetForm})];return buttons;},createFormFields:function(){var formFields=[new Ext.form.TextField({fieldLabel:'Full Name',name:'name',allowBlank:false,blankText:config.messages.missing.name}),new Ext.form.TextField({fieldLabel:'Email Address',name:'email',vtype:'email',allowBlank:false,blankText:config.messages.missing.email}),new Ext.form.TextField({fieldLabel:'Company',name:'company',allowBlank:false,blankText:config.messages.missing.company})];formFields.push(new Ext.form.ComboBox({mode:'local',store:config.dataStore.region,fieldLabel:'Region',name:'region',allowBlank:false,blankText:config.messages.missing.region,forceSelection:true,displayField:'regionName',valueField:'regionName',emptyText:'select one...'}));formFields.push(new Ext.form.TextArea({fieldLabel:'Comments',name:'description',allowBlank:false,blankText:config.messages.missing.description,height:100}));var hf=config.hiddenFields;for(var i=0;i<hf.length;i++){formFields.push(new Ext.form.TextField({name:hf[i].name,value:hf[i].value,inputType:'hidden',labelStyle:'display:none;'}));};var ap=config.additionalParams;var apString='';for(var i=0;i<ap.length;i++){apString+=ap[i].name+'='+ap[i].value+'|';}formFields.push(new Ext.form.TextField({name:'params',value:apString,inputType:'hidden',labelStyle:'display:none;'}));return formFields;},validateForm:function(button,e){if(_form.isValid()){_form.submit({waitMsg:'Submitting your request...'});}else{Ext.Msg.alert('Missing Data',config.messages.invalid.form);}},resetForm:function(button,e){_form.reset();},displayMessage:function(o){Ext.Msg.alert(o.title,o.message);},debug:function(){console.debug(arguments);}}}();Ext.onReady(function(){if(!Ext.isEmpty(Ext.get('contact-form'))){try{DJIndexes.RBP.ContactForm.init();}catch(err){}}if(!Ext.isEmpty(Ext.get('literaturecenter'))){try{DJIndexes.RBP.LiteratureCenter.init();}catch(err){}}});