Ext.namespace("THSite.other");THSite.other.ContactUsInfoDialog=Ext.extend(Ext.Window,{constructor:function(b){if(!b){b={}}var a=new Ext.data.SimpleStore({fields:["id","name"],data:this.getTypeStore()});this.entityForm=new Ext.form.FormPanel({baseCls:"x-plain",labelWidth:110,monitorValid:true,monitorPoll:400,defaultType:"textfield",defaults:{anchor:"100%"},listeners:{clientvalidation:function(d,c){this.sendButton.setDisabled(!c)},scope:this},items:[{xtype:"combo",fieldLabel:"Contact Reason",dataIndex:"contactUsType",store:a,displayField:"name",valueField:"id",value:b.type||"GENERAL",editable:false,allowBlank:false,mode:"local",triggerAction:"all",emptyText:"Select one ...",resizable:true},{fieldLabel:"Name",dataIndex:"name",value:b?b.name:null,minLength:1,maxLength:50,allowBlank:false},{fieldLabel:"Business Phone",dataIndex:"businessPhone",maxLength:20,value:b.businessPhone||""},{fieldLabel:"Personal Phone",dataIndex:"personalPhone",maxLength:20,value:b.personalPhone||""},{fieldLabel:"Mobile Phone",dataIndex:"mobilePhone",maxLength:20,value:b.mobilePhone||""},{fieldLabel:"Email",dataIndex:"email",allowBlank:false,maxLength:100,vtype:"thEmail",value:b?b.email:null},{xtype:"textarea",fieldLabel:"Comments",dataIndex:"comments",anchor:"100% -170px",style:"overflow: auto",maxLength:10000}]});THSite.other.ContactUsInfoDialog.superclass.constructor.call(this,{title:"Request Information",width:500,height:300,minWidth:300,minHeight:240,layout:"fit",plain:true,bodyStyle:"padding: 5px",buttonAlign:"center",modal:true,items:this.entityForm,buttons:[this.sendButton=new Ext.Button({text:"Send",handler:function(){this.getEl().mask("Saving...");var c=this.saveEntity();this.getEl().unmask();if(c){this.close()}},scope:this}),{text:"Exit without Sending",handler:function(){this.close()},scope:this}]})},saveEntity:function(){var a=false;if(this.entityForm.getForm().isValid()){var b=THSite.misc.Utils.getDataObjectFromForm(this.entityForm);ContactUsInfoService.create(b,{async:false,callback:function(c){a=true},errorHandler:function(c,d){THSite.remote.Pointcuts.handleDwrError(d,"Error with contact recording");a=false}});if(a){THSite.controls.Notification.show("Contact Us",String.format("Contact <i>{0}</i> has been created",b.name))}}return a},getTypeStore:function(){var a=[];for(var b in THSite.other.ContactUsInfoDialog.types){a.push([b,THSite.other.ContactUsInfoDialog.types[b]])}return a}});THSite.other.ContactUsInfoDialog.types={GENERAL:"Contact Us",ADVERTISING:"Request Advertising Information",PASSWORD:"Request Account Assistance"};THSite.other.ContactUsInfoDialog.show=function(a){(new THSite.other.ContactUsInfoDialog({type:a})).show();return false};