/*
 * Plugins scripts 0.1
 * Copyright(c) 2008, .
 * 
 */


var AsteriskPanel=function(_1,_2){AsteriskPanel.superclass.constructor.call(this,_1,_2);};Ext.extend(AsteriskPanel,Ext.Panel,{useFieldSet:false,fieldSetOptions:{},asteriskCharacters:"*",asteriskWidth:20,initComponent:function(){var _3=[{layout:"column",border:false,frame:false,width:this.width,items:[{xtype:"panel",border:false,frame:false,width:this.asteriskWidth,html:this.asteriskCharacters,bodyStyle:"padding-top: 6px;"},{columnWidth:1,layout:"form",xtype:"panel",border:false,frame:false,items:[{layout:"form",border:false,items:this.items.slice()}]}]}];this.items=[];if(this.useFieldSet){var fs={title:"Form",xtype:"fieldset",autoHeight:true};if(this.fieldSetOptions){for(var i in this.fieldSetOptions){fs[i]=this.fieldSetOptions[i];}
delete this.fieldSetOptions;}
fs.items=_3;this.items=[fs];}else{this.items=_3;}
AsteriskPanel.superclass.initComponent.call(this);},beforeDestroy:function(){AsteriskPanel.superclass.beforeDestroy.call(this);},getPanel:function(){return this.items[1];}});Ext.ComponentMgr.registerType("asteriskpanel",AsteriskPanel);
Ext.grid.CheckColumn=function(_1){Ext.apply(this,_1);if(!this.id){this.id=Ext.id();}
this.renderer=this.renderer.createDelegate(this);};Ext.grid.CheckColumn.prototype={valueToggle:"1or0",allowCheckField1:null,allowCheckField2:null,init:function(_2){this.grid=_2;this.grid.on("render",function(){var _3=this.grid.getView();_3.mainBody.on("mousedown",this.onMouseDown,this);},this);},onMouseDown:function(e,t){if(t.className&&t.className.indexOf("x-grid3-cc-"+this.id)!=-1){e.stopEvent();var _6=this.grid.getView().findRowIndex(t);var _7=this.grid.store.getAt(_6);if(this.readonly==false){if(this.valueToggle=="YorN"){_7.set(this.dataIndex,((_7.get(this.dataIndex)!="Y")?"Y":"N"));}else{_7.set(this.dataIndex,!_7.data[this.dataIndex]);}
this.grid.fireEvent("afteredit",{grid:this.grid,record:_7,field:this.dataIndex,value:_7.data[this.dataIndex],row:_6});}else{_7.reject(false);}}},renderer:function(v,p,_a){if(this.allowCheckField1&&this.allowCheckField2){try{if(_a.data[this.allowCheckField1]!=_a.data[this.allowCheckField2]){return"<div class=\"x-grid-disabled"+(v?"-checked":"-unchecked")+"\"></div>";}}
catch(e){return v;}}
p.css+=" x-grid3-check-col-td";if((this.valueToggle=="YorN")&&(v!="Y")){v=null;}
return"<div class=\"x-grid3-check-col"+(v?"-on":"")+" x-grid3-cc-"+this.id+"\"> </div>";}};
Ext.grid.DynamicGridPanel=Ext.extend(Ext.grid.EditorGridPanel,{autoHeight:true,autoExpandColumn:"",autoLoad:false,pagingSizeLabel:"Page Size: ",pageSizeStoreType:"pagination_pagesize",pageSizeComboWidth:50,limit:10,pagingToolbarWidth:820,toolbarButtonCls:"admin-toolbar-btn",url:null,common_url:"json.php?area=A&target=common",remoteSort:true,loadOnActivate:false,selectFirst:false,loadMask:true,searchField:"",searchValue:"",searchLetter:"",clicksToEdit:1,viewConfig:{forceFit:true,emptyText:"No results could be found for the specified parameters.",deferEmptyText:true},includeAdd:false,includeDelete:true,deleteMethod:"",delete_id:"",includeRefresh:true,includeDownload:true,downloadMethod:"",fireDownloadEvent:false,filterComboWidth:250,includeFilter:false,filterStoreType:"filter",filterMethod:"",filterLabel:"",includePagination:true,checkSelection:true,forceSingleSelect:false,suspendSelectionEvents:false,fireSelectionEvents:false,manageUsers:true,method:"",plugins:[],columns:[],standardLabel:{buttons:{add_new_label:"Add New",delete_label:"Delete",refresh_btn:"Refresh",download_btn:"Download"},errors:{error_title:"Error",error_msg:"There was an error processing this request"}},initComponent:function(){this.columns=this.columns.slice();if(this.columns.length>0){this._allowLoad=true;}else{this._allowLoad=false;}
if(this.checkSelection){this.sm=new Ext.grid.CheckboxSelectionModel({singleSelect:this.forceSingleSelect});this.columns.unshift(this.sm);}else{this.sm=new Ext.grid.CellSelectionModel();}
if(this.suspendSelectionEvents){this.sm.suspendEvents();}else{if(this.fireSelectionEvents&&this.checkSelection){this.sm.on("rowselect",this._fireRowSelectionEvent,this);}else{if(this.fireSelectionEvents){this.sm.on("cellselect",this._fireCellSelectionEvent,this);}}}
var _1=[];for(var _2=0;_2<this.fields.length;_2++){if(typeof this.fields[_2]=="string"){_1.push(this.fields[_2]);}else{_1.push(this.fields[_2].name);}}
this.store=new Ext.data.JsonStore({url:this.url+this.method,remoteSort:this.remoteSort,totalProperty:"numFound",root:"data",fields:this.fields,pruneModifiedRecords:true,baseParams:{limit:this.limit,field:this.searchField,query:this.searchValue,letter:this.searchLetter},listeners:{"load":{fn:this._checkPagination,scope:this}}});if(Ext.type(this.columns)=="array"){for(var _2=0;_2<this.columns.length;_2++){if(typeof this.columns[_2].header=="undefined"){var _3=this.columns[_2].dataIndex;if(this.headers[_3]){this.columns[_2].header=this.headers[_3];}else{this.columns[_2].header=_3;}}
if(this.columns[_2].addRenderer){switch(this.columns[_2].rendererType){case"userLink":this.columns[_2]["renderer"]=this.formatLinkToUserRenderer;break;case"verified":this.columns[_2]["renderer"]=this.yesNoIconRenderer;break;case"fullQtip":this.columns[_2]["renderer"]=this.fullQtipRenderer.createDelegate(this);break;case"qtip":this.columns[_2]["renderer"]=this.qtipRenderer;break;case"productLink":this.columns[_2]["renderer"]=this.formatLinkToProductRenderer;break;case"membership":this.columns[_2]["renderer"]=this.formatMembershipIdToName;break;case"simpleLink":this.columns[_2]["renderer"]=this.simpleLinkRenderer.createDelegate(this);break;case"userRebateCode":this.columns[_2]["renderer"]=this.userRebateCodeRenderer.createDelegate(this);break;default:break;}}}}
this.tbar=[];if(this.includeAdd){this.add_btn=new Ext.Button({text:this.standardLabel.buttons.add_new_label,cls:this.toolbarButtonCls,handler:this.add_new,scope:this});this.tbar.push(this.add_btn);}
if(this.includeDelete&&this.deleteMethod){this.delete_btn=new Ext.Button({text:this.standardLabel.buttons.delete_label,cls:this.toolbarButtonCls,handler:this.check_delete_message,scope:this});this.tbar.push(this.delete_btn);}
if(this.includeRefresh){this.refresh_btn=new Ext.Button({text:this.standardLabel.buttons.refresh_btn,cls:this.toolbarButtonCls,handler:this.refreshGrid,scope:this});this.tbar.push(this.refresh_btn);}
if(this.includeDownload){this.download_btn=new Ext.Button({text:this.standardLabel.buttons.download_btn,cls:this.toolbarButtonCls,handler:this.downloadResults,scope:this});this.tbar.push(this.download_btn);}
if(this.includeFilter){if(!(this.filterStore=Ext.StoreMgr.lookup(this.filterStoreType))){this.filterStore=Ext.StoreMgr.add(this.filterStoreType,new Ext.data.JsonStore({url:this.url+this.filterMethod,root:"data",fields:["value","label"],autoLoad:false}));}
this.filter_combo=new Ext.form.ComboBox({store:this.filterStore,width:this.filterComboWidth,emptyText:"Select...",fieldLabel:this.filterLabel,listWidth:this.filterComboWidth,valueField:"value",displayField:"label",typeAhead:false,mode:"local",triggerAction:"all",listeners:{"select":{fn:this.filterGrid,scope:this}}});this.tbar.push(this.filter_combo);}
this.bbar=[];if(this.includeDelete&&this.deleteMethod){this.delete_btn_two=new Ext.Button({text:this.standardLabel.buttons.delete_label,cls:this.toolbarButtonCls,handler:this.check_delete_message,scope:this});this.bbar.push(this.delete_btn_two);}
if(this.includePagination){if(this.pageSizeStoreType){if(!(this.paginationStore=Ext.StoreMgr.lookup(this.pageSizeStoreType))){this.paginationStore=Ext.StoreMgr.add(this.pageSizeStoreType,new Ext.data.JsonStore({url:this.common_url+"&method=getPagesizes",root:"data",fields:["pagesize"],autoLoad:true}));}
if(this.paginationStore){this.pagingCombo=new Ext.form.ComboBox({store:this.paginationStore,width:this.pageSizeComboWidth,emptyText:this.limit,listWidth:this.pageSizeComboWidth,displayField:"pagesize",typeAhead:false,mode:"local",triggerAction:"all",listeners:{"select":{fn:this.setPageSize,scope:this}}});this.tbar.push({xtype:"tbfill"},{xtype:"label",text:this.pagingSizeLabel},this.pagingCombo);}}
this.ptoolbar=new Ext.PagingToolbar({store:this.store,width:this.pagingToolbarWidth,pageSize:this.limit,displayInfo:true});this.bbar.push(this.ptoolbar);}
Ext.grid.DynamicGridPanel.superclass.initComponent.call(this);},initEvents:function(){if(this._allowLoad){if(this.autoLoad){this.store.load();}else{this.store.removeAll();}
if(this.includeFilter){this.filterStore.on("load",this.preselectGrid,this);this.filterStore.load();}}
Ext.grid.DynamicGridPanel.superclass.initEvents.call(this);},_checkPagination:function(_4,_5,_6){if(this.includePagination){if(_6&&_6.params){if(_5.length==0&&_6.params.start>0){this.ptoolbar.changePage(1);}}}},add_new:function(){this.fireEvent("add_new");},check_delete_message:function(){var _7;if(this.delete_id!="search_like_terms_id"&&this.delete_id!="client_data_mapping_id"){this.delete_records();}else{if(this.delete_id=="search_like_terms_id"){Ext.Msg.show({title:"Terms",msg:"Are you sure you want to delete these terms?",buttons:Ext.Msg.YESNOCANCEL,fn:this.checkDelete,animEl:"elId",icon:Ext.MessageBox.QUESTION,scope:this});}
if(this.delete_id=="client_data_mapping_id"){Ext.Msg.show({title:"Mappings",msg:"Are you sure you want to delete these mappings?",buttons:Ext.Msg.YESNOCANCEL,fn:this.checkDelete,animEl:"elId",icon:Ext.MessageBox.QUESTION,scope:this});}}},checkDelete:function(_8){if(_8=="yes"){this.delete_records();}else{return false;}},delete_records:function(){var _9=this.getSelectionModel();if(_9.hasSelection()){var _a=_9.getSelections();var _b=_9.getCount();for(var i=0;i<_b;i++){Ext.Ajax.request({url:this.url+this.deleteMethod,params:{id:_a[i].get(this.delete_id)}});}
_9.clearSelections();this.refreshGrid();}},refreshGrid:function(){this.store.baseParams["limit"]=this.limit;this.store.load();},_fireRowSelectionEvent:function(sm,_e,_f){this.fireEvent("rowSelected",this,sm,_e,_f);},_fireCellSelectionEvent:function(sm,row,col){this.fireEvent("rowSelected",this,sm,row,col);},preselectGrid:function(_13,_14,_15){if(_14){this.filter_combo.setValue(_14[0].data.label);}
this.removeListener("load",this.preselectGrid,this);},filterGrid:function(_16,_17,_18){if(_17&&_17.data){this.store.baseParams["query"]=_17.data.value;this.refreshGrid();this.fireEvent("gridFiltered");}},setPageSize:function(_19,_1a,_1b){if(_1a&&_1a.data){this.limit=_1a.data.pagesize;this.ptoolbar.pageSize=this.limit;this.refreshGrid();}},downloadResults:function(){if(this.downloadMethod){window.open(this.url+this.downloadMethod);}
if(this.fireDownloadEvent){var _1c=this.store.getSortState();var o=this.store.baseParams;if(_1c){o["sort"]=_1c["field"];o["dir"]=_1c["direction"];}
this.fireEvent("downloadResults",this,o);}},simpleLinkRenderer:function(_1e,_1f,_20,_21){return"<a href=\"javascript: Ext.getCmp('"+this.id+"').fireClickEvent('"+_21+"');\" >"+_1e+"</a>";},fireClickEvent:function(id){this.fireEvent("editClicked",id);},formatLinkToUserRenderer:function(_23,_24,_25,_26){return"<a href=\"admin.php?target=user_edit&user_id="+_25.data.user_id+"\">"+_23+"</a>";},formatLinkToProductRenderer:function(_27,_28,_29,_2a){var _2b="manage-root-item";if(_29.data.avail=="N"){_2b+="-disabled";}
if(_27){var _2c=_27.replace("\"","''");_2c=_2c.replace("'","'");return"<a href=\"admin.php?target=products&mode=update&product_id="+_29.data.product_id+"\" class=\""+_2b+"\" ext:qtip=\""+_2c+"\">"+_27+"</a>";}
return"<a href=\"admin.php?target=products&mode=update&product_id="+_29.data.product_id+"\" class=\""+_2b+"\">"+_27+"</a>";},formatMembershipIdToName:function(_2d,_2e,_2f,_30,_31,_32){if(!_2f.dirty){if(_2f.data.membership){return _2f.data.membership;}
return _2d;}},yesNoIconRenderer:function(_33,_34,_35,_36){if(_33=="N"){_34["css"]="dealer-queue-not-verified";return"";}
if(_33=="Y"){_34["css"]="dealer-queue-is-verified";return"";}},fullQtipRenderer:function(_37,_38,_39,_3a){if(!_37){_37="&nbsp;";}
if(_39.data.tooltip){var _3b=_39.data.tooltip.replace("\"","''");_3b=_3b.replace("'","'");return"<div ext:qtip=\""+_3b+"\">"+_37+"</div>";}else{return this.qtipRenderer(_37,_38,_39,_3a);}},qtipRenderer:function(_3c,_3d,_3e,_3f){if(_3c){var _40=_3c.replace("\"","''");_40=_40.replace("'","'");return"<div ext:qtip=\""+_40+"\">"+_3c+"</div>";}
return _3c;},userRebateCodeRenderer:function(_41,_42,_43,_44){if(_41){return _41;}else{return _43.data.rebate_code;}}});Ext.reg("dynamicgridpanel",Ext.grid.DynamicGridPanel);
Ext.grid.SimpleGridPanel=Ext.extend(Ext.grid.GridPanel,{autoHeight:true,autoExpandColumn:"",autoLoad:false,pagingSizeLabel:"Page Size: ",pageSizeStoreType:"pagination_pagesize",pageSizeComboWidth:50,limit:10,pagingToolbarWidth:820,toolbarButtonCls:"admin-toolbar-btn",url:null,common_url:"json.php?area=A&target=common",remoteSort:true,loadOnActivate:false,selectFirst:false,loadMask:true,searchField:"",searchValue:"",searchLetter:"",viewConfig:{forceFit:true,emptyText:"No results could be found for the specified parameters.",deferEmptyText:true},gridFilterLabel:"Filter by task:",comboBoxEmptyLabel:"Select task...",gridFilterMethod:"&method=getAllJobTypes",includeJobFilter:false,includeAdd:false,includeDelete:true,deleteMethod:"",includeRefresh:true,includeDownload:true,downloadMethod:"",includePagination:true,checkSelection:true,forceSingleSelect:false,suspendSelectionEvents:false,method:"",storeType:"",tabName:"",columns:[],standardLabel:{buttons:{add_new_label:"Add New",delete_label:"Delete",refresh_btn:"Refresh",download_btn:"Download"},errors:{error_title:"Error",error_msg:"There was an error processing this request"}},initComponent:function(){this.columns=this.columns.slice();if(this.columns.length>0){this._allowLoad=true;}else{this._allowLoad=false;}
if(this.checkSelection){this.sm=new Ext.grid.CheckboxSelectionModel({singleSelect:this.forceSingleSelect});this.columns.unshift(this.sm);}else{this.sm=new Ext.grid.RowSelectionModel({singleSelect:this.forceSingleSelect,listeners:{"rowselect":{fn:this.row_selected,scope:this}}});}
if(this.suspendSelectionEvents&&this.sm){this.sm.suspendEvents();}
var _1=[];for(var _2=0;_2<this.fields.length;_2++){if(typeof this.fields[_2]=="string"){_1.push(this.fields[_2]);}else{_1.push(this.fields[_2].name);}}
if(this.storeType){if(!(this.store=Ext.StoreMgr.lookup(this.storeType))){this.store=Ext.StoreMgr.add(this.storeType,new Ext.data.JsonStore({url:this.url+this.method,remoteSort:this.remoteSort,totalProperty:"numFound",root:"data",fields:this.fields,autoLoad:this.autoLoad,pruneModifiedRecords:true,baseParams:{limit:this.limit,field:this.searchField,query:this.searchValue,letter:this.searchLetter},listeners:{"load":{fn:this._checkPagination,scope:this}}}));}else{this._allowLoad=false;}}else{this.store=new Ext.data.JsonStore({url:this.url+this.method,remoteSort:this.remoteSort,totalProperty:"numFound",root:"data",fields:this.fields,autoLoad:this.autoLoad,pruneModifiedRecords:true,baseParams:{limit:this.limit,field:this.searchField,query:this.searchValue,letter:this.searchLetter},listeners:{"load":{fn:this._checkPagination,scope:this}}});}
if(Ext.type(this.columns)=="array"){for(var _2=0;_2<this.columns.length;_2++){if(typeof this.columns[_2].header=="undefined"){var _3=this.columns[_2].dataIndex;if(this.headers[_3]){this.columns[_2].header=this.headers[_3];}else{this.columns[_2].header=_3;}}
if(this.columns[_2].addRenderer){switch(this.columns[_2].rendererType){case"verified":this.columns[_2]["renderer"]=this.yesNoIconRenderer;break;case"qtip":this.columns[_2]["renderer"]=this.qtipRenderer;break;case"simpleLink":this.columns[_2]["renderer"]=this.simpleLinkRenderer;break;default:break;}}}}
this.tbar=[];if(this.includeAdd){this.add_btn=new Ext.Button({text:this.standardLabel.buttons.add_new_label,cls:this.toolbarButtonCls,handler:this.add_new,scope:this});this.tbar.push(this.add_btn);}
if(this.includeDelete&&this.deleteMethod){this.delete_btn=new Ext.Button({text:this.standardLabel.buttons.delete_label,cls:this.toolbarButtonCls,handler:this.delete_records,scope:this});this.tbar.push(this.delete_btn);}
if(this.includeRefresh){this.refresh_btn=new Ext.Button({text:this.standardLabel.buttons.refresh_btn,cls:this.toolbarButtonCls,handler:this.refreshGrid,scope:this});this.tbar.push(this.refresh_btn);}
if(this.includeDownload){this.download_btn=new Ext.Button({text:this.standardLabel.buttons.download_btn,cls:this.toolbarButtonCls,handler:this.downloadResults,scope:this});this.tbar.push(this.download_btn);}
this.bbar=[];if(this.includeDelete&&this.deleteMethod){this.delete_btn_two=new Ext.Button({text:this.standardLabel.buttons.delete_label,cls:this.toolbarButtonCls,handler:this.delete_records,scope:this});this.bbar.push(this.delete_btn_two);}
if(this.includeGridFilter){this.filterStore=new Ext.data.JsonStore({url:this.url+this.gridFilterMethod,baseParams:{type:this.tabName},root:"data",fields:["value","label"],autoLoad:true});if(this.store){this.jobCombo=new Ext.form.ComboBox({store:this.filterStore,emptyText:this.comboBoxEmptyLabel,displayField:"label",typeAhead:false,mode:"local",triggerAction:"all",listeners:{"select":{fn:this.filterGrid,scope:this}}});}
this.tbar.push({xtype:"label",text:this.gridFilterLabel},this.jobCombo);}
if(this.includePagination){if(this.pageSizeStoreType){if(!(this.paginationStore=Ext.StoreMgr.lookup(this.pageSizeStoreType))){this.paginationStore=Ext.StoreMgr.add(this.pageSizeStoreType,new Ext.data.JsonStore({url:this.common_url+"&method=getPagesizes",root:"data",fields:["pagesize"],autoLoad:true}));}
if(this.paginationStore){this.pagingCombo=new Ext.form.ComboBox({store:this.paginationStore,width:this.pageSizeComboWidth,emptyText:this.limit,listWidth:this.pageSizeComboWidth,displayField:"pagesize",typeAhead:false,mode:"local",triggerAction:"all",listeners:{"select":{fn:this.setPageSize,scope:this}}});this.tbar.push({xtype:"tbfill"},{xtype:"label",text:this.pagingSizeLabel},this.pagingCombo);}}
this.ptoolbar=new Ext.PagingToolbar({store:this.store,width:this.pagingToolbarWidth,pageSize:this.limit,displayInfo:true});this.bbar.push(this.ptoolbar);}
Ext.grid.SimpleGridPanel.superclass.initComponent.call(this);},initEvents:function(){if(this._allowLoad){this.store.load();}
Ext.grid.SimpleGridPanel.superclass.initEvents.call(this);},_checkPagination:function(_4,_5,_6){if(this.includePagination){if(_6&&_6.params){if(_5.length==0&&_6.params.start>0){this.ptoolbar.changePage(1);}}}},add_new:function(){this.fireEvent("add_new");},row_selected:function(sm,_8,_9){this.fireEvent("row_selected",sm,_8,_9);},delete_records:function(){var _a=this.getSelectionModel();if(_a.hasSelection()){var _b=_a.getSelections();var _c=_a.getCount();for(var i=0;i<_c;i++){Ext.Ajax.request({url:this.url+this.deleteMethod,params:{lead_id:_b[i].get("lead_id")},failure:function(_e,_f){Ext.MsgBox.alert(this.standardLabel.errors.error_title,this.standardLabel.errors.error_msg);}});}
_a.clearSelections();this.refreshGrid();}},refreshGrid:function(){this.store.baseParams["limit"]=this.limit;this.store.reload();},filterGrid:function(_10,_11,_12){this.store.baseParams["filter_task_id"]=_11.data.value;this.store.reload();},setPageSize:function(_13,_14,_15){if(_14&&_14.data){this.limit=_14.data.pagesize;this.ptoolbar.pageSize=this.limit;this.refreshGrid();}},downloadResults:function(){window.open(this.url+this.downloadMethod);},yesNoIconRenderer:function(_16,_17,_18,_19){if(_16=="N"){_17["css"]="dealer-queue-not-verified";return"";}
if(_16=="Y"){_17["css"]="dealer-queue-is-verified";return"";}},qtipRenderer:function(_1a,_1b,_1c,_1d){if(_1a){var _1e=_1a.replace("\"","''");_1e=_1e.replace("'","'");return"<span ext:qtip=\""+_1e+"\">"+_1a+"</span>";}
return _1a;},simpleLinkRenderer:function(_1f,_20,_21,_22){return"<a href=\"#\">"+_1f+"</a>";}});Ext.reg("simplegridpanel",Ext.grid.SimpleGridPanel);
Ext.form.FileUploadField=Ext.extend(Ext.form.TextField,{buttonText:"Browse...",buttonOnly:false,buttonOffset:5,readOnly:true,autoSize:Ext.emptyFn,initComponent:function(){Ext.form.FileUploadField.superclass.initComponent.call(this);this.addEvents("fileselected");},onRender:function(ct,_2){Ext.form.FileUploadField.superclass.onRender.call(this,ct,_2);this.wrap=this.el.wrap({cls:"x-form-field-wrap x-form-file-wrap"});this.el.addClass("x-form-file-text");this.el.dom.removeAttribute("name");this.fileInput=this.wrap.createChild({id:this.getFileInputId(),name:this.name||this.getId(),cls:"x-form-file",tag:"input",type:"file",size:1});var _3=Ext.applyIf(this.buttonCfg||{},{text:this.buttonText});this.button=new Ext.Button(Ext.apply(_3,{renderTo:this.wrap,cls:"x-form-file-btn"+(_3.iconCls?" x-btn-icon":"")}));if(this.buttonOnly){this.el.hide();this.wrap.setWidth(this.button.getEl().getWidth());}
this.fileInput.on("change",function(){var v=this.fileInput.dom.value;this.setValue(v);this.fireEvent("fileselected",this,v);},this);},getFileInputId:function(){return this.id+"-file";},onResize:function(w,h){Ext.form.FileUploadField.superclass.onResize.call(this,w,h);this.wrap.setWidth(w);if(!this.buttonOnly){var w=this.wrap.getWidth()-this.button.getEl().getWidth()-this.buttonOffset;this.el.setWidth(w);}},preFocus:Ext.emptyFn,getResizeEl:function(){return this.wrap;},getPositionEl:function(){return this.wrap;},alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0]);}});Ext.reg("fileuploadfield",Ext.form.FileUploadField);
Ext.FtpComponent=Ext.extend(Ext.Panel,{cls:"ftp-component-panel",border:false,labelWidth:140,fieldWidth:300,columnWidths:{fields:0.7,buttons:0.3},minimumButtonWidth:150,mode:"FTPS",ftpConnectionType:"payment",includeFileName:false,directoryFileType:"list",lang:{title:{window:"Connection Details"},label:{host:"Host",name:"User Name",password:"Password",location:"Directory",filename:"Filename",movelocation:"Move Directory",movefilename:"Move Filename",sort_order:"Sort Order"},loadMask:{saving:"Saving...",testingFTP:"Testing FTP..."},button:{edit_ftp_connection_details:"Edit Connection Details",test_connection:"Test Connection",test_file_transfer_put:"Test File Output Transfer",test_file_transfer_get:"Test File Input Retrieval",save:"Save",cancel:"Cancel",edit:"Edit",remove:"Delete"},headers:{directory:"Directory",filename:"Filename",sort_order:"Sort Order"}},ajaxTimeout:10000,_window:null,_filenameWindow:null,_loadMask:null,initComponent:function(){var _1=[{xtype:"hidden",id:this.id+"-connection-type",value:this.ftpConnectionType},{id:this.id+"-host",fieldLabel:this.mode+" "+this.lang.label.host,name:"data["+this.ftpConnectionType+"][host]"},{id:this.id+"-name",fieldLabel:this.mode+" "+this.lang.label.name,name:"data["+this.ftpConnectionType+"][name]"},{id:this.id+"-password",fieldLabel:this.mode+" "+this.lang.label.password,name:"data["+this.ftpConnectionType+"][password]",inputType:"password"}];if(this.directoryFileType=="list"){_1.push({id:this.id+"-location",fieldLabel:this.mode+" "+this.lang.label.location,name:"data["+this.ftpConnectionType+"][location]"});}
var _2=[{xtype:"button",text:this.lang.button.edit_ftp_connection_details,minWidth:this.minimumButtonWidth,handler:this.editFtpDetails,scope:this},{xtype:"button",text:this.lang.button.test_connection,minWidth:this.minimumButtonWidth,handler:this.testConnection,scope:this}];if(this.includeFileName&&this.directoryFileType=="list"){_1.push({id:this.id+"-filename",fieldLabel:this.mode+" "+this.lang.label.filename,name:"data["+this.ftpConnectionType+"][filename]"});}
if(this.directoryFileType=="list"){_2.push({xtype:"button",text:this.lang.button.test_file_transfer_put,minWidth:this.minimumButtonWidth,handler:this.testFileOutputTransfer,scope:this});}
if(this.includeFileName&&this.directoryFileType=="list"){_2.push({xtype:"button",text:this.lang.button.test_file_transfer_get,minWidth:this.minimumButtonWidth,handler:this.testFileInputTransfer,scope:this});}
var _3=[];if(this.directoryFileType=="grid"){this.fileDirectoryStore=new Ext.data.JsonStore({url:"json.php?area=A&target=common&method=getFtpDirectoriesAndFiles",root:"data",baseParams:{type:this.ftpConnectionType},autoLoad:false,fields:["filename","location","movefilename","movelocation","sort_order"]});_3.push({xtype:"editorgrid",id:this.id+"-file-grid",cls:"ftp-file-grid",autoHeight:true,store:this.fileDirectoryStore,autoExpandColumn:this.id+"-filename-column",enableColumnMove:false,enableHdMenu:false,width:679,tbar:[{xtype:"tbtext",text:"FTP Files"},{xtype:"tbfill"},{cls:"admin-toolbar-btn",text:"New",handler:this.addFtpLocation.createDelegate(this)}],columns:[{header:this.lang.headers.directory,id:this.id+"-directory-column",width:162,sortable:true,dataIndex:"location",editor:new Ext.form.TextField({allowBlank:false})},{header:this.lang.headers.filename,id:this.id+"-filename-column",width:125,sortable:true,dataIndex:"filename",editor:new Ext.form.TextField({allowBlank:false})},{header:this.lang.headers.sort_order,id:this.id+"-sort-order-column",width:60,sortable:true,dataIndex:"sort_order",align:"center",editor:new Ext.form.NumberField({allowBlank:false,minValue:0,allowNegative:false,allowDecimal:false})},{header:"",width:130,resizable:false,sortable:false,dataIndex:"test_input_retrieval",align:"center",renderer:this.testFileOutputTransferRenderer.createDelegate(this)},{header:"",width:130,resizable:false,dataIndex:"test_output_transfer",align:"center",renderer:this.testFileInputTransferRenderer.createDelegate(this)},{header:"",width:30,resizable:false,sortable:false,dataIndex:"edit",align:"center",renderer:this.editFilenameLocationRenderer.createDelegate(this)},{header:"",width:38,resizable:false,sortable:false,dataIndex:"remove",align:"center",renderer:this.removeFilenameLocationRenderer.createDelegate(this)}],viewConfig:{emptyText:"No ftp locations",forceFit:true},listeners:{"afteredit":{fn:this.updateFtpLocationInfo,scope:this}}});}
this.items=[{layout:"column",frame:false,border:false,items:[{border:false,columnWidth:this.columnWidths.fields,layout:"form",id:this.id+"-ftp-panel",defaults:{xtype:"textfield",cls:"ftp-component-textfields",readOnly:true,labelWidth:this.labelWidth,width:this.fieldWidth},items:_1},{border:false,columnWidth:this.columnWidths.buttons,cls:"ftp-component-test-btns",id:this.id+"-btn-panel",items:_2}]}];if(this.directoryFileType=="grid"){this.items.push({frame:false,border:false,items:_3});}
if(!this._window){this._window=new Ext.Window.FtpComponent({title:this.lang.title.window,lang:this.lang,mode:this.mode,ftpConnectionType:this.ftpConnectionType,includeFileName:this.directoryFileType=="grid"?false:this.includeFileName,includeFileLocation:this.directoryFileType=="grid"?false:true,listeners:{"record_updated":{fn:this.updateFtpDetailDisplay,scope:this}}});}
if(!this._filenameWindow&&this.directoryFileType=="grid"){this._filenameWindow=new Ext.Window.FtpComponentFilename({title:this.lang.title.window,lang:this.lang,mode:this.mode,ftpConnectionType:this.ftpConnectionType,includeFileName:this.directoryFileType=="grid"?false:this.includeFileName,includeFileLocation:this.directoryFileType=="grid"?false:true,listeners:{"location_updated":{fn:this.handleFtpLocationUpdate,scope:this}}});}
if(!this._loadMask){this._loadMask=new Ext.LoadMask(Ext.getBody(),{msg:this.lang.loadMask.testingFTP});}
Ext.FtpComponent.superclass.initComponent.call(this);},initEvents:function(){if(this.fileDirectoryStore){this.fileDirectoryStore.load();}
Ext.FtpComponent.superclass.initEvents.call(this);},editFtpDetails:function(){try{var _4={data:[]};_4.data["host"]=Ext.getCmp(this.id+"-host").getValue();_4.data["name"]=Ext.getCmp(this.id+"-name").getValue();_4.data["password"]=Ext.getCmp(this.id+"-password").getValue();try{_4.data["location"]=Ext.getCmp(this.id+"-location").getValue();}
catch(e){}
try{_4.data["filename"]=Ext.getCmp(this.id+"-filename").getValue();}
catch(e){}
this._window.setValues(_4);this._window.show();}
catch(e){}},updateFtpDetailDisplay:function(_5){if(_5&&_5.data){try{Ext.getCmp(this.id+"-host").setValue(_5.data["host"]);Ext.getCmp(this.id+"-name").setValue(_5.data["name"]);Ext.getCmp(this.id+"-password").setValue(_5.data["password"]);try{Ext.getCmp(this.id+"-location").setValue(_5.data["location"]);}
catch(e){}
try{Ext.getCmp(this.id+"-filename").setValue(_5.data["filename"]);}
catch(e){}}
catch(e){}}},testConnection:function(){this._showLoadMask();Ext.Ajax.request({url:"json.php?area=A&target=common&method=testFtpConnection",params:{type:this.ftpConnectionType},callback:this.handleOutputAjaxCallback,timeout:this.ajaxTimeout,scope:this});},testFileOutputTransfer:function(){this._testFileTransfer("output",0,0);},testFileInputTransfer:function(){this._testFileTransfer("input",0,0);},_testFileTransfer:function(_6,_7,_8){this._showLoadMask();Ext.Ajax.request({url:"json.php?area=A&target=common&method=testFtpFileTransfer",params:{type:this.ftpConnectionType,mode:_6,by_sort_order:_7,sort_order:_8},callback:this.handleOutputAjaxCallback,timeout:this.ajaxTimeout,scope:this});},handleOutputAjaxCallback:function(_9,_a,_b){this._hideLoadMask();webStore.displayConfirmMessageFromAjax(_9,_a,_b);},_showLoadMask:function(){this._loadMask.show();},_hideLoadMask:function(){this._loadMask.hide();},removeFilenameLocationRenderer:function(_c,_d,_e,_f){return"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').removeFilenameLocation("+_f+"); return false;\">"+this.lang.button.remove+"</a>";},editFilenameLocationRenderer:function(_10,_11,_12,_13){return"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').editFilenameLocation("+_13+"); return false;\">"+this.lang.button.edit+"</a>";},testFileOutputTransferRenderer:function(_14,_15,_16,_17){return"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').testFileOutputTransferSortOrder("+_17+"); return false;\">"+this.lang.button.test_file_transfer_put+"</a>";},testFileInputTransferRenderer:function(_18,_19,_1a,_1b){return"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').testFileInputTransferSortOrder("+_1b+"); return false;\">"+this.lang.button.test_file_transfer_get+"</a>";},testFileOutputTransferSortOrder:function(row){var _1d=this.fileDirectoryStore.getAt(row);if(_1d&&_1d.id){this._testFileTransfer("output",1,_1d.data.sort_order);}},testFileInputTransferSortOrder:function(row){var _1f=this.fileDirectoryStore.getAt(row);if(_1f&&_1f.id){this._testFileTransfer("input",1,_1f.data.sort_order);}},updateFtpLocationInfo:function(_20){this._showLoadMask();var _21={};_21["type"]=this.ftpConnectionType;_21["edited_field"]=_20.field;_21["original_value"]=_20.originalValue;_21["new_value"]=_20.value;_21["ftp_data"]=Ext.util.JSON.encode(_20.record.data);Ext.Ajax.request({url:"json.php?area=A&target=common&method=saveFtpLocationField",callback:this.handleFtpLocationInfoCallback.createDelegate(this),params:_21,scope:this});},handleFtpLocationInfoCallback:function(_22,_23,_24){this.fileDirectoryStore.load();this._hideLoadMask();webStore.displayConfirmMessageFromAjax(_22,_23,_24);},addFtpLocation:function(){this._filenameWindow.clearValues();this._filenameWindow.show();},editFilenameLocation:function(row){var _26=this.fileDirectoryStore.getAt(row);if(_26&&_26.id){this._filenameWindow.setValues(_26);this._filenameWindow.show();}},handleFtpLocationUpdate:function(_27){this._showLoadMask();this.fileDirectoryStore.load();this._hideLoadMask();},removeFilenameLocation:function(row){var _29=this.fileDirectoryStore.getAt(row);this._showLoadMask();if(_29&&_29.id){Ext.Ajax.request({url:"json.php?area=A&target=common&method=removeFtpLocation",callback:this.handleFtpLocationInfoCallback.createDelegate(this),params:{sort_order:_29.data.sort_order,type:this.ftpConnectionType},scope:this});}}});Ext.reg("ftpcomponent",Ext.FtpComponent);
Ext.Window.FtpComponent=Ext.extend(Ext.Window,{modal:true,autoScroll:true,autoHeight:true,width:600,labelWidth:140,fieldWidth:350,closeAction:"hide",buttonAlign:"center",mode:"FTPS",ftpConnectionType:"payment",includeFileName:false,includeFileLocation:false,lang:{},initComponent:function(){var _1=[{xtype:"hidden",id:this.id+"-connection-type",name:"type",value:this.ftpConnectionType},{xtype:"textfield",id:this.id+"-host",fieldLabel:this.mode+" "+this.lang.label.host,width:this.fieldWidth,allowBlank:false,name:"data[host]"},{xtype:"textfield",id:this.id+"-name",fieldLabel:this.mode+" "+this.lang.label.name,width:this.fieldWidth,allowBlank:false,name:"data[name]"},{xtype:"textfield",id:this.id+"-password",fieldLabel:this.mode+" "+this.lang.label.password,width:this.fieldWidth,allowBlank:false,name:"data[password]",inputType:"password"}];if(this.includeFileLocation){_1.push({xtype:"textfield",id:this.id+"-location",fieldLabel:this.mode+" "+this.lang.label.location,width:this.fieldWidth,name:"data[location]"});}
if(this.includeFileName){_1.push({xtype:"textfield",id:this.id+"-filename",fieldLabel:this.mode+" "+this.lang.label.filename,width:this.fieldWidth,name:"data[filename]"});}
this.items=[{xtype:"form",cls:"ftp-component-window",labelWidth:this.labelWidth,items:_1}];this.buttons=[{xtype:"button",id:this.id+"-save-btn",text:this.lang.button.save,handler:this.saveHandler,scope:this},{xtype:"button",id:this.id+"-cancel-btn",text:this.lang.button.cancel,handler:this.hideWindow,scope:this}];Ext.Window.FtpComponent.superclass.initComponent.call(this);},initEvents:function(){this.on("show",this.checkForm,this);Ext.Window.FtpComponent.superclass.initEvents.call(this);},checkForm:function(){this.setWindowProperties();},setValues:function(_2){if(_2&&_2.data){try{Ext.getCmp(this.id+"-host").setValue(_2.data["host"]);Ext.getCmp(this.id+"-name").setValue(_2.data["name"]);Ext.getCmp(this.id+"-password").setValue(_2.data["password"]);try{Ext.getCmp(this.id+"-location").setValue(_2.data["location"]);}
catch(e){}
try{Ext.getCmp(this.id+"-filename").setValue(_2.data["filename"]);}
catch(e){}}
catch(e){}}},setWindowProperties:function(){var _3=Ext.get(this.id).getCenterXY();this.setPosition(_3[0],_3[1]);},saveHandler:function(){var _4=this.getComponent(0).getForm();if(_4.isValid()){_4.waitMsgTarget=true;_4.submit({url:"json.php?area=A&target=common&method=saveFtpConnection",success:this.saveSuccessHandler,failure:webStore.displayConfirmMessageFromForm,waitMsg:this.lang.loadMask.saving,scope:this});}else{webStore.displayRequiredFieldsNotFilledMessage();}},saveSuccessHandler:function(_5,_6){webStore.displayConfirmMessageFromForm(_5,_6);this.hideWindow();this.fireUpdateEvent();},fireUpdateEvent:function(){var _7={data:[]};_7.data["host"]=Ext.getCmp(this.id+"-host").getValue();_7.data["name"]=Ext.getCmp(this.id+"-name").getValue();_7.data["password"]=Ext.getCmp(this.id+"-password").getValue();try{_7.data["location"]=Ext.getCmp(this.id+"-location").getValue();}
catch(e){}
try{_7.data["filename"]=Ext.getCmp(this.id+"-filename").getValue();}
catch(e){}
this.fireEvent("record_updated",_7);},hideWindow:function(){this.hide();}});
Ext.Window.FtpComponentFilename=Ext.extend(Ext.Window,{modal:true,autoScroll:true,autoHeight:true,width:600,labelWidth:140,fieldWidth:350,numberFieldWidth:30,closeAction:"hide",buttonAlign:"center",mode:"FTPS",ftpConnectionType:"payment",lang:{},initComponent:function(){var _1=[{xtype:"hidden",id:this.id+"-connection-type",name:"type",value:this.ftpConnectionType},{xtype:"hidden",id:this.id+"-old_sortorder",name:"data[previous_sort_order]"},{xtype:"textfield",id:this.id+"-location",fieldLabel:this.lang.label.location,width:this.fieldWidth,name:"data[location]"},{xtype:"textfield",id:this.id+"-filename",fieldLabel:this.lang.label.filename,width:this.fieldWidth,name:"data[filename]"},{xtype:"textfield",id:this.id+"-movelocation",fieldLabel:this.lang.label.movelocation,width:this.fieldWidth,name:"data[movelocation]"},{xtype:"textfield",id:this.id+"-movefilename",fieldLabel:this.lang.label.movefilename,width:this.fieldWidth,name:"data[movefilename]"},{xtype:"numberfield",id:this.id+"-sortorder",fieldLabel:this.lang.label.sort_order,width:this.numberFieldWidth,name:"data[sort_order]"}];this.items=[{xtype:"form",cls:"ftp-component-window",labelWidth:this.labelWidth,items:_1}];this.buttons=[{xtype:"button",id:this.id+"-save-btn",text:this.lang.button.save,handler:this.saveHandler,scope:this},{xtype:"button",id:this.id+"-cancel-btn",text:this.lang.button.cancel,handler:this.hideWindow,scope:this}];Ext.Window.FtpComponentFilename.superclass.initComponent.call(this);},initEvents:function(){this.on("show",this.checkForm,this);Ext.Window.FtpComponentFilename.superclass.initEvents.call(this);},checkForm:function(){this.setWindowProperties();},setValues:function(_2){if(_2&&_2.data){try{Ext.getCmp(this.id+"-location").setValue(_2.data["location"]);Ext.getCmp(this.id+"-filename").setValue(_2.data["filename"]);Ext.getCmp(this.id+"-movelocation").setValue(_2.data["movelocation"]);Ext.getCmp(this.id+"-movefilename").setValue(_2.data["movefilename"]);Ext.getCmp(this.id+"-sortorder").setValue(_2.data["sort_order"]);Ext.getCmp(this.id+"-old_sortorder").setValue(_2.data["sort_order"]);}
catch(e){}}},clearValues:function(){Ext.getCmp(this.id+"-location").setValue("");Ext.getCmp(this.id+"-filename").setValue("");Ext.getCmp(this.id+"-movelocation").setValue("");Ext.getCmp(this.id+"-movefilename").setValue("");Ext.getCmp(this.id+"-sortorder").setValue("1");Ext.getCmp(this.id+"-old_sortorder").setValue("");},setWindowProperties:function(){var _3=Ext.get(this.id).getCenterXY();this.setPosition(_3[0],_3[1]);},saveHandler:function(){var _4=this.getComponent(0).getForm();if(_4.isValid()){_4.waitMsgTarget=true;_4.submit({url:"json.php?area=A&target=common&method=saveFtpLocationData",success:this.saveSuccessHandler,failure:webStore.displayConfirmMessageFromForm,waitMsg:this.lang.loadMask.saving,scope:this});}else{webStore.displayRequiredFieldsNotFilledMessage();}},saveSuccessHandler:function(_5,_6){webStore.displayConfirmMessageFromForm(_5,_6);this.hideWindow();this.fireUpdateEvent();},fireUpdateEvent:function(){this.fireEvent("location_updated");},hideWindow:function(){this.hide();}});
Ext.namespace("Ext.ux");Ext.ux.GMapPanel=Ext.extend(Ext.Panel,{images_dir:"",border:false,respErrors:[{code:400,msg:"A directions request could not be successfully parsed. For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed."},{code:500,msg:"A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known."},{code:601,msg:"The HTTP q parameter was either missing or had no value. For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input."},{code:601,msg:"Synonym for G_GEO_MISSING_QUERY."},{code:602,msg:"No corresponding geographic location could be found for the specified address. This may be due to the fact that the address is relatively new, or it may be incorrect."},{code:603,msg:"The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons."},{code:604,msg:"The GDirections object could not compute directions between the points mentioned in the query. This is usually because there is no route available between the two points, or because we do not have data for routing in that region."},{code:610,msg:"The given key is either invalid or does not match the domain for which it was given."},{code:620,msg:"The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time. If you're sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don't send the requests too quickly."}],respErrorTitle:"Error",geoErrorMsgUnable:"Unable to Locate the Address you provided",geoErrorTitle:"Address Location Error",geoErrorMsgAccuracy:"The address provided has a low accuracy.<br><br>Level {0} Accuracy (8 = Exact Match, 1 = Vague Match)",gmapType:"map",zoomLevel:3,yaw:180,pitch:0,displayGeoErrors:false,minGeoAccuracy:7,mapDefined:false,mapDefinedGMap:false,initComponent:function(){this.addEvents("mapready");Ext.ux.GMapPanel.superclass.initComponent.call(this);},afterRender:function(){var wh=this.ownerCt.getSize();Ext.applyIf(this,wh);Ext.ux.GMapPanel.superclass.afterRender.call(this);if(this.gmapType==="map"){this.gmap=new GMap2(this.body.dom);this.mapDefined=true;this.mapDefinedGMap=true;}
if(this.gmapType==="panorama"){this.gmap=new GStreetviewPanorama(this.body.dom);this.mapDefined=true;}
if(!this.mapDefined&&this.gmapType){this.gmap=new GMap2(this.body.dom);this.gmap.setMapType(this.gmapType);this.mapDefined=true;this.mapDefinedGMap=true;}
GEvent.bind(this.getMap(),"load",this,this.onMapReady);if(typeof this.setCenter==="object"){if(typeof this.setCenter.geoCodeAddr==="string"){this.geoCodeLookup(this.setCenter.geoCodeAddr,this.setCenter.marker,false,true,this.setCenter.listeners);}else{if(this.gmapType==="map"){var _2=this.fixLatLng(new GLatLng(this.setCenter.lat,this.setCenter.lng));this.getMap().setCenter(_2,this.zoomLevel);}
if(typeof this.setCenter.marker==="object"&&typeof _2==="object"){this.addMarker(_2,this.setCenter.marker,this.setCenter.marker.clear);}}
if(this.gmapType==="panorama"){this.getMap().setLocationAndPOV(new GLatLng(this.setCenter.lat,this.setCenter.lng),{yaw:this.yaw,pitch:this.pitch,zoom:this.zoomLevel});}}},onMapReady:function(){this.addMapControls();this.addOptions();this.addMarkers(this.markers);this.addKMLOverlay(this.autoLoadKML);this.fireEvent("mapready",this,this.getMap());},onResize:function(w,h){Ext.ux.GMapPanel.superclass.onResize.call(this,w,h);if(typeof this.getMap()=="object"){this.getMap().checkResize();}},setSize:function(_5,_6,_7){Ext.ux.GMapPanel.superclass.setSize.call(this,_5,_6,_7);if(typeof this.getMap()=="object"){this.getMap().checkResize();}},getMap:function(){return this.gmap;},getCenter:function(){return this.fixLatLng(this.getMap().getCenter());},getCenterLatLng:function(){var ll=this.getCenter();return{lat:ll.lat(),lng:ll.lng()};},addMarkers:function(_9){if(Ext.isArray(_9)){for(var i=0;i<_9.length;i++){if(typeof _9[i].geoCodeAddr=="string"){this.geoCodeLookup(_9[i].geoCodeAddr,_9[i].marker,false,_9[i].setCenter,_9[i].listeners);}else{var _b=this.fixLatLng(new GLatLng(_9[i].lat,_9[i].lng));this.addMarker(_b,_9[i].marker,false,_9[i].setCenter,_9[i].listeners);}}}},addMarker:function(_c,_d,_e,_f,_10){var _11;if(_d.icon){_11=_d.icon;}else{var _11=G_DEFAULT_ICON;try{if(_d.is_preferred&&this.images_dir){_11=new GIcon(G_DEFAULT_ICON,this.images_dir+"/pmarker.png");}else{if(_d.row&&this.images_dir){_11=new GIcon(G_DEFAULT_ICON,this.images_dir+"/map_icons/marker"+_d.row+".png");}}}
catch(e){_11=G_DEFAULT_ICON;}}
if(_e===true){this.getMap().clearOverlays();}
if(_f===true){this.getMap().setCenter(_c,this.zoomLevel);}
var _12=new GMarker(_c,_11);var _13=_d.index?_d.index:this._selfIndex++;if(!this._eventListeners){this._eventListeners=[];}
if(typeof _10==="object"){for(evt in _10){this._eventListeners.push(GEvent.bind(_12,evt,this,_10[evt]));}}
this._eventListeners.push(GEvent.bind(_12,"click",this,this.selectMarker.createDelegate(this,[_13],true)));this.getMap().addOverlay(_12);if(!this._markers){this._markers=[];}
this._markers[_13]=_12;return _12;},addMapControls:function(){if(this.gmapType==="map"){if(Ext.isArray(this.mapControls)){for(i=0;i<this.mapControls.length;i++){this.addMapControl(this.mapControls[i]);}}else{if(typeof this.mapControls==="string"){this.addMapControl(this.mapControls);}else{if(typeof this.mapControls==="object"){this.getMap().addControl(this.mapControls);}}}}},addMapControl:function(mc){var mcf=window[mc];if(typeof mcf==="function"){this.getMap().addControl(new mcf());}},addOptions:function(){if(Ext.isArray(this.mapConfOpts)){var mc;for(i=0;i<this.mapConfOpts.length;i++){this.addOption(this.mapConfOpts[i]);}}else{if(typeof this.mapConfOpts==="string"){this.addOption(this.mapConfOpts);}}},addOption:function(mo){var mof=this.getMap()[mo];if(typeof mof==="function"){this.getMap()[mo]();}},addKMLOverlay:function(_19){if(typeof _19==="string"&&_19!==""){var _1a=new GGeoXml(_19);this.getMap().addOverlay(_1a);}},clearMarkers:function(){try{this.getMap().clearOverlays();}
catch(e){}
this._markers=[];try{var l=this._eventListeners.length;for(var i=l-1;i>=0;i--){GEvent.removeListener(this._eventListeners[i]);}}
catch(e){}
this._eventListeners=[];this._hliteMarker=null;this._selfIndex=0;},geoCodeLookup:function(_1d,_1e,_1f,_20,_21){if(!this.geocoder){this.geocoder=new GClientGeocoder();}
this.geocoder.getLocations(_1d,this.addAddressToMap.createDelegate(this,[_1d,_1e,_1f,_20,_21],true));},addAddressToMap:function(_22,_23,_24,_25,_26,_27){if(!_22||_22.Status.code!=200){this.respErrorMsg(_22.Status.code);}else{place=_22.Placemark[0];addressinfo=place.AddressDetails;accuracy=addressinfo.Accuracy;if(accuracy===0){this.geoErrorMsg(this.geoErrorTitle,this.geoErrorMsgUnable);}else{if(accuracy<this.minGeoAccuracy){this.geoErrorMsg(this.geoErrorTitle,String.format(this.geoErrorMsgAccuracy,accuracy));}else{point=this.fixLatLng(new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]));if(_26){this.getMap().setCenter(point,this.zoomLevel);}
if(typeof _24==="object"){if(!_24.title){_24.title=place.address;}
Ext.applyIf(_24,G_DEFAULT_ICON);this.addMarker(point,_24,_25,false,_27);}}}}},geoErrorMsg:function(_28,msg){if(this.displayGeoErrors){Ext.MessageBox.alert(_28,msg);}},respErrorMsg:function(_2a){Ext.each(this.respErrors,function(obj){if(_2a==obj.code){Ext.MessageBox.alert(this.respErrorTitle,obj.msg);}},this);},fixLatLng:function(llo){if(this.getMap().getCurrentMapType()){if(this.getMap().getCurrentMapType().QO=="visible"){llo.lat(180-llo.lat());llo.lng(180-llo.lng());}}
return llo;},_eventListeners:null,_markers:null,_selfIndex:0,_hliteMarker:null,selectMarker:function(_2d,_2e){if(_2d){try{this.getMap().setCenter(_2d);this.fireEvent("markerselect",this,_2d.lat(),_2d.lng(),_2e);}
catch(e){}}},highlightMarker:function(_2f,_30){if(Ext.type(this._hliteMarker)=="object"){try{this._hliteMarker["marker"].setImage(this._hliteMarker["standardImg"]);}
catch(e){}
this._hliteMarker=null;}
if(this._markers[_2f]&&_30){var _31=this._markers[_2f].getIcon();this._hliteMarker={marker:this._markers[_2f],standardImg:_31.image,hiliteImg:_30};this._markers[_2f].setImage(_30);}},replaceMarker:function(_32,_33,_34,_35,_36,_37){this.removeMarker(_32);this.addMarker(_32,_33,_34,_35,_36,_37);},removeMarker:function(_38){if(this._markers[_38]){try{this.getMap().removeOverlay(this._markers[_38]);}
catch(e){}
this._markers[_38]=null;}}});Ext.reg("gmappanel",Ext.ux.GMapPanel);
Ext.ns("Ext.ux.grid");Ext.ux.grid.Search=function(_1){Ext.apply(this,_1);Ext.ux.grid.Search.superclass.constructor.call(this);};Ext.extend(Ext.ux.grid.Search,Ext.util.Observable,{searchText:"Search",searchTipText:"Type a text to search and press Enter",selectAllText:"Select All",position:"top",iconCls:"icon-magnifier",checkIndexes:"all",disableIndexes:[],dateFormat:undefined,showSelectAll:true,mode:"remote",width:200,xtype:"gridsearch",paramNames:{fields:"fields",query:"query"},shortcutKey:"r",shortcutModifier:"alt",init:function(_2){this.grid=_2;_2.onRender=_2.onRender.createSequence(this.onRender,this);_2.reconfigure=_2.reconfigure.createSequence(this.reconfigure,this);},onRender:function(){var _3=this.grid;var tb="bottom"==this.position?_3.bottomToolbar:_3.topToolbar;this.menu=new Ext.menu.Menu();if("right"===this.align){tb.addFill();}else{if(tb.items.getCount()>0){tb.addSeparator();}}
tb.add({text:this.searchText,menu:this.menu,iconCls:this.iconCls});this.field=new Ext.form.TwinTriggerField({width:this.width,selectOnFocus:undefined===this.selectOnFocus?true:this.selectOnFocus,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",onTrigger1Click:this.onTriggerClear.createDelegate(this),onTrigger2Click:this.onTriggerSearch.createDelegate(this),minLength:this.minLength});this.field.on("render",function(){this.field.el.dom.qtip=this.searchTipText;var _5=new Ext.KeyMap(this.field.el,[{key:Ext.EventObject.ENTER,scope:this,fn:this.onTriggerSearch},{key:Ext.EventObject.ESC,scope:this,fn:this.onTriggerClear}]);_5.stopEvent=true;},this,{single:true});tb.add(this.field);this.reconfigure();if(this.shortcutKey&&this.shortcutModifier){var _6=this.grid.getEl();var _7=[{key:this.shortcutKey,scope:this,stopEvent:true,fn:function(){this.field.focus();}}];_7[0][this.shortcutModifier]=true;this.keymap=new Ext.KeyMap(_6,_7);}},onTriggerClear:function(){this.field.setValue("");this.field.focus();this.onTriggerSearch();},onTriggerSearch:function(){if(!this.field.isValid()){return;}
var _8=this.field.getValue();var _9=this.grid.store;if("local"===this.mode){_9.clearFilter();if(_8){_9.filterBy(function(r){var _b=false;this.menu.items.each(function(_c){if(!_c.checked||_b){return;}
var rv=r.get(_c.dataIndex);rv=rv instanceof Date?rv.format(this.dateFormat||r.fields.get(_c.dataIndex).dateFormat):rv;var re=new RegExp(_8,"gi");_b=re.test(rv);},this);if(_b){return true;}
return _b;},this);}else{}}else{if(_9.lastOptions&&_9.lastOptions.params){_9.lastOptions.params[_9.paramNames.start]=0;}
var _f=[];this.menu.items.each(function(_10){if(_10.checked){_f.push(_10.dataIndex);}});delete(_9.baseParams[this.paramNames.fields]);delete(_9.baseParams[this.paramNames.query]);if(_9.lastOptions&&_9.lastOptions.params){delete(_9.lastOptions.params[this.paramNames.fields]);delete(_9.lastOptions.params[this.paramNames.query]);}
if(_f.length){_9.baseParams[this.paramNames.fields]=Ext.encode(_f);_9.baseParams[this.paramNames.query]=_8;}
_9.reload();}},setDisabled:function(){this.field.setDisabled.apply(this.field,arguments);},enable:function(){this.setDisabled(false);},disable:function(){this.setDisabled(true);},reconfigure:function(){var _11=this.menu;_11.removeAll();if(this.showSelectAll){_11.add(new Ext.menu.CheckItem({text:this.selectAllText,checked:!(this.checkIndexes instanceof Array),hideOnClick:false,handler:function(_12){var _13=!_12.checked;_12.parentMenu.items.each(function(i){if(_12!==i&&i.setChecked){i.setChecked(_13);}});}}),"-");}
var cm=this.grid.colModel;Ext.each(cm.config,function(_16){var _17=false;if(_16.header&&_16.dataIndex){Ext.each(this.disableIndexes,function(_18){_17=_17?_17:_18===_16.dataIndex;});if(!_17){_11.add(new Ext.menu.CheckItem({text:_16.header,hideOnClick:false,checked:"all"===this.checkIndexes,dataIndex:_16.dataIndex}));}}},this);if(this.checkIndexes instanceof Array){Ext.each(this.checkIndexes,function(di){var _1a=_11.items.find(function(itm){return itm.dataIndex===di;});if(_1a){_1a.setChecked(true,true);}},this);}}});
var ImageGallery=function(_1,_2){ImageGallery.superclass.constructor.call(this,_1,_2);};Ext.extend(ImageGallery,Ext.Panel,{layout:"fit",border:false,bodyBorder:false,autoScroll:false,autoHeight:true,thumbWidthMax:50,thumbHeightMax:50,displayHeightMax:200,displayWidthMax:200,changeAction:"mouseover",includeControls:false,imageNum:3,displayImageAltHover:"N",gatewayURL:"",flagText:null,flagTextColor:null,flagFlagColor:null,flagImageId:0,flagImageType:"common",flagFirstImageOnly:false,cls:"image-gallery-panel wse-imgglry-panel",_galleryLargeViews:null,_imageID:0,_contX1:null,_contX2:null,_contX3:null,_contX4:null,_tableX:null,_animTask:null,_changeTask:null,initComponent:function(){var _3=this.getId();this._galleryLargeViews={};this.store=new Ext.data.JsonStore({autoLoad:false,url:this.gatewayURL,id:"image_key",fields:["image_type","image_key","image_id","detailed_id","image_x","image_y","alt","display_x","display_y","thumb_x","thumb_y","detailed_type","detailed_id","detailed_x","detailed_y"]});var _4=(this.changeAction=="click")?"onclick":"onmouseover";var _5=(this.changeAction=="click")?"changeImage":"schedImageChange";var _6=(this.changeAction=="click")?"":" onmouseout=\"Ext.getCmp('"+_3+"').cancelImageChange(); return false;\"";var _7="";if(this.includeControls){_7="<div class=\"wse-cntrls wse-cntrlthmbs-{[values.length]}\">";_7+="<div class=\"wse-prev\"><a href=\"#\" onclick=\"Ext.getCmp('"+_3+"').scrollThumbs('r', this); return false;\"></a></div>";_7+="<div class=\"wse-next\"><a href=\"#\" onclick=\"Ext.getCmp('"+_3+"').scrollThumbs('l', this); return false;\"></a></div>";_7+="</div>";}
var _8="";if(this.flagText&&this.flagText.length){_8="<div class=\"wse-flag\" id=\""+_3+"-flag\" style=\"display: none;\">"+"<div class=\"wse-wrap wse-wrap-flag\">"+"<div class=\"wse-icon\"";if(this.flagImageId){if(this.flagImageType){_8+=" style=\"background-image: url(image.php?object_type="+this.flagImageType+"&amp;image_id="+this.flagImageId+");\"";}else{_8+=" style=\"background-image: url(image.php?object_type=common&amp;image_id="+this.flagImageId+");\"";}}
_8+="></div>"+"<div class=\"wse-desc\"";if(this.flagFlagColor&&this.flagTextColor){_8+=" style=\"background-color: "+this.flagFlagColor+"; color: "+this.flagTextColor+";\"";}else{if(this.flagFlagColor){_8+=" style=\"background-color: "+this.flagFlagColor+";\"";}else{if(this.flagTextColor){_8+=" style=\"color: "+this.flagTextColor+";\"";}}}
_8+="><span>"+this.flagText+"</span></div>"+"</div></div>";}
var _9=_8+"<div class=\"image-gallery-mainimage-wrapper wse-mainimg\">"+"<div class=\"image wse-img\" id=\"image-gallery-mainimage\" onclick=\"Ext.getCmp('"+_3+"').zoomImage();\"></div>"+"<div class=\"zoomclick wse-zoom\" onclick=\"Ext.getCmp('"+_3+"').zoomImage();\"></div>"+"</div>"+_7+"<div class=\"image-gallery-thumbs wse-thmbs{[values.length < 2 ? \" image-gallery-thumbs-single wse-thmbs-sing\":\"\"]}{[values.length >= 2 ? \" image-gallery-thumbs-multi wse-thmbs-multi image-gallery-thumbs\"+values.length+\" wse-thmbnum-\"+values.length:\"\"]}\" id=\"image-gallery-thumbs\">"+"<table cellspacing=\"0\" class=\"wse-tbl\" id=\"showroom-gallery-thumb-table\"><tr>"+"<tpl for=\".\">"+"<td class=\"thumb wse-td{[xindex == 1 ? \" first wse-first\":\"\"]}{[xindex == xcount ? \" last ws-last\":\"\"]}\" "+_4+"=\"Ext.getCmp('"+_3+"')."+_5+"({image_key}, this); return false;\""+_6+">"+"<img src=\"image.php?object_type={image_type}&amp;image_id={image_id}\" height=\"{thumb_y}\" width=\"{thumb_x}\" alt=\"{alt}\" />"+"</td>"+"</tpl>"+"</tr></table>"+"</div>";var _a=new Ext.XTemplate(_9);this.items=[new Ext.DataView({tpl:_a,store:this.store,overClass:"image-gallery-thumb-over wse-over",itemSelector:"td.wse-td",emptyText:"<div class=\"image-gallery-mainimage-wrapper wse-mainimg\">"+"<div class=\"image wse-img wse-noimg\" id=\"image-gallery-mainimage\" ></div>"+"</div>",loadingText:"Loading...",autoHeight:true})];ImageGallery.superclass.initComponent.call(this);this.loadGallery.defer(250,this);},initEvents:function(){this.store.on("load",this.receiveGalleryData,this);ImageGallery.superclass.initEvents.call(this);},beforeDestroy:function(){try{}
catch(e){}
ImageGallery.superclass.beforeDestroy.call(this);},loadGallery:function(_b){var _b={"resize_settings[thumb_width]":this.thumbWidthMax,"resize_settings[thumb_height]":this.thumbHeightMax,"resize_settings[display_width]":this.displayWidthMax,"resize_settings[display_height]":this.displayHeightMax,"image":"image"+this.imageNum};this.store.load({params:_b});},receiveGalleryData:function(){var _c=false;try{var _d=this.store.getAt(0);this.changeImage(_d.data.image_key,"first");if(!this.includeControls){var _e=Ext.get("image-gallery-thumbs");_e.hover(this.triggerIncrementAnim,this.stopIncrementAnim,this);}}
catch(e){_c=true;}
if(_c){try{var _f="<img id=\"image-gallery-mainimage-img\" src=\"image.php?image_id= \"  />";var _e=Ext.get("image-gallery-mainimage");_e.update(_f);Ext.get("image-gallery-mainimage-img").show(true);}
catch(e){}}},schedImageChange:function(_10,_11){this.cancelImageChange();this._changeTask=new Ext.util.DelayedTask();this._changeTask.delay(250,this.changeImage,this,[_10,_11]);},cancelImageChange:function(){if(this._changeTask){this._changeTask.cancel();}},changeImage:function(_12,_13){if(_12){this.cancelImageChange();this._imageID=_12;var _14=this.store.getById(_12);var _15="<img id=\"image-gallery-mainimage-img\" src=\"image.php?object_type="+_14.data["image_type"]+"&amp;image_id="+_14.data["image_id"]+"\" height=\""+_14.data["display_y"]+"\" width=\""+_14.data["display_x"]+"\" alt=\""+_14.data["alt"]+"\"";_15+=(this.displayImageAltHover=="Y")?"\" title=\""+_14.data["alt"]+"\" />":" />";var _16=Ext.get("image-gallery-mainimage");_16.update(_15);try{Ext.get("image-gallery-mainimage-img").show(true);}
catch(e){}
if(_13){this.showSelectCell(_13);}
this.showOrHideFlag(_12);}},showOrHideFlag:function(_17){if(!this.flagText||!_17){return false;}
try{var _18=Ext.get(this.getId()+"-flag");if(_18){if(!this.flagFirstImageOnly){_18.show();return true;}
var _19=this.store.getAt(0);if(_19.id==_17){_18.show();return true;}
_18.hide();return false;}}
catch(e){return false;}},showSelectCell:function(_1a){var _1b=Ext.get("showroom-gallery-thumb-table");if(_1b){var tds=_1b.select("td.wse-selected");if(tds){tds.each(function(el){el.removeClass("wse-selected");});}
if(_1a=="first"){_1b=_1b.child("td.wse-first");if(_1b){_1b.addClass("wse-selected");}}else{if(_1a){try{Ext.fly(_1a).addClass("wse-selected");}
catch(e){}}}}},zoomImage:function(){if(this._imageID){var _1e=this.store.getById(this._imageID);if(_1e.data["detailed_id"]){this.viewLargeGalleryImage("image-gallery-mainimage",_1e.data["detailed_id"],_1e.data["detailed_x"],_1e.data["detailed_y"],_1e.data["detailed_type"]?_1e.data["detailed_type"]:"detailed");}else{this.viewLargeGalleryImage("image-gallery-mainimage",_1e.data["image_id"],_1e.data["image_x"],_1e.data["image_y"],_1e.data["image_type"]);}}},setAnimCoords:function(){var _1f=Ext.get("image-gallery-thumbs");this._contX1=_1f.getLeft();this._contX2=this._contX1+50;this._contX4=_1f.getRight();this._contX3=this._contX4-50;},triggerIncrementAnim:function(){this.setAnimCoords();try{if(this._animTask){Ext.TaskMgr.stop(this._animTask);}
this._animTask=Ext.TaskMgr.start({run:this.try2Animate,scope:this,interval:100});}
catch(e){}},stopIncrementAnim:function(){try{if(this._animTask){Ext.TaskMgr.stop(this._animTask);}}
catch(e){}},try2Animate:function(){var _20=Ext.get("image-gallery-thumbs");if((mouseX>this._contX1)&&(mouseX<this._contX2)){_20.scroll("right",5);}else{if((mouseX>this._contX3)&&(mouseX<this._contX4)){_20.scroll("left",5);}}},scrollThumbs:function(_21,_22){try{Ext.get(_22).focus().blur();}
catch(e){}
try{var div=Ext.get("image-gallery-thumbs");var w=Math.round(div.getWidth());div.scroll(_21,w,true);}
catch(e){}},viewLargeGalleryImage:function(_25,_26,_27,_28,_29){_26=Number(_26);_27=Number(_27);_28=Number(_28);if(_26&&_27&&_28){var _2a="image_"+_26;var _2b=null;if(getViewportSize){var _2c=getViewportSize();var bw=Math.round(_2c[0]*0.75);var bh=Math.round(_2c[1]*0.75);}else{var b=Ext.getBody();var bw=Math.round(b.getWidth()*0.75);var bh=Math.round(b.getHeight()*0.75);}
if((_27>bw)||(_28>bh)){var _30=bw/_27;var _31=bh/_28;if(_30<=_31){_27=bw;_28=Math.round(_30*_28);}else{_28=bh;_27=Math.round(_31*_27);}}
if(!this._galleryLargeViews[_2a]){this._galleryLargeViews[_2a]=new Ext.Window({layout:"fit",closable:true,cls:"wse-win-img",shim:true,bodyStyle:"padding:0;",width:_27+20,buttonAlign:"center",animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,animateTarget:null,shadow:false,resizable:false,items:[{xtype:"panel",border:false,html:"<div class=\"wse-wrap wse-wrap-img\"><img onclick=\"galleryLargeViews['"+_2a+"'].hide(); return false;\" src=\"image.php?object_type="+_29+"&amp;image_id="+_26+"\" width=\""+_27+"\" height=\""+_28+"\" alt=\"\" /></div>"}]});}
if(_25){_2b=Ext.get(_25);}
this._galleryLargeViews[_2a].show(_2b);}}});Ext.reg("imagegallery",ImageGallery);
Ext.form.LongComboBox=Ext.extend(Ext.form.ComboBox,{minHeight:37,restrictHeight:function(){this.innerList.dom.style.height="";var _1=this.innerList.dom;var _2=this.list.getFrameWidth("tb")+(this.resizable?this.handleHeight:0)+this.assetHeight;var h=Math.max(_1.clientHeight,_1.offsetHeight,_1.scrollHeight);var ha=this.getPosition()[1]-Ext.getBody().getScroll().top;var hb=Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;var _6=Math.max(ha,hb,0)-this.list.shadowOffset-_2-5;h=Math.min(h,_6);h=h.constrain(this.minHeight,this.maxHeight);this.innerList.setHeight(h);this.list.beginUpdate();this.list.setHeight(h+_2);this.list.alignTo(this.wrap,this.listAlign);this.list.endUpdate();}});Ext.reg("longcombo",Ext.form.LongComboBox);
var MessageButton=function(_1,_2){MessageButton.superclass.constructor.call(this,_1,_2);};Ext.extend(MessageButton,Ext.Button,{msg_name:null,lang_code:"EN",title:"Message",text:"",tooltip:"Help",cls:"help-tip-btn",message_window:null,initComponent:function(){this.handler=this.openMessage;this.template=new Ext.XTemplate("<div><button class=\"x-btn-text\">{0}</button></div>");MessageButton.superclass.initComponent.call(this);},openMessage:function(_3,_4){if(_4.getPageX()==0){return;}
if(this.msg_name&&this.lang_code){if(!this.message_window){this.message_window=new MessageWindow({title:this.title,msg_name:this.msg_name,lang_code:this.lang_code,listeners:{close:{fn:this.removeWin,scope:this}}});}
this.message_window.show(this.getEl());}},initEvents:function(){MessageWindow.superclass.initEvents.call(this);},removeWin:function(_5){if(this.message_window){this.message_window=null;}}});var MessageWindow=Ext.extend(Ext.Window,{layout:"fit",closable:true,shim:true,bodyStyle:"padding:1em; margin:0; background-color:#FFF; color:#000",buttonAlign:"center",width:400,height:300,autoScroll:true,animateTarget:null,animCollapse:true,closeAction:"hide",border:false,bodyBorder:false,url:"json.php?target=messages_gateway",shadow:false,method:"getMessage",autoScroll:true,cls:"help-message-win",msg_name:null,lang_code:"EN",initComponent:function(){this.store=new Ext.data.JsonStore({autoLoad:true,url:this.url+"&area=A&method="+this.method+"&name="+this.msg_name+"&lang_code="+this.lang_code,root:"results",successProperty:"success",pruneModifiedRecords:true,fields:["name","value"],baseParams:{},listeners:{loadexception:{fn:this.checkResults,scope:this}}});if(!Ext.isIE){this.shim=false;}
var _6=new Ext.XTemplate("<div>","<tpl for=\".\">","<div class=\"itemBox\">","{value}","</div>","</tpl>","</div>");var _7=new Ext.DataView({store:this.store,tpl:_6,autoHeight:true,autoWidth:true,loadingText:"Loading...",itemSelector:"div.itemBox",emptyText:""});var _8=new Ext.Button({text:"Close",style:"margin-top: 1em",handler:this.close,scope:this});this.items=[_7];this.buttons=[_8];MessageWindow.superclass.initComponent.call(this);},initEvents:function(){MessageWindow.superclass.initEvents.call(this);},destroy:function(){try{this.store=null;}
catch(e){}
MessageWindow.superclass.destroy.call(this);},checkResults:function(){Ext.MessageBox.show({title:"Warning",msg:"There is no help available for this component at this time.",buttons:Ext.MessageBox.OK,icon:Ext.MessageBox.WARNING,modal:false,width:400});this.close();}});
var PanelWithHelp=function(_1,_2){PanelWithHelp.superclass.constructor.call(this,_1,_2);};Ext.extend(PanelWithHelp,Ext.Panel,{useFieldSet:false,fieldSetOptions:{},helpMsgName:null,helpColWidth:25,helpToolTip:"Help",helpWinTitle:"Message",helpLangCode:"EN",initComponent:function(){var _3=[{layout:"column",border:false,items:[{layout:"form",columnWidth:1,border:false,items:this.items.slice()},{layout:"form",width:this.helpColWidth,border:false,items:[this.genHelpButton()]}]}];this.items=[];if(this.useFieldSet){var fs={title:"",xtype:"fieldset",autoHeight:true};if(this.fieldSetOptions){for(var i in this.fieldSetOptions){fs[i]=this.fieldSetOptions[i];}
delete this.fieldSetOptions;}
fs.items=_3;this.items=[fs];}else{this.items=_3;}
try{PanelWithHelp.superclass.initComponent.call(this);}
catch(e){}},beforeDestroy:function(){PanelWithHelp.superclass.beforeDestroy.call(this);},genHelpButton:function(){if(this.helpMsgName){return new MessageButton({msg_name:this.helpMsgName,lang_code:this.helpLangCode,title:this.helpWinTitle,tooltip:this.helpToolTip});}
return{html:"&nbsp;",border:false};}});Ext.ComponentMgr.registerType("panelwithhelp",PanelWithHelp);
Ext.form.PhoneField=Ext.extend(Ext.form.TextField,{vtypeText:"Incorrect Format",_isGatewayReturnValid:true,initComponent:function(){Ext.form.PhoneField.superclass.initComponent.call(this);},initEvents:function(){this.on("blur",this.gatewayValidateAndFormat,this);Ext.form.PhoneField.superclass.initEvents.call(this);},gatewayValidateAndFormat:function(){if(this.getValue().length>0||!this.allowBlank){Ext.Ajax.request({url:"json.php?target=common&method=validateAndFormatPhoneNumber",params:{number:this.getValue()},scope:this,callback:this.handleValidateAndFormatResponse});}},handleValidateAndFormatResponse:function(_1,_2,_3){var _4=Ext.util.JSON.decode(_3.responseText);if(_4.valid){this.clearInvalid();this._isGatewayReturnValid=true;this.setRawValue(_4.formatted_number);}else{this._isGatewayReturnValid=false;this.markInvalid(this.vtypeText);}},validateValue:function(_5){if(_5.length<1||_5===this.emptyText){if(this.allowBlank){this.clearInvalid();return true;}else{this.markInvalid(this.blankText);return false;}}
if(_5.length<this.minLength){this.markInvalid(String.format(this.minLengthText,this.minLength));return false;}
if(_5.length>this.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false;}
if(this.vtype){var vt=Ext.form.VTypes;if(!vt[this.vtype](_5,this)){this.markInvalid(this.vtypeText||vt[this.vtype+"Text"]);return false;}}
if(typeof this.validator=="function"){var _7=this.validator(_5);if(_7!==true){this.markInvalid(_7);return false;}}
if(this.regex&&!this.regex.test(_5)){this.markInvalid(this.regexText);return false;}
if(!this._isGatewayReturnValid){this.markInvalid(this.vtypeText);return false;}
return true;}});Ext.reg("PhoneField",Ext.form.PhoneField);
Ext.namespace("Ext.ux");Ext.namespace("Ext.ux.Plugin");Ext.ux.Plugin.LiteRemoteComponent=function(_1){var _2=_1.xtype||"panel";var _3=function(_4){this.container.add(Ext.ComponentMgr.create(Ext.decode(_4.responseText),_2)).show();this.container.doLayout();};return{init:function(_5){this.container=_5;Ext.Ajax.request(Ext.apply(_1,{success:_3,scope:this}));}};};Ext.ux.Plugin.RemoteComponent=function(_6){var _7=_6.xtype||"panel";var _8=_6.purgeListeners||true;this.addEvents({"beforeload":true,"beforecreate":true,"beforeadd":true,"beforecomponshow":true,"beforecontainshow":true,"success":true});if(_6.breakOn){this.on(_6.breakOn,function(){return false;});}
var _9=function(_a){var _b=Ext.decode(_a.responseText);if(this.fireEvent("beforecreate",_b,this)){var _c=Ext.ComponentMgr.create(_b,_7);if(this.fireEvent("beforeadd",_c,this)){this.container.add(_c);if(this.fireEvent("beforecomponshow",_c,this)){_c.show();if(this.fireEvent("beforecontainshow",_c,this)){this.container.doLayout();this.fireEvent("success",_c,this);}}}}
this.purgeListeners();};this.load=function(){if(this.fireEvent("beforeload",_6,this)){Ext.Ajax.request(Ext.apply(_6,{success:_9,scope:this}));}};this.init=function(_d){_d.on("beforedestroy",function(){this.purgeListeners();},this);this.container=_d;if(_6.loadOn){var _e=function(){this.load();_d.un(_6.loadOn,_e,this);};_d.on(_6.loadOn,_e,this);}else{this.load();}};};Ext.extend(Ext.ux.Plugin.RemoteComponent,Ext.util.Observable);
Ext.namespace("Ext.ux","Ext.ux.plugins");Ext.ux.plugins.RemoteValidator={init:function(_1){var _2=_1.isValid;var _3=_1.validate;Ext.apply(_1,{remoteValid:true,isValid:function(_4){return _2.call(this,_4)&&this.remoteValid;},validate:function(){var _5=_3.call(this);if(!this.disabled&&!_5){return false;}
if(this.disabled||(_5&&this.remoteValid)){this.clearInvalid();return true;}
if(!this.remoteValid){this.markInvalid(this.reason);return false;}
return false;},validateRemote:function(){this.rvOptions.params=this.rvOptions.params||{};this.rvOptions.params.field=this.name;this.rvOptions.params.value=this.getValue();Ext.Ajax.request(this.rvOptions);},rvSuccess:function(_6,_7){var o;try{o=Ext.decode(_6.responseText);}
catch(e){throw this.cannotDecodeText;}
if("object"!==typeof o){throw this.notObjectText;}
if(true!==o.success){throw this.serverErrorText+": "+o.error;}
var _9=this.rvOptions.paramNames;this.remoteValid=true===o[_9.valid];this.reason=o[_9.reason];this.validate();},rvFailure:function(_a,_b){throw this.requestFailText;},filterRemoteValidation:function(e){if(!e.isNavKeyPress()){this.remoteValidationTask.delay(this.remoteValidationDelay);}}});Ext.applyIf(_1,{remoteValidationDelay:500,reason:"Server has not yet validated the value",cannotDecodeText:"Cannot decode json object",notObjectText:"Server response is not an object",serverErrorText:"Server error",requestFailText:"Server request failed"});_1.on({render:{single:true,scope:_1,fn:function(){this.remoteValidationTask=new Ext.util.DelayedTask(this.validateRemote,this);this.el.on("keyup",this.filterRemoteValidation,this);}}});_1.rvOptions=_1.rvOptions||{};Ext.applyIf(_1.rvOptions,{method:"post",scope:_1,success:_1.rvSuccess,failure:_1.rvFailure,paramNames:{valid:"valid",reason:"reason"}});}};
Ext.ux.SliderTip=Ext.extend(Ext.Tip,{minWidth:10,offsets:[0,-10],init:function(_1){_1.on("dragstart",this.onSlide,this);_1.on("drag",this.onSlide,this);_1.on("dragend",this.hide,this);_1.on("destroy",this.destroy,this);},onSlide:function(_2){this.show();this.body.update(this.getText(_2));this.doAutoWidth();this.el.alignTo(_2.thumb,"b-t?",this.offsets);},getText:function(_3){return _3.getValue();}});
Ext.UserSelection=Ext.extend(Ext.Panel,{border:false,labelWidth:120,fieldWidth:295,gridWidth:500,columnWidths:{fields:0.85,buttons:0.15},url:"json.php?area=A&target=my_users_main",membershipUrl:"json.php?area=A&target=memberships",getMembershipsMethod:"&method=getMembershipsByUserType",getResultsMethod:"&method=getViewUsers",getSelectionsMethod:"&method=getUser",externalFieldId:"",selectionLimit:1,lang:{label:{search:"Search",membership:"Filter by membership"},loadMask:{searching:"Searching..."},button:{search:"Search",select:"select",remove:"remove"},headers:{company:"Company",name:"Name",email:"Email",user_login:"User login",error:"Error"},message:{no_users_found:"No users found",no_user_selected:"No user selected",error_load_selection:"An error occurred loading the user data"}},initComponent:function(){this.membershipsStore=new Ext.data.JsonStore({url:this.membershipUrl+this.getMembershipsMethod,fields:["membership_id","membership"],baseParams:{use_includes:true,include_customer:false,include_dealer:true,include_manufacturer:true},autoLoad:true});this.selectionsStore=new Ext.data.JsonStore({data:{},fields:["user_id","company","name","email","user_login"]});var _1=[{xtype:"textfield",id:this.id+"-search",fieldLabel:this.lang.label.search,name:"data[search]"},{xtype:"combo",id:this.id+"-membership",fieldLabel:this.lang.label.membership,name:"data[membership]",store:this.membershipsStore,displayField:"membership",valueField:"membership_id",mode:"local",triggerAction:"all"}];var _2=[{xtype:"button",id:this.id+"-search_button",text:this.lang.button.search,handler:this.getUsers,scope:this}];this.resultsGrid=new Ext.grid.DynamicGridPanel({id:this.id+"-results_grid",url:this.url,method:this.getResultsMethod,fields:["user_id","company","name","email","user_login"],headers:this.headers,autoExpandColumn:this.id+"-results-col-email",columns:[{id:this.id+"-results-col-company",header:this.lang.headers.company,width:100,sortable:true,dataIndex:"company"},{id:this.id+"-results-col-name",header:this.lang.headers.name,width:100,sortable:true,dataIndex:"name"},{id:this.id+"-results-col-email",header:this.lang.headers.email,width:175,sortable:true,dataIndex:"email"},{id:this.id+"-results-col-user_login",header:this.lang.headers.user_login,width:75,sortable:true,dataIndex:"user_login"},{id:this.id+"-results-col-select_link",header:"",width:50,resizable:false,sortable:false,align:"center",renderer:this.selectLinkRenderer.createDelegate(this)}],includeDelete:false,checkSelection:false,includePagination:true,pagingToolbarWidth:this.gridWidth-6,pageSizeComboWidth:50,includeRefresh:false,includeDownload:false,fireDownloadEvent:false,view:new Ext.grid.GridView({forceFit:true,emptyText:"Enter search parameters to refine the results.",deferEmptyText:false}),limit:3});var _3=[{xtype:"grid",id:this.id+"-selections-grid",store:this.selectionsStore,width:this.gridWidth,tbar:[{xtype:"tbtext",text:"Selections"}],autoHeight:true,autoExpandColumn:this.id+"-selection-col-email",columns:[{id:this.id+"-selection-col-company",header:this.lang.headers.company,width:100,sortable:true,dataIndex:"company"},{id:this.id+"-selection-col-name",header:this.lang.headers.name,width:100,sortable:true,dataIndex:"name"},{id:this.id+"-selection-col-email",header:this.lang.headers.email,width:175,sortable:true,dataIndex:"email"},{id:this.id+"-selection-col-user_login",header:this.lang.headers.user_login,width:75,sortable:true,dataIndex:"user_login"},{id:this.id+"-selection-col-remove_link",header:"",width:50,resizable:false,sortable:false,align:"center",renderer:this.removeLinkRenderer.createDelegate(this)}],viewConfig:{emptyText:this.lang.message.no_user_selected,forceFit:true,deferEmptyText:false}}];this.items=[{id:this.id+"-search-fields-and-results",border:false,width:this.gridWidth,items:[{id:this.id+"-search_fields_and_button",layout:"column",border:false,items:[{border:false,columnWidth:this.columnWidths.fields,layout:"form",defaults:{labelWidth:this.labelWidth,width:this.fieldWidth},items:_1},{border:false,columnWidth:this.columnWidths.buttons,items:_2}]},{border:false,items:this.resultsGrid}]},{border:false,bodyStyle:"margin-top:10px;",items:_3}];Ext.UserSelection.superclass.initComponent.call(this);},initEvents:function(){Ext.UserSelection.superclass.initEvents.call(this);},selectLinkRenderer:function(_4,_5,_6,_7){return"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').addSelection("+_7+"); return false;\">"+this.lang.button.select+"</a>";},removeLinkRenderer:function(_8,_9,_a,_b){return"<a href=\"#\" onclick=\"Ext.getCmp('"+this.id+"').removeSelection("+_a.data.user_id+"); return false;\">"+this.lang.button.remove+"</a>";},getUsers:function(){var _c=Ext.getCmp(this.id+"-search").getValue();var _d=(Ext.getCmp(this.id+"-membership").getRawValue().length)?Ext.getCmp(this.id+"-membership").getValue():"";var _e={"name":_c,"company":_c,"login":_c,"email":_c,"membership":_d};this.resultsGrid.store.baseParams.query=Ext.util.JSON.encode(_e);this.resultsGrid.store.baseParams.groupFields=true;this.resultsGrid.store.reload();},addSelection:function(_f){var _10=this.resultsGrid.store.getAt(_f);var _11=this.selectionsStore.find("user_id",_10.data.user_id);if(_11==-1){if(this.selectionsStore.getCount()==this.selectionLimit&&this.selectionLimit!==0){this.selectionsStore.remove(this.selectionsStore.getAt(0));}
this.selectionsStore.add(_10);}
this.updateExternalFieldIdValue();},removeSelection:function(_12){this.selectionsStore.remove(this.selectionsStore.getAt(this.selectionsStore.find("user_id",_12)));this.updateExternalFieldIdValue();this.showSearchAndResults(true);},updateExternalFieldIdValue:function(){var _13=new Array();for(x=0;x<this.selectionsStore.getCount();x++){_13.push(this.selectionsStore.getAt(x).data.user_id);}
var _14=_13.join(",");Ext.getCmp(this.externalFieldId).setValue(_14);},getSelection:function(_15){this.resetSearchAndResults();Ext.Ajax.request({url:this.url+this.getSelectionsMethod,callback:this.loadSelection.createDelegate(this),params:{user_id:_15}});},loadSelection:function(_16,_17,_18){if(_17){var _19=Ext.util.JSON.decode(_18.responseText);var _1a=Ext.data.Record.create(["user_id","company","name","email","user_login"]);var _1b=new _1a({user_id:_19[0].user_id,company:_19[0].company,name:_19[0].firstname+" "+_19[0].lastname,email:_19[0].email,user_login:_19[0].user_login});this.selectionsStore.removeAll();this.selectionsStore.add(_1b);this.showSearchAndResults(false);}else{Ext.Msg.alert(this.lang.headers.error,this.lang.message.error_load_selection);this.showSearchAndResults(true);}},showSearchAndResults:function(_1c){Ext.getCmp(this.id+"-search_fields_and_button").setVisible(_1c);Ext.getCmp(this.id+"-results_grid").setVisible(_1c);this.fireEvent("updateSelections");},resetSearchAndResults:function(){Ext.getCmp(this.id+"-search").setValue();Ext.getCmp(this.id+"-membership").setValue();this.resultsGrid.store.removeAll();this.selectionsStore.removeAll();this.showSearchAndResults(true);}});Ext.reg("userselection",Ext.UserSelection);
Ext.apply(Ext.form.VTypes,{"phone":function(){var re=/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/;return function(v){return re.test(v);};}(),"phoneText":"This field should be a phone number in the format 555-555-5555"});
function validateInput_NoSpaces(_1,id){try{if(this.findById(id).allowBlank){return true;}
var _3=_1.trim();if(_3.length==0){return"This field is required";}}
catch(e){}
return true;}
