/*
 * 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.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);
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.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.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;}
