/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

/*
	This is an optimized version of Dojo, built for deployment and not for
	development. To get sources and documentation, please visit:

		http://dojotoolkit.org
*/

if(!dojo._hasResource["dojo.io.iframe"]){dojo._hasResource["dojo.io.iframe"]=true;dojo.provide("dojo.io.iframe");dojo.getObject("io",true,dojo);dojo.io.iframe={create:function(_1,_2,_3){if(window[_1]){return window[_1];}if(window.frames[_1]){return window.frames[_1];}var _4=null;var _5=_3;if(!_5){if(dojo.config["useXDomain"]&&!dojo.config["dojoBlankHtmlUrl"]){console.warn("dojo.io.iframe.create: When using cross-domain Dojo builds,"+" please save dojo/resources/blank.html to your domain and set djConfig.dojoBlankHtmlUrl"+" to the path on your domain to blank.html");}_5=(dojo.config["dojoBlankHtmlUrl"]||dojo.moduleUrl("dojo","resources/blank.html"));}var _4=dojo.place("<iframe id=\""+_1+"\" name=\""+_1+"\" src=\""+_5+"\" onload=\""+_2+"\" style=\"position: absolute; left: 1px; top: 1px; height: 1px; width: 1px; visibility: hidden\">",dojo.body());window[_1]=_4;return _4;},setSrc:function(_6,_7,_8){try{if(!_8){if(dojo.isWebKit){_6.location=_7;}else{frames[_6.name].location=_7;}}else{var _9;if(dojo.isIE||dojo.isWebKit){_9=_6.contentWindow.document;}else{_9=_6.contentWindow;}if(!_9){_6.location=_7;return;}else{_9.location.replace(_7);}}}catch(e){console.log("dojo.io.iframe.setSrc: ",e);}},doc:function(_a){var _b=_a.contentDocument||(((_a.name)&&(_a.document)&&(dojo.doc.getElementsByTagName("iframe")[_a.name].contentWindow)&&(dojo.doc.getElementsByTagName("iframe")[_a.name].contentWindow.document)))||((_a.name)&&(dojo.doc.frames[_a.name])&&(dojo.doc.frames[_a.name].document))||null;return _b;},send:function(_c){if(!this["_frame"]){this._frame=this.create(this._iframeName,dojo._scopeName+".io.iframe._iframeOnload();");}var _d=dojo._ioSetArgs(_c,function(_e){_e.canceled=true;_e.ioArgs._callNext();},function(_f){var _10=null;try{var _11=_f.ioArgs;var dii=dojo.io.iframe;var ifd=dii.doc(dii._frame);var _12=_11.handleAs;_10=ifd;if(_12!="html"){if(_12=="xml"){if(dojo.isIE<9||(dojo.isIE&&dojo.isQuirks)){dojo.query("a",dii._frame.contentWindow.document.documentElement).orphan();var _13=(dii._frame.contentWindow.document).documentElement.innerText;_13=_13.replace(/>\s+</g,"><");_13=dojo.trim(_13);var _14={responseText:_13};_10=dojo._contentHandlers["xml"](_14);}}else{_10=ifd.getElementsByTagName("textarea")[0].value;if(_12=="json"){_10=dojo.fromJson(_10);}else{if(_12=="javascript"){_10=dojo.eval(_10);}}}}}catch(e){_10=e;}finally{_11._callNext();}return _10;},function(_15,dfd){dfd.ioArgs._hasError=true;dfd.ioArgs._callNext();return _15;});_d.ioArgs._callNext=function(){if(!this["_calledNext"]){this._calledNext=true;dojo.io.iframe._currentDfd=null;dojo.io.iframe._fireNextRequest();}};this._dfdQueue.push(_d);this._fireNextRequest();dojo._ioWatch(_d,function(dfd){return !dfd.ioArgs["_hasError"];},function(dfd){return (!!dfd.ioArgs["_finished"]);},function(dfd){if(dfd.ioArgs._finished){dfd.callback(dfd);}else{dfd.errback(new Error("Invalid dojo.io.iframe request state"));}});return _d;},_currentDfd:null,_dfdQueue:[],_iframeName:dojo._scopeName+"IoIframe",_fireNextRequest:function(){try{if((this._currentDfd)||(this._dfdQueue.length==0)){return;}do{var dfd=this._currentDfd=this._dfdQueue.shift();}while(dfd&&dfd.canceled&&this._dfdQueue.length);if(!dfd||dfd.canceled){this._currentDfd=null;return;}var _16=dfd.ioArgs;var _17=_16.args;_16._contentToClean=[];var fn=dojo.byId(_17["form"]);var _18=_17["content"]||{};if(fn){if(_18){var _19=function(_1a,_1b){dojo.create("input",{type:"hidden",name:_1a,value:_1b},fn);_16._contentToClean.push(_1a);};for(var x in _18){var val=_18[x];if(dojo.isArray(val)&&val.length>1){var i;for(i=0;i<val.length;i++){_19(x,val[i]);}}else{if(!fn[x]){_19(x,val);}else{fn[x].value=val;}}}}var _1c=fn.getAttributeNode("action");var _1d=fn.getAttributeNode("method");var _1e=fn.getAttributeNode("target");if(_17["url"]){_16._originalAction=_1c?_1c.value:null;if(_1c){_1c.value=_17.url;}else{fn.setAttribute("action",_17.url);}}if(!_1d||!_1d.value){if(_1d){_1d.value=(_17["method"])?_17["method"]:"post";}else{fn.setAttribute("method",(_17["method"])?_17["method"]:"post");}}_16._originalTarget=_1e?_1e.value:null;if(_1e){_1e.value=this._iframeName;}else{fn.setAttribute("target",this._iframeName);}fn.target=this._iframeName;dojo._ioNotifyStart(dfd);fn.submit();}else{var _1f=_17.url+(_17.url.indexOf("?")>-1?"&":"?")+_16.query;dojo._ioNotifyStart(dfd);this.setSrc(this._frame,_1f,true);}}catch(e){dfd.errback(e);}},_iframeOnload:function(){var dfd=this._currentDfd;if(!dfd){this._fireNextRequest();return;}var _20=dfd.ioArgs;var _21=_20.args;var _22=dojo.byId(_21.form);if(_22){var _23=_20._contentToClean;for(var i=0;i<_23.length;i++){var key=_23[i];for(var j=0;j<_22.childNodes.length;j++){var _24=_22.childNodes[j];if(_24.name==key){dojo.destroy(_24);break;}}}if(_20["_originalAction"]){_22.setAttribute("action",_20._originalAction);}if(_20["_originalTarget"]){_22.setAttribute("target",_20._originalTarget);_22.target=_20._originalTarget;}}_20._finished=true;}};}if(!dojo._hasResource["esri.layers.FeatureLayer"]){dojo._hasResource["esri.layers.FeatureLayer"]=true;dojo.provide("esri.layers.FeatureLayer");dojo.declare("esri.layers.FeatureLayer",esri.layers.GraphicsLayer,{constructor:function(url,_25){this._outFields=_25&&_25.outFields;this._loadCallback=_25&&_25.loadCallback;var _26=_25&&_25._usePatch;this._usePatch=(_26===null||_26===undefined)?true:_26;this._trackIdField=_25&&_25.trackIdField;this.objectIdField=_25&&_25.objectIdField;this._maxOffset=_25&&_25.maxAllowableOffset;this._optEditable=_25&&_25.editable;this._optAutoGen=_25&&_25.autoGeneralize;this.editSummaryCallback=_25&&_25.editSummaryCallback;this.userId=_25&&_25.userId;this.userIsAdmin=_25&&_25.userIsAdmin;this.useMapTime=(_25&&_25.hasOwnProperty("useMapTime"))?(!!_25.useMapTime):true;this.source=_25&&_25.source;this.gdbVersion=_25&&_25.gdbVersion;this._selectedFeatures={};this._selectedFeaturesArr=[];this._newFeatures=[];this._deletedFeatures={};this._ulid=this._getUniqueId();var _27=this.constructor,_28=this.mode=(esri._isDefined(_25&&_25.mode)?_25.mode:_27.MODE_ONDEMAND);switch(_28){case _27.MODE_SNAPSHOT:this._mode=new esri.layers._SnapshotMode(this);this._isSnapshot=true;break;case _27.MODE_ONDEMAND:this._tileWidth=(_25&&_25.tileWidth)||512;this._tileHeight=(_25&&_25.tileHeight)||512;this._mode=new esri.layers._OnDemandMode(this);var _29=_25&&_25.latticeTiling;this.latticeTiling=_29;break;case _27.MODE_SELECTION:this._mode=new esri.layers._SelectionMode(this);this._isSelOnly=true;break;}this._initLayer=dojo.hitch(this,this._initLayer);this._selectHandler=dojo.hitch(this,this._selectHandler);this._editable=false;if(dojo.isObject(url)&&url.layerDefinition){var _2a=url;this._collection=true;this.mode=_27.MODE_SNAPSHOT;this._initLayer(_2a);return this;}this._task=new esri.tasks.QueryTask(this.url,{source:this.source,gdbVersion:this.gdbVersion});var _2b=this._url.path;this._fserver=false;if(_2b.search(/\/FeatureServer\//i)!==-1){this._fserver=true;}var _2c=_25&&_25.resourceInfo;if(_2c){this._initLayer(_2c);}else{if(this.source){var _2d={source:this.source.toJson()};this._url.query=dojo.mixin(this._url.query,{layer:dojo.toJson(_2d)});}if(this.gdbVersion){this._url.query=dojo.mixin(this._url.query,{gdbVersion:this.gdbVersion});}esri.request({url:_2b,content:dojo.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:this._initLayer,error:this._errorHandler});}},_initLayer:function(_2e,io){if(_2e||io){this._json=_2e;this._findCredential();if(this._collection){this._mode=new esri.layers._SnapshotMode(this);this._isSnapshot=true;this._featureSet=_2e.featureSet;this._nextId=_2e.nextObjectId;_2e=_2e.layerDefinition;}if(_2e.hasOwnProperty("capabilities")){var _2f=(this.capabilities=_2e.capabilities);if(_2f&&_2f.toLowerCase().indexOf("editing")!==-1){this._editable=true;}else{this._editable=false;}}else{if(!this._collection){this._editable=this._fserver;}}if(esri._isDefined(this._optEditable)){this._editable=this._optEditable;delete this._optEditable;}this._json=dojo.toJson(this._json);if(this._editable){delete this._maxOffset;}else{if(this.mode!==this.constructor.MODE_SNAPSHOT&&((_2e.geometryType==="esriGeometryPolyline")||(_2e.geometryType==="esriGeometryPolygon"))){this._autoGeneralize=esri._isDefined(this._optAutoGen)?this._optAutoGen:(this.mode===this.constructor.MODE_ONDEMAND);delete this._optAutoGen;}}this.minScale=_2e.minScale||0;this.maxScale=_2e.maxScale||0;this.layerId=_2e.id;this.name=_2e.name;this.description=_2e.description;this.copyright=_2e.copyrightText;this.type=_2e.type;this.geometryType=_2e.geometryType;this.displayField=_2e.displayField;this.defaultDefinitionExpression=_2e.definitionExpression;this.fullExtent=new esri.geometry.Extent(_2e.extent);if((this.geometryType==="esriGeometryPoint")||(this.geometryType==="esriGeometryMultipoint")){this.latticeTiling=false;}this.indexedFields=_2e.indexedFields;this.maxRecordCount=_2e.maxRecordCount;this.canModifyLayer=_2e.canModifyLayer;this.supportsStatistics=_2e.supportsStatistics;this.supportsAdvancedQueries=_2e.supportsAdvancedQueries;this.hasLabels=_2e.hasLabels;this.canScaleSymbols=_2e.canScaleSymbols;this.supportsRollbackOnFailure=_2e.supportsRollbackOnFailure;this.syncCanReturnChanges=_2e.syncCanReturnChanges;this.isDataVersioned=_2e.isDataVersioned;this.editFieldsInfo=_2e.editFieldsInfo;this.ownershipBasedAccessControlForFeatures=_2e.ownershipBasedAccessControlForFeatures;if(this.editFieldsInfo&&this.ownershipBasedAccessControlForFeatures){this.creatorField=this.editFieldsInfo.creatorField;}this.relationships=_2e.relationships;this.allowGeometryUpdates=esri._isDefined(_2e.allowGeometryUpdates)?_2e.allowGeometryUpdates:true;this._isTable=(this.type==="Table");var _30=(this.fields=[]),_31=_2e.fields,i;for(i=0;i<_31.length;i++){_30.push(new esri.layers.Field(_31[i]));}if(!this.objectIdField){this.objectIdField=_2e.objectIdField;if(!this.objectIdField){_31=_2e.fields;for(i=0;i<_31.length;i++){var _32=_31[i];if(_32.type==="esriFieldTypeOID"){this.objectIdField=_32.name;break;}}}if(!this.objectIdField){console.debug("esri.layers.FeatureLayer: "+esri.substitute({url:this.url},esri.bundle.layers.FeatureLayer.noOIDField));}}if(!esri._isDefined(this._nextId)){var _33=this.objectIdField,_34=-1;if(this._collection&&_33){var _35=this._featureSet,_36=_35&&_35.features,il=_36?_36.length:0,oid,_37;for(i=0;i<il;i++){_37=_36[i].attributes;oid=_37&&_37[_33];if(oid>_34){_34=oid;}}}this._nextId=(_34+1);}this.globalIdField=_2e.globalIdField;this.typeIdField=_2e.typeIdField;this.visibilityField=_2e.visibilityField;var _38=_2e.defaultSymbol;if(_38){this.defaultSymbol=esri.symbol.fromJson(_38);}var _39=this.types=[],_3a=_2e.types,_3b,_3c,_3d,_3e=this.editFieldsInfo,_3f=_3e&&_3e.creatorField,_40=_3e&&_3e.editorField,fix=(_3f||_40),_41=[];if(_3a){for(i=0;i<_3a.length;i++){_3b=new esri.layers.FeatureType(_3a[i]);_3c=_3b.templates;if(fix&&_3c&&_3c.length){_41=_41.concat(_3c);}_39.push(_3b);}}var _42=_2e.templates,_43,_44=this.templates=[];if(_42){for(i=0;i<_42.length;i++){_43=new esri.layers.FeatureTemplate(_42[i]);if(fix){_41.push(_43);}_44.push(_43);}}for(i=0;i<_41.length;i++){_3d=dojo.getObject("prototype.attributes",false,_41[i]);if(_3d){if(_3f){delete _3d[_3f];}if(_40){delete _3d[_40];}}}var _45=_2e.timeInfo;if(_45){this.timeInfo=new esri.layers.TimeInfo(_45);this._startTimeField=_45.startTimeField;this._endTimeField=_45.endTimeField;if(this._startTimeField&&this._endTimeField){this._twoTimeFields=true;}if(this._trackIdField){_45.trackIdField=this._trackIdField;}else{this._trackIdField=_45.trackIdField;}}this.hasAttachments=(!this._collection&&_2e.hasAttachments)?true:false;this.htmlPopupType=_2e.htmlPopupType;var _46=_2e.drawingInfo,_47;if(!this.renderer){if(_46&&_46.renderer){_47=_46.renderer;this.setRenderer(esri.renderer.fromJson(_47));if(_47.type==="classBreaks"){this.renderer._setMaxInclusiveness(true);}if(!this._collection){var _48=_47.type,_49=[];_47=this.renderer;switch(_48){case "simple":_49.push(_47.symbol);break;case "uniqueValue":case "classBreaks":_49.push(_47.defaultSymbol);_49=_49.concat(dojo.map(_47.infos,function(_4a){return _4a.symbol;}));break;}_49=dojo.filter(_49,esri._isDefined);var _4b=this._url.path+"/images/",_4c=this._getToken();dojo.forEach(_49,function(sym){var url=sym.url;if(url){if((url.search(/https?\:/)===-1)&&(url.indexOf("data:")===-1)){sym.url=_4b+url;}if(_4c&&sym.url.search(/https?\:/)!==-1){sym.url+=("?token="+_4c);}}});}}else{if(_38){_3a=this.types;if(_3a.length>0){_47=new esri.renderer.UniqueValueRenderer(this.defaultSymbol,this.typeIdField);dojo.forEach(_3a,function(_4d){_47.addValue(_4d.id,_4d.symbol);});}else{_47=new esri.renderer.SimpleRenderer(this.defaultSymbol);}this.setRenderer(_47);}else{if(!this._isTable){var _4e;switch(this.geometryType){case "esriGeometryPoint":case "esriGeometryMultipoint":_4e=new esri.symbol.SimpleMarkerSymbol();break;case "esriGeometryPolyline":_4e=new esri.symbol.SimpleLineSymbol();break;case "esriGeometryPolygon":_4e=new esri.symbol.SimpleFillSymbol();break;}this.setRenderer(_4e?new esri.renderer.SimpleRenderer(_4e):null);}}}}var _4f=(_46&&_46.transparency)||0;if(!esri._isDefined(this.opacity)&&_4f>0){this.opacity=1-(_4f/100);}this.version=_2e.currentVersion;if(!this.version){var ver;if("capabilities" in _2e||"drawingInfo" in _2e||"hasAttachments" in _2e||"htmlPopupType" in _2e||"relationships" in _2e||"timeInfo" in _2e||"typeIdField" in _2e||"types" in _2e){ver=10;}else{ver=9.3;}this.version=ver;}if((dojo.isIE||dojo.isSafari)&&this._editable&&this.version<10.02){this._ts=true;}this.loaded=true;this._fixRendererFields();this._checkFields();this._updateCaps();if(this._collection){this._fireUpdateStart();var _50=this._featureSet;delete this._featureSet;this._mode._drawFeatures(new esri.tasks.FeatureSet(_50));this._fcAdded=true;}this.onLoad(this);var _51=this._loadCallback;if(_51){delete this._loadCallback;_51(this);}}},setRenderer:function(ren){this.inherited("setRenderer",arguments);var _52=this.renderer;if(_52){this._ager=(_52.declaredClass.indexOf("TemporalRenderer")!==-1&&_52.observationAger&&_52.observationRenderer);var _53=dojo.filter([_52,_52.observationRenderer,_52.latestObservationRenderer,_52.trackRenderer],esri._isDefined);var _54=[];dojo.forEach(_53,function(rnd){_54.push(rnd.attributeField);_54.push(rnd.attributeField2);_54.push(rnd.attributeField3);},this);this._rendererFields=dojo.filter(_54,esri._isDefined);}else{this._ager=false;this._rendererFields=[];}if(this.loaded&&this._rendererFields.length>0){this._fixRendererFields();this._checkFields(this._rendererFields);}if(this.loaded&&this._collection){this._typesDirty=true;}},_setMap:function(map,_55){this._map=map;this._toggleTime(true);var div=this.inherited("_setMap",arguments);this.clearSelection();var _56=this.renderer;if(this.timeInfo){if(this._trackIdField||(_56&&(_56.latestObservationRenderer||_56.trackRenderer))){this._trackManager=new esri.layers._TrackManager(this);this._trackManager.initialize(map);}}this._zoomConnect=dojo.connect(map,"onZoomEnd",this,this._zoomHandler);this._zoomHandler();var _57=this._mode;if(_57){_57.initialize(map);}return div;},_unsetMap:function(map,_58){var _59=this._mode;if(_59){_59.destroy();this._mode=null;}if(this._trackManager){this._trackManager.destroy();this._trackManager=null;}dojo.disconnect(this._zoomConnect);this._zoomConnect=null;this._toggleTime(false);this.inherited("_unsetMap",arguments);},refresh:function(){var _5a=this._mode;if(_5a){_5a.refresh();}},setEditable:function(_5b){if(!this._collection){console.log("FeatureLayer:setEditCapabilities - this functionality is not yet supported for layer in a feature service");return this;}if(!this.loaded){this._optEditable=_5b;return this;}var _5c=this._editable;this._editable=_5b;this._updateCaps();if(_5c!==_5b){this.onCapabilitiesChange();}return this;},getEditCapabilities:function(_5d){var _5e={"canCreate":false,"canUpdate":false,"canDelete":false};if(!this.loaded||!this._editable){return _5e;}var _5f=_5d&&_5d.feature,_60=_5d&&_5d.userId,_61=dojo.map((this.capabilities?this.capabilities.toLowerCase().split(","):[]),dojo.trim),_62=dojo.indexOf(_61,"editing")>-1,_63=_62&&(dojo.indexOf(_61,"create")>-1),_64=_62&&(dojo.indexOf(_61,"update")>-1),_65=_62&&(dojo.indexOf(_61,"delete")>-1),_66=this.ownershipBasedAccessControlForFeatures,_67=this.editFieldsInfo,_68=_67&&_67.creatorField,_69=_67&&_67.realm,_6a=_5f&&_5f.attributes,_6b=(_6a&&_68)?_6a[_68]:undefined,_6c,_6d=!!this.userIsAdmin,_6e=!_66||_6d||!!(_66.allowOthersToUpdate||_66.allowUpdateToOthers),_6f=!_66||_6d||!!(_66.allowOthersToDelete||_66.allowDeleteToOthers);if(_62&&(!(_63||_64||_65)||_6d)){_63=_64=_65=true;}_6c={"canCreate":_63,"canUpdate":_64,"canDelete":_65};if(_6b===null){_6c.canUpdate=_64&&_6e;_6c.canDelete=_65&&_6f;}else{if(_6b===""){return _6c;}else{if(_6b){_60=_60||this.getUserId();if(_60&&_69){_60=_60+"@"+_69;}if(_60.toLowerCase()===_6b.toLowerCase()){return _6c;}else{_6c.canUpdate=_64&&_6e;_6c.canDelete=_65&&_6f;}}}}return _6c;},getUserId:function(){var _70;if(this.loaded){_70=(this.credential&&this.credential.userId)||this.userId||"";}return _70;},setUserIsAdmin:function(_71){this.userIsAdmin=_71;},setEditSummaryCallback:function(_72){this.editSummaryCallback=_72;},getEditSummary:function(_73,_74,_75){_75=esri._isDefined(_75)?_75:(new Date()).getTime();var _76="",_77=this.getEditInfo(_73,_74,_75),_78=(_74&&_74.callback)||this.editSummaryCallback;if(_78){_77=_78(_73,_77)||"";}if(dojo.isString(_77)){_76=_77;}else{if(_77){var _79=_77.action,_7a=_77.userId,_7b=_77.timeValue,_7c=0;if(_79){_7c++;}if(_7a){_7c++;}if(esri._isDefined(_7b)){_7c++;}if(_7c>1){_76=(_79==="edit"?"edit":"create")+(_7a?"User":"")+(esri._isDefined(_7b)?_77.displayPattern:"");}}_76=_76&&esri.substitute(_77,esri.bundle.layers.FeatureLayer[_76]);}return _76;},getEditInfo:function(_7d,_7e,_7f){if(!this.loaded){return;}_7f=esri._isDefined(_7f)?_7f:(new Date()).getTime();var _80=(_7e&&_7e.action)||"last",_81=this.editFieldsInfo,_82=_81&&_81.creatorField,_83=_81&&_81.creationDateField,_84=_81&&_81.editorField,_85=_81&&_81.editDateField,_86=_81&&_81.realm,_87=_7d&&_7d.attributes,_88=(_87&&_82)?_87[_82]:undefined,_89=(_87&&_83)?_87[_83]:null,_8a=(_87&&_84)?_87[_84]:undefined,_8b=(_87&&_85)?_87[_85]:null,_8c=this._getEditData(_88,_89,_7f),_8d=this._getEditData(_8a,_8b,_7f),_8e;switch(_80){case "creation":_8e=_8c;break;case "edit":_8e=_8d;break;case "last":_8e=_8d||_8c;break;}if(_8e){_8e.action=(_8e===_8d)?"edit":"creation";}return _8e;},_getEditData:function(_8f,_90,_91){var _92,_93,_94,_95=60000,_96=3600000,_97=2*_96,_98=24*_96,_99=7*_98;if(esri._isDefined(_90)){_93=_91-_90;if(_93<0){_94="Full";}else{if(_93<_95){_94="Seconds";}else{if(_93<(2*_95)){_94="Minute";}else{if(_93<_96){_94="Minutes";}else{if(_93<_97){_94="Hour";}else{if(_93<_98){_94="Hours";}else{if(_93<_99){_94="WeekDay";}else{_94="Full";}}}}}}}}if((_8f!==undefined)||_94){_92=_92||{};_92.userId=_8f;if(_94){var _9a=dojo.date.locale.format,_9b=new Date(_90);_92.minutes=Math.floor(_93/_95);_92.hours=Math.floor(_93/_96);_92.weekDay=_9a(_9b,{datePattern:"EEEE",selector:"date"});_92.formattedDate=_9a(_9b,{selector:"date"});_92.formattedTime=_9a(_9b,{selector:"time"});_92.displayPattern=_94;_92.timeValue=_90;}}return _92;},isEditable:function(){return this._editable;},setMaxAllowableOffset:function(_9c){if(!this._editable){this._maxOffset=_9c;}return this;},getMaxAllowableOffset:function(){return this._maxOffset;},setAutoGeneralize:function(_9d){if(!this.loaded){this._optAutoGen=_9d;}else{if(!this._editable&&(this.mode!==this.constructor.MODE_SNAPSHOT)&&((this.geometryType==="esriGeometryPolyline")||(this.geometryType==="esriGeometryPolygon"))){this._autoGeneralize=_9d;if(_9d){var map=this._map;if(map&&map.loaded){this._maxOffset=Math.floor(map.extent.getWidth()/map.width);}}else{delete this._maxOffset;}}}return this;},setScaleRange:function(_9e,_9f){this.minScale=_9e||0;this.maxScale=_9f||0;if(this._map&&this._map.loaded){this._updateStatus();}},setGDBVersion:function(_a0){if(!this._collection&&(_a0!==this.gdbVersion)&&(_a0||this.gdbVersion)){this.gdbVersion=_a0;this._task.gdbVersion=_a0;this._url.query=dojo.mixin(this._url.query,{gdbVersion:_a0});if(this.loaded){this.clearSelection();if(this._map){this.refresh();}}this.onGDBVersionChange();}return this;},setDefinitionExpression:function(_a1){this._defnExpr=_a1;var _a2=this._mode;if(_a2){_a2.propertyChangeHandler(1);}return this;},getDefinitionExpression:function(){return this._defnExpr;},setTimeDefinition:function(_a3){if(this._isSnapshot){this._timeDefn=_a3;var _a4=this._mode;if(_a4){_a4.propertyChangeHandler(2);}}return this;},getTimeDefinition:function(){return this._timeDefn;},setTimeOffset:function(_a5,_a6){this._timeOffset=_a5;this._timeOffsetUnits=_a6;var _a7=this._mode;if(_a7){_a7.propertyChangeHandler(0);}return this;},setUseMapTime:function(use){this.useMapTime=use;this._toggleTime(!this._suspended);var _a8=this._mode;if(_a8){_a8.propertyChangeHandler(0);}},selectFeatures:function(_a9,_aa,_ab,_ac){_aa=_aa||this.constructor.SELECTION_NEW;var _ad=this._getShallowClone(_a9),map=this._map,_ae,dfd=esri._fixDfd(new dojo.Deferred(esri._dfdCanceller));_ad.outFields=this._getOutFields();_ad.returnGeometry=true;if(map){_ad.outSpatialReference=new esri.SpatialReference(map.spatialReference.toJson());}if(!this._applyQueryFilters(_ad)){_ae={features:[]};this._selectHandler(_ae,_aa,_ab,_ac,dfd);return dfd;}var _af=this._canDoClientSideQuery(_ad);if(_af){_ae={features:this._doQuery(_ad,_af)};this._selectHandler(_ae,_aa,_ab,_ac,dfd);return dfd;}else{if(this._collection){var err=new Error("FeatureLayer::selectFeatures - "+esri.bundle.layers.FeatureLayer.invalidParams);this._resolve([err],null,_ac,dfd,true);return dfd;}var _b0=this;if(this._ts){_ad._ts=(new Date()).getTime();}var _b1=dfd._pendingDfd=this._task.execute(_ad);_b1.addCallbacks(function(_b2){_b0._selectHandler(_b2,_aa,_ab,_ac,dfd);},function(err){_b0._resolve([err],null,_ac,dfd,true);});return dfd;}},getSelectedFeatures:function(){var _b3=this._selectedFeatures,_b4=[],_b5;for(_b5 in _b3){if(_b3.hasOwnProperty(_b5)){_b4.push(_b3[_b5]);}}return _b4;},clearSelection:function(_b6){var _b7=this._selectedFeatures,_b8=this._mode,_b9;for(_b9 in _b7){if(_b7.hasOwnProperty(_b9)){this._unSelectFeatureIIf(_b9,_b8);_b8._removeFeatureIIf(_b9);}}this._selectedFeatures={};if(this._isSelOnly){_b8._applyTimeFilter(true);}if(!_b6){this.onSelectionClear();}return this;},setSelectionSymbol:function(_ba){this._selectionSymbol=_ba;if(_ba){var _bb=this._selectedFeatures,_bc;for(_bc in _bb){if(_bb.hasOwnProperty(_bc)){_bb[_bc].setSymbol(_ba);}}}return this;},getSelectionSymbol:function(){return this._selectionSymbol;},__msigns:[{n:"applyEdits",c:5,a:[{i:0},{i:1}],e:4,f:1}],applyEdits:function(_bd,_be,_bf,_c0,_c1,_c2){var _c3=_c2.assembly,dfd=_c2.dfd;this._applyNormalized(_bd,_c3&&_c3[0]);this._applyNormalized(_be,_c3&&_c3[1]);this.onBeforeApplyEdits(_bd,_be,_bf);var i,_c4={},_c5=this.objectIdField,_c6={f:"json"},_c7=false;if(this._collection){var _c8={};_c8.addResults=_bd?dojo.map(_bd,function(){_c7=true;return {objectId:this._nextId++,success:true};},this):null;_c8.updateResults=_be?dojo.map(_be,function(_c9){_c7=true;var oid=_c9.attributes[_c5];_c4[oid]=_c9;return {objectId:oid,success:true};},this):null;_c8.deleteResults=_bf?dojo.map(_bf,function(_ca){_c7=true;return {objectId:_ca.attributes[_c5],success:true};},this):null;if(_c7){this._editHandler(_c8,_bd,_c4,_c0,_c1,dfd);}return;}if(_bd&&_bd.length>0){_c6.adds=this._convertFeaturesToJson(_bd,0,1);_c7=true;}if(_be&&_be.length>0){for(i=0;i<_be.length;i++){var _cb=_be[i];_c4[_cb.attributes[_c5]]=_cb;}_c6.updates=this._convertFeaturesToJson(_be,0,0,1);_c7=true;}if(_bf&&_bf.length>0){var ids=[];for(i=0;i<_bf.length;i++){ids.push(_bf[i].attributes[_c5]);}_c6.deletes=ids.join(",");_c7=true;}if(_c7){var _cc=this;return esri.request({url:this._url.path+"/applyEdits",content:dojo.mixin(_c6,this._url.query),callbackParamName:"callback",load:function(_cd){_cc._editHandler(_cd,_bd,_c4,_c0,_c1,dfd);},error:function(err){_cc._resolve([err],null,_c1,dfd,true);}},{usePost:true});}},queryFeatures:function(_ce,_cf,_d0){return this._query("execute","onQueryFeaturesComplete",_ce,_cf,_d0);},queryRelatedFeatures:function(_d1,_d2,_d3){return this._query("executeRelationshipQuery","onQueryRelatedFeaturesComplete",_d1,_d2,_d3);},queryIds:function(_d4,_d5,_d6){return this._query("executeForIds","onQueryIdsComplete",_d4,_d5,_d6);},queryCount:function(_d7,_d8,_d9){return this._query("executeForCount","onQueryCountComplete",_d7,_d8,_d9);},queryAttachmentInfos:function(_da,_db,_dc){var url=this._url.path+"/"+_da+"/attachments",dfd=new dojo.Deferred(esri._dfdCanceller),_dd=this;dfd._pendingDfd=esri.request({url:url,content:dojo.mixin({f:"json"},this._url.query),callbackParamName:"callback",load:function(_de){var _df=_de.attachmentInfos,_e0;dojo.forEach(_df,function(_e1){_e0=dojo.objectToQuery({gdbVersion:_dd._url.query&&_dd._url.query.gdbVersion,layer:_dd._url.query&&_dd._url.query.layer,token:_dd._getToken()});_e1.url=url+"/"+_e1.id+(_e0?("?"+_e0):"");_e1.objectId=_da;});_dd._resolve([_df],"onQueryAttachmentInfosComplete",_db,dfd);},error:function(err){_dd._resolve([err],null,_dc,dfd,true);}});return dfd;},addAttachment:function(_e2,_e3,_e4,_e5){return this._sendAttachment("add",_e2,_e3,_e4,_e5);},updateAttachment:function(_e6,_e7,_e8,_e9,_ea){_e8.appendChild(dojo.create("input",{type:"hidden",name:"attachmentId",value:_e7}));return this._sendAttachment("update",_e6,_e8,_e9,_ea);},deleteAttachments:function(_eb,_ec,_ed,_ee){var url=this._url.path+"/"+_eb+"/deleteAttachments",dfd=new dojo.Deferred(esri._dfdCanceller),_ef=this,_f0={f:"json",attachmentIds:_ec.join(",")};dfd._pendingDfd=esri.request({url:url,content:dojo.mixin(_f0,this._url.query),callbackParamName:"callback",load:dojo.hitch(this,function(_f1){var _f2=_f1.deleteAttachmentResults;_f2=dojo.map(_f2,function(_f3){var res=new esri.layers.FeatureEditResult(_f3);res.attachmentId=res.objectId;res.objectId=_eb;return res;});_ef._resolve([_f2],"onDeleteAttachmentsComplete",_ed,dfd);}),error:function(err){_ef._resolve([err],null,_ee,dfd,true);}},{usePost:true});return dfd;},addType:function(_f4){if(!this._collection){return false;}var _f5=this.types;if(_f5){var _f6=dojo.some(_f5,function(_f7){if(_f7.id==_f4.id){return true;}return false;});if(_f6){return false;}else{_f5.push(_f4);}}else{this.types=[_f4];}this._typesDirty=true;return true;},deleteType:function(_f8){if(!this._collection){return;}var _f9=this.types;if(_f9){var _fa=-1;dojo.some(_f9,function(_fb,_fc){if(_fb.id==_f8){_fa=_fc;return true;}return false;});if(_fa>-1){this._typesDirty=true;return _f9.splice(_fa,1)[0];}}},toJson:function(){var _fd=this._json,_fe=dojo.isString(_fd)?dojo.fromJson(_fd):dojo.clone(_fd);if(!_fe){return;}_fe=_fe.layerDefinition?_fe:{layerDefinition:_fe};var _ff=_fe.layerDefinition,_100=this._collection;if(_100&&this._typesDirty){_ff.types=dojo.map(this.types||[],function(type){return type.toJson();});var _101=this.renderer,_102=_ff.drawingInfo;if(_102&&_101&&_101.declaredClass.indexOf("TemporalRenderer")===-1){_102.renderer=_101.toJson();}}var _103=null;if(!(_100&&!this._fcAdded)){_103={geometryType:_ff.geometryType,features:this._convertFeaturesToJson(this.graphics,true)};}_fe.featureSet=dojo.mixin({},_fe.featureSet||{},_103);if(_100){_fe.nextObjectId=this._nextId;_ff.capabilities=this.capabilities;}return _fe;},onSelectionComplete:function(){},onSelectionClear:function(){},onBeforeApplyEdits:function(){},onEditsComplete:function(){},onQueryFeaturesComplete:function(){},onQueryRelatedFeaturesComplete:function(){},onQueryIdsComplete:function(){},onQueryCountComplete:function(){},onQueryAttachmentInfosComplete:function(){},onAddAttachmentComplete:function(){},onUpdateAttachmentComplete:function(){},onDeleteAttachmentsComplete:function(){},onCapabilitiesChange:function(){},onGDBVersionChange:function(){},onQueryLimitExceeded:function(){},_updateCaps:function(){var _104=this._editable,_105=dojo.trim(this.capabilities||""),_106=dojo.map((_105?_105.split(","):[]),dojo.trim),caps=dojo.map((_105?_105.toLowerCase().split(","):[]),dojo.trim),_107=dojo.indexOf(caps,"editing"),cap,i,_108,_109={"Create":dojo.indexOf(caps,"create"),"Update":dojo.indexOf(caps,"update"),"Delete":dojo.indexOf(caps,"delete")};if(_104&&_107===-1){_106.push("Editing");}else{if(!_104&&_107>-1){_108=[_107];for(cap in _109){if(_109[cap]>-1){_108.push(_109[cap]);}}_108.sort();for(i=_108.length-1;i>=0;i--){_106.splice(_108[i],1);}}}this.capabilities=_106.join(",");},_counter:{value:0},_getUniqueId:function(){return this._counter.value++;},_getDesiredStatus:function(){return this.visible&&this._isMapAtVisibleScale();},_isMapAtVisibleScale:function(){if(!this._map){return false;}var _10a=esri.geometry.getScale(this._map);var _10b=this.minScale,_10c=this.maxScale,_10d=!_10b,_10e=!_10c;if(!_10d&&_10a<=_10b){_10d=true;}if(!_10e&&_10a>=_10c){_10e=true;}return (_10d&&_10e)?true:false;},_suspend:function(){this.inherited("_suspend",arguments);this._toggleTime(false);var mode=this._mode;if(mode){mode.suspend();}},_resume:function(){this.inherited("_resume",arguments);this._toggleTime(true);var mode=this._mode;if(mode){mode.resume();}},_zoomHandler:function(){var map=this._map;if(map&&map.loaded){if(this._autoGeneralize){this._maxOffset=Math.floor(map.extent.getWidth()/map.width);}this._updateStatus();}},_toggleTime:function(_10f){var map=this._map;if(_10f&&this.timeInfo&&this.useMapTime&&map){this._mapTimeExtent=map.timeExtent;if(!this._timeConnect){this._timeConnect=dojo.connect(map,"onTimeExtentChange",this,this._timeChangeHandler);}}else{this._mapTimeExtent=null;dojo.disconnect(this._timeConnect);this._timeConnect=null;}},_timeChangeHandler:function(_110){this._mapTimeExtent=_110;var mode=this._mode;if(mode){mode.propertyChangeHandler(0);}},_getOffsettedTE:function(_111){var _112=this._timeOffset,_113=this._timeOffsetUnits;return (_111&&_112&&_113)?_111.offset(-1*_112,_113):_111;},_getTimeOverlap:function(_114,_115){if(_114&&_115){return _114.intersection(_115);}else{return _114||_115;}},_getTimeFilter:function(_116){var _117=this.getTimeDefinition(),_118=null,_119;if(_117||_118){_119=this._getTimeOverlap(_117,_118);if(!_119){return [false];}}if(_116){_116=_119?this._getTimeOverlap(_116,_119):_116;if(!_116){return [false];}}else{_116=_119;}return [true,_116];},_getAttributeFilter:function(_11a){var _11b=this.getDefinitionExpression();if(_11a){_11a=_11b?"("+_11b+") AND ("+_11a+")":_11a;}else{_11a=_11b;}return _11a;},_applyQueryFilters:function(_11c){_11c.where=this._getAttributeFilter(_11c.where);_11c.maxAllowableOffset=this._maxOffset;if(this.timeInfo){var _11d=this._getTimeFilter(_11c.timeExtent);if(!_11d[0]){return false;}else{_11c.timeExtent=_11d[1];}}return true;},_add:function(_11e){var _11f=this._selectionSymbol,attr=_11e.attributes,_120=this.visibilityField;if(_11f&&this._isSelOnly){_11e.setSymbol(_11f);}if(_120&&attr&&attr.hasOwnProperty(_120)){_11e[attr[_120]?"show":"hide"]();}return this.add.apply(this,arguments);},_remove:function(){return this.remove.apply(this,arguments);},_canDoClientSideQuery:function(_121){var _122=[],map=this._map;if(this._isTable||!map){return;}if(_121.text||(_121.where&&_121.where!==this.getDefinitionExpression())){return;}var _123=this._isSnapshot,_124=this._isSelOnly;var _125=_121.geometry;if(_125){if(!_124&&_121.spatialRelationship===esri.tasks.Query.SPATIAL_REL_INTERSECTS&&(_125.type==="extent"&&(_123||map.extent.contains(_125)))){_122.push(1);}else{return;}}var ids=_121.objectIds;if(ids){if(_123){_122.push(2);}else{var len=ids.length,mode=this._mode,_126=0,i;for(i=0;i<len;i++){if(mode._getFeature(ids[i])){_126++;}}if(_126===len){_122.push(2);}else{return;}}}if(this.timeInfo){var _127=_121.timeExtent,_128=this._mapTimeExtent;if(_123){if(_127){_122.push(3);}}else{if(_124){if(_127){return;}}else{if(_128){if(dojo.indexOf(_122,2)!==-1){if(_127){_122.push(3);}}else{return;}}else{if(_122.length>0){if(_127){_122.push(3);}}else{if(_127){return;}}}}}}return _122.length>0?_122:null;},_doQuery:function(_129,_12a,_12b){var _12c=[],mode=this._mode,_12d=this.objectIdField,i,len,_12e;if(dojo.indexOf(_12a,2)!==-1){_12c=[];var ids=_129.objectIds;len=ids.length;for(i=0;i<len;i++){var obj=mode._getFeature(ids[i]);if(obj){_12c.push(obj);}}if(_12c.length===0){return [];}}if(dojo.indexOf(_12a,1)!==-1){_12e=_12c.length>0?_12c:this.graphics;len=_12e.length;var _12f=_129.geometry._normalize(null,true);_12c=[];for(i=0;i<len;i++){var _130=_12e[i],_131=_130.geometry;if(_131){if(this.normalization&&_12f.length){if(_12f[0].intersects(_131)||_12f[1].intersects(_131)){_12c.push(_130);}}else{if(_12f.intersects(_131)){_12c.push(_130);}}}}if(_12c.length===0){return [];}}if(dojo.indexOf(_12a,3)!==-1){if(this.timeInfo){_12e=_12c.length>0?_12c:this.graphics;var time=_129.timeExtent,_132=this._filterByTime(_12e,time.startTime,time.endTime);_12c=_132.match;}}if(_12b){return dojo.map(_12c,function(obj){return obj.attributes[_12d];},this);}else{return _12c;}},_filterByTime:function(_133,_134,_135){var _136=this._startTimeField,_137=this._endTimeField,_138;if(!this._twoTimeFields){_138=_136||_137;}var _139=esri._isDefined,yea=[],nay=[],i,len=_133.length,_13a,_13b;_134=_134?_134.getTime():-Infinity;_135=_135?_135.getTime():Infinity;if(_138){for(i=0;i<len;i++){_13a=_133[i];_13b=_13a.attributes;var time=_13b[_138];if(time>=_134&&time<=_135){yea.push(_13a);}else{nay.push(_13a);}}}else{for(i=0;i<len;i++){_13a=_133[i];_13b=_13a.attributes;var _13c=_13b[_136],end=_13b[_137];_13c=_139(_13c)?_13c:-Infinity;end=_139(end)?end:Infinity;if((_13c>=_134&&_13c<=_135)||(end>=_134&&end<=_135)||(_134>=_13c&&_135<=end)){yea.push(_13a);}else{nay.push(_13a);}}}return {match:yea,noMatch:nay};},_resolve:function(args,_13d,_13e,dfd,_13f){if(_13d){this[_13d].apply(this,args);}if(_13e){_13e.apply(null,args);}if(dfd){esri._resDfd(dfd,args,_13f);}},_getShallowClone:function(_140){var _141=new esri.tasks.Query(),prop;for(prop in _140){if(_140.hasOwnProperty(prop)){_141[prop]=_140[prop];}}return _141;},_query:function(type,_142,_143,_144,_145){var that=this,dfd=new dojo.Deferred(esri._dfdCanceller);var _146=function(_147,_148){if(!_148&&type==="execute"&&!that._isTable){var _149=_147.features,mode=that._mode,_14a=that.objectIdField,il=_149.length,i;for(i=il-1;i>=0;i--){var oid=_149[i].attributes[_14a];var _14b=mode._getFeature(oid);if(_14b){_149.splice(i,1,_14b);}}}that._resolve([_147],_142,_144,dfd);};if(type!=="executeRelationshipQuery"){_143=this._getShallowClone(_143);_143.outFields=this._getOutFields();_143.returnGeometry=true;var map=this._map,_14c;if(map){_143.outSpatialReference=new esri.SpatialReference(map.spatialReference.toJson());}if(!this._applyQueryFilters(_143)){switch(type){case "execute":_14c=new esri.tasks.FeatureSet({features:[]});break;case "executeForIds":_14c=[];break;case "executeForCount":_14c=0;break;}_146(_14c,true);return dfd;}var _14d=this._canDoClientSideQuery(_143);if(_14d){var _14e=this._doQuery(_143,_14d,(type==="executeForIds"||type==="executeForCount"));switch(type){case "execute":_14c=new esri.tasks.FeatureSet();_14c.features=_14e;break;case "executeForIds":_14c=_14e;break;case "executeForCount":_14c=_14e.length;break;}_146(_14c,true);return dfd;}}if(this._collection){var err=new Error("FeatureLayer::_query - "+esri.bundle.layers.FeatureLayer.invalidParams);this._resolve([err],null,_145,dfd,true);return dfd;}if(this._ts){_143._ts=(new Date()).getTime();}var temp=dfd._pendingDfd=this._task[type](_143);temp.addCallbacks(_146,function(err){that._resolve([err],null,_145,dfd,true);});return dfd;},_convertFeaturesToJson:function(_14f,_150,_151,_152){var json=[],_153=this._selectionSymbol,_154=this.visibilityField,i,_155,_156=this.objectIdField;if(_151||_152){_155=dojo.filter(this.fields,function(_157){return (_157.editable===false)&&(!_152||(_157.name!==_156));});}for(i=0;i<_14f.length;i++){var _158=_14f[i],_159={},_15a=_158.geometry,attr=_158.attributes,_15b=_158.symbol;if(_15a&&(!_152||this.allowGeometryUpdates)){_159.geometry=_15a.toJson();}if(_154){_159.attributes=attr=dojo.mixin({},attr);attr[_154]=_158.visible?1:0;}else{if(attr){_159.attributes=dojo.mixin({},attr);}}if(_159.attributes&&_155&&_155.length){dojo.forEach(_155,function(_15c){delete _159.attributes[_15c.name];});}if(_15b&&(_15b!==_153)){_159.symbol=_15b.toJson();}json.push(_159);}return _150?json:dojo.toJson(json);},_selectHandler:function(_15d,_15e,_15f,_160,dfd){var _161,ctor=this.constructor;switch(_15e){case ctor.SELECTION_NEW:this.clearSelection(true);_161=true;break;case ctor.SELECTION_ADD:_161=true;break;case ctor.SELECTION_SUBTRACT:_161=false;break;}var i,_162=_15d.features,mode=this._mode,_163=[],_164=this.objectIdField,_165,oid;if(_161){for(i=0;i<_162.length;i++){_165=_162[i];oid=_165.attributes[_164];var _166=mode._addFeatureIIf(oid,_165);_163.push(_166);this._selectFeatureIIf(oid,_166,mode);}}else{for(i=0;i<_162.length;i++){_165=_162[i];oid=_165.attributes[_164];this._unSelectFeatureIIf(oid,mode);var _167=mode._removeFeatureIIf(oid);_163.push(_167||_165);}}if(this._isSelOnly){mode._applyTimeFilter(true);}this._resolve([_163,_15e,_15d.exceededTransferLimit?{queryLimitExceeded:true}:null],"onSelectionComplete",_15f,dfd);if(_15d.exceededTransferLimit){this.onQueryLimitExceeded();}},_selectFeatureIIf:function(oid,_168,mode){var _169=this._selectedFeatures,_16a=_169[oid];if(!_16a){mode._incRefCount(oid);_169[oid]=_168;if(!this._isTable){this._setSelectSymbol(_168);}}return _16a||_168;},_unSelectFeatureIIf:function(oid,mode){var _16b=this._selectedFeatures[oid];if(_16b){mode._decRefCount(oid);delete this._selectedFeatures[oid];if(!this._isTable){this._setUnSelectSymbol(_16b);}}return _16b;},_isSelected:function(_16c){},_setSelectSymbol:function(_16d){var _16e=this._selectionSymbol;if(_16e&&!this._isSelOnly){_16d.setSymbol(_16e);}},_setUnSelectSymbol:function(_16f){var _170=this._selectionSymbol;if(_170&&!this._isSelOnly){if(_170===_16f.symbol){_16f.setSymbol(null,true);}}},_getOutFields:function(){var _171=dojo.filter([this.objectIdField,this.typeIdField,this.creatorField,this._startTimeField,this._endTimeField,this._trackIdField].concat(this._rendererFields),function(_172,_173,arr){return !!_172&&(dojo.indexOf(arr,_172)===_173);});var _174=dojo.clone(this._outFields);if(_174){if(dojo.indexOf(_174,"*")!==-1){return _174;}dojo.forEach(_171,function(_175){if(dojo.indexOf(_174,_175)===-1){_174.push(_175);}});return _174;}else{return _171;}},_checkFields:function(_176){var _177=_176||this._getOutFields();dojo.forEach(_177,function(_178){if(_178==="*"){return;}if(!this._getField(_178)){console.debug("esri.layers.FeatureLayer: "+esri.substitute({url:this.url,field:_178},esri.bundle.layers.FeatureLayer.fieldNotFound));}},this);if(!_176&&!this._isTable&&!this._fserver&&!this._collection){var _179=dojo.some(this.fields,function(_17a){return (_17a&&_17a.type==="esriFieldTypeGeometry")?true:false;});if(!_179){console.debug("esri.layers.FeatureLayer: "+esri.substitute({url:this.url},esri.bundle.layers.FeatureLayer.noGeometryField));}}},_fixRendererFields:function(){var _17b=this.renderer;if(_17b&&this.fields.length>0){var _17c=dojo.filter([_17b,_17b.observationRenderer,_17b.latestObservationRenderer,_17b.trackRenderer],esri._isDefined);var _17d=[];dojo.forEach(_17c,function(rnd){var _17e,_17f;_17f=rnd.attributeField;if(_17f){_17e=!this._getField(_17f)&&this._getField(_17f,true);if(_17e){rnd.attributeField=_17e.name;}}_17f=rnd.attributeField2;if(_17f){_17e=!this._getField(_17f)&&this._getField(_17f,true);if(_17e){rnd.attributeField2=_17e.name;}}_17f=rnd.attributeField3;if(_17f){_17e=!this._getField(_17f)&&this._getField(_17f,true);if(_17e){rnd.attributeField3=_17e.name;}}_17d.push(rnd.attributeField);_17d.push(rnd.attributeField2);_17d.push(rnd.attributeField3);},this);this._rendererFields=dojo.filter(_17d,esri._isDefined);}},_getField:function(_180,_181){var _182=this.fields;if(_182.length===0){return null;}var _183;if(_181){_180=_180.toLowerCase();}dojo.some(_182,function(_184){var _185=false;if(_181){_185=(_184&&_184.name.toLowerCase()===_180)?true:false;}else{_185=(_184&&_184.name===_180)?true:false;}if(_185){_183=_184;}return _185;});return _183;},_getDateOpts:function(){if(!this._dtOpts){var _186=dojo.map(dojo.filter(this.fields,function(_187){return !!(_187&&_187.type==="esriFieldTypeDate");}),function(_188){return _188.name;});this._dtOpts={properties:_186};}return this._dtOpts;},_applyNormalized:function(_189,_18a){if(_189&&_18a){dojo.forEach(_189,function(_18b,_18c){if(_18b&&_18a[_18c]){_18b.setGeometry(_18a[_18c]);}});}},_editHandler:function(_18d,adds,_18e,_18f,_190,dfd){var _191=_18d.addResults,_192=_18d.updateResults,_193=_18d.deleteResults,i,_194,oid,_195,attr,_196=this.objectIdField,mode=this._mode,_197=this._isTable;var _198=this.editFieldsInfo,_199=this._getOutFields()||[],_19a=_198&&_198.creatorField,_19b=_198&&_198.creationDateField,_19c=_198&&_198.editorField,_19d=_198&&_198.editDateField,_19e=_198&&_198.realm;if(dojo.indexOf(_199,"*")===-1){if(_19a&&dojo.indexOf(_199,_19a)===-1){_19a=null;}if(_19b&&dojo.indexOf(_199,_19b)===-1){_19b=null;}if(_19c&&dojo.indexOf(_199,_19c)===-1){_19c=null;}if(_19d&&dojo.indexOf(_199,_19d)===-1){_19d=null;}}var _19f=(_19b||_19d)?(new Date()).getTime():null,_1a0=(_19a||_19c)?this.getUserId():undefined;if(_1a0&&_19e){_1a0=_1a0+"@"+_19e;}if(_191){for(i=0;i<_191.length;i++){_191[i]=new esri.layers.FeatureEditResult(_191[i]);if(_197){continue;}_194=_191[i];if(_194.success){oid=_194.objectId;_195=adds[i];var gl=_195._graphicsLayer;if(gl&&gl!==this){gl.remove(_195);}attr=_195.attributes||{};attr[_196]=oid;if(_19a){attr[_19a]=_1a0;}if(_19c){attr[_19c]=_1a0;}if(_19b){attr[_19b]=_19f;}if(_19d){attr[_19d]=_19f;}_195.setAttributes(attr);mode.drawFeature(_195);}}}if(_192){for(i=0;i<_192.length;i++){_192[i]=new esri.layers.FeatureEditResult(_192[i]);if(_197){continue;}_194=_192[i];if(_194.success){oid=_194.objectId;_195=_18e[oid];var _1a1=mode._getFeature(oid);if(_1a1){if(_1a1.geometry!==_195.geometry){_1a1.setGeometry(esri.geometry.fromJson(_195.geometry.toJson()));}this._repaint(_1a1,oid);}_195=_1a1||_195;attr=_195.attributes||{};if(_19c){attr[_19c]=_1a0;}if(_19d){attr[_19d]=_19f;}_195.setAttributes(attr);}}}if(_193){var _1a2=[];for(i=0;i<_193.length;i++){_193[i]=new esri.layers.FeatureEditResult(_193[i]);if(_197){continue;}_194=_193[i];if(_194.success){oid=_194.objectId;_195=mode._getFeature(oid);if(_195){if(this._unSelectFeatureIIf(oid,mode)){_1a2.push(_195);}_195._count=0;mode._removeFeatureIIf(oid);}}}if(_1a2.length>0){this.onSelectionComplete(_1a2,this.constructor.SELECTION_SUBTRACT);}}this._resolve([_191,_192,_193],"onEditsComplete",_18f,dfd);},_sendAttachment:function(type,_1a3,_1a4,_1a5,_1a6){var _1a7=(type==="add")?"addAttachment":"updateAttachment",url=this._url.path+"/"+_1a3+"/"+_1a7,self=this;var dfd=esri.request({url:url,form:_1a4,content:dojo.mixin(this._url.query,{f:"json",token:this._getToken()||undefined}),callbackParamName:"callback.html",handleAs:"json"}).addCallback(function(_1a8){var _1a9=(type==="add")?"addAttachmentResult":"updateAttachmentResult",_1aa=(type==="add")?"onAddAttachmentComplete":"onUpdateAttachmentComplete",_1ab=new esri.layers.FeatureEditResult(_1a8[_1a9]);_1ab.attachmentId=_1ab.objectId;_1ab.objectId=_1a3;self._resolve([_1ab],_1aa,_1a5);return _1ab;}).addErrback(function(_1ac){self._resolve([_1ac],null,_1a6,null,true);});return dfd;},_repaint:function(_1ad,oid,_1ae){oid=esri._isDefined(oid)?oid:_1ad.attributes[this.objectIdField];if(!(oid in this._selectedFeatures)||!this._selectionSymbol){_1ad.setSymbol(_1ad.symbol,_1ae);}},_getKind:function(_1af){var _1b0=this._trackManager;if(_1b0){return _1b0.isLatestObservation(_1af)?1:0;}return 0;}});dojo.mixin(esri.layers.FeatureLayer,{MODE_SNAPSHOT:0,MODE_ONDEMAND:1,MODE_SELECTION:2,SELECTION_NEW:3,SELECTION_ADD:4,SELECTION_SUBTRACT:5,POPUP_NONE:"esriServerHTMLPopupTypeNone",POPUP_HTML_TEXT:"esriServerHTMLPopupTypeAsHTMLText",POPUP_URL:"esriServerHTMLPopupTypeAsURL"});esri._createWrappers("esri.layers.FeatureLayer");dojo.declare("esri.layers.FeatureType",null,{constructor:function(json){if(json&&dojo.isObject(json)){this.id=json.id;this.name=json.name;var _1b1=json.symbol;if(_1b1){this.symbol=esri.symbol.fromJson(_1b1);}var _1b2=json.domains,_1b3,i;var _1b4=this.domains={};for(_1b3 in _1b2){if(_1b2.hasOwnProperty(_1b3)){var _1b5=_1b2[_1b3];switch(_1b5.type){case "range":_1b4[_1b3]=new esri.layers.RangeDomain(_1b5);break;case "codedValue":_1b4[_1b3]=new esri.layers.CodedValueDomain(_1b5);break;case "inherited":_1b4[_1b3]=new esri.layers.InheritedDomain(_1b5);break;}}}var _1b6=json.templates;if(_1b6){var _1b7=this.templates=[];for(i=0;i<_1b6.length;i++){_1b7.push(new esri.layers.FeatureTemplate(_1b6[i]));}}}},toJson:function(){var json={id:this.id,name:this.name,symbol:this.symbol&&this.symbol.toJson()};var _1b8,_1b9=this.domains,_1ba=this.templates,_1bb=esri._sanitize;if(_1b9){var _1bc=json.domains={};for(_1b8 in _1b9){if(_1b9.hasOwnProperty(_1b8)){_1bc[_1b8]=_1b9[_1b8]&&_1b9[_1b8].toJson();}}_1bb(_1bc);}if(_1ba){json.templates=dojo.map(_1ba,function(_1bd){return _1bd.toJson();});}return _1bb(json);}});dojo.declare("esri.layers.FeatureTemplate",null,{constructor:function(json){if(json&&dojo.isObject(json)){this.name=json.name;this.description=json.description;this.drawingTool=json.drawingTool;var _1be=json.prototype;this.prototype=new esri.Graphic(_1be.geometry,null,_1be.attributes);}},toJson:function(){return esri._sanitize({name:this.name,description:this.description,drawingTool:this.drawingTool,prototype:this.prototype&&this.prototype.toJson()});}});dojo.mixin(esri.layers.FeatureTemplate,{TOOL_AUTO_COMPLETE_POLYGON:"esriFeatureEditToolAutoCompletePolygon",TOOL_CIRCLE:"esriFeatureEditToolCircle",TOOL_ELLIPSE:"esriFeatureEditToolEllipse",TOOL_FREEHAND:"esriFeatureEditToolFreehand",TOOL_LINE:"esriFeatureEditToolLine",TOOL_NONE:"esriFeatureEditToolNone",TOOL_POINT:"esriFeatureEditToolPoint",TOOL_POLYGON:"esriFeatureEditToolPolygon",TOOL_RECTANGLE:"esriFeatureEditToolRectangle",TOOL_ARROW:"esriFeatureEditToolArrow",TOOL_TRIANGLE:"esriFeatureEditToolTriangle",TOOL_LEFT_ARROW:"esriFeatureEditToolLeftArrow",TOOL_RIGHT_ARROW:"esriFeatureEditToolRightArrow",TOOL_UP_ARROW:"esriFeatureEditToolUpArrow",TOOL_DOWN_ARROW:"esriFeatureEditToolDownArrow"});dojo.declare("esri.layers.FeatureEditResult",null,{constructor:function(json){if(json&&dojo.isObject(json)){this.objectId=json.objectId;this.success=json.success;if(!json.success){var err=json.error;this.error=new Error();this.error.code=err.code;this.error.message=err.description;}}}});dojo.declare("esri.layers._RenderMode",null,{constructor:function(){this._prefix="jsonp_"+(dojo._scopeName||"dojo")+"IoScript";},initialize:function(map){},propertyChangeHandler:function(type){},destroy:function(){},drawFeature:function(_1bf){},suspend:function(){},resume:function(){},refresh:function(){},_incRefCount:function(oid){var _1c0=this._featureMap[oid];if(_1c0){_1c0._count++;}},_decRefCount:function(oid){var _1c1=this._featureMap[oid];if(_1c1){_1c1._count--;}},_getFeature:function(oid){return this._featureMap[oid];},_addFeatureIIf:function(oid,_1c2){var fmap=this._featureMap,_1c3=fmap[oid],_1c4=this.featureLayer;if(!_1c3){fmap[oid]=_1c2;_1c4._add(_1c2);_1c2._count=0;}return _1c3||_1c2;},_removeFeatureIIf:function(oid){var _1c5=this._featureMap[oid],_1c6=this.featureLayer;if(_1c5){if(_1c5._count){return;}delete this._featureMap[oid];_1c6._remove(_1c5);}return _1c5;},_clearIIf:function(){var i,_1c7=this.featureLayer,_1c8=_1c7.graphics,_1c9=_1c7._selectedFeatures,_1ca=_1c7.objectIdField;for(i=_1c8.length-1;i>=0;i--){var _1cb=_1c8[i];var oid=_1cb.attributes[_1ca];if(oid in _1c9){_1cb._count=1;continue;}_1cb._count=0;this._removeFeatureIIf(oid);}},_isPending:function(id){var dfd=dojo.io.script[this._prefix+id];return dfd?true:false;},_cancelPendingRequest:function(dfd,id){dfd=dfd||dojo.io.script[this._prefix+id];if(dfd){try{dfd.cancel();dojo.io.script._validCheck(dfd);}catch(e){}}},_purgeRequests:function(){dojo.io.script._validCheck(null);},_toggleVisibility:function(show){var _1cc=this.featureLayer,_1cd=_1cc.graphics,_1ce=show?"show":"hide",i,len=_1cd.length;show=show&&_1cc._ager;for(i=0;i<len;i++){var _1cf=_1cd[i];_1cf[_1ce]();if(show){_1cc._repaint(_1cf);}}},_applyTimeFilter:function(_1d0){var _1d1=this.featureLayer;if(!_1d1.timeInfo||_1d1._suspended){return;}if(!_1d0){_1d1._fireUpdateStart();}var _1d2=_1d1._trackManager;if(_1d2){_1d2.clearTracks();}var defn=_1d1.getTimeDefinition(),_1d3=_1d1._getOffsettedTE(_1d1._mapTimeExtent);if(_1d3){_1d3=_1d1._getTimeOverlap(defn,_1d3);if(_1d3){var _1d4=_1d1._filterByTime(_1d1.graphics,_1d3.startTime,_1d3.endTime);if(_1d2){_1d2.addFeatures(_1d4.match);}dojo.forEach(_1d4.match,function(_1d5){var _1d6=_1d5._shape;if(!_1d5.visible){_1d5.show();_1d6=_1d5._shape;_1d6&&_1d6._moveToFront();}if(_1d1._ager&&_1d6){_1d1._repaint(_1d5);}});dojo.forEach(_1d4.noMatch,function(_1d7){if(_1d7.visible){_1d7.hide();}});}else{this._toggleVisibility(false);}}else{if(_1d2){_1d2.addFeatures(_1d1.graphics);}this._toggleVisibility(true);}if(_1d2){_1d2.moveLatestToFront();_1d2.drawTracks();}if(!_1d0){_1d1._fireUpdateEnd();}}});dojo.declare("esri.layers._SelectionMode",[esri.layers._RenderMode],{constructor:function(_1d8){this.featureLayer=_1d8;this._featureMap={};},initialize:function(map){this.map=map;this._init=true;},propertyChangeHandler:function(type){if(this._init&&type===0){this._applyTimeFilter();}},destroy:function(){this._init=false;},resume:function(){this.propertyChangeHandler(0);}});dojo.declare("esri.layers._SnapshotMode",[esri.layers._RenderMode],{constructor:function(_1d9){this.featureLayer=_1d9;this._featureMap={};this._drawFeatures=dojo.hitch(this,this._drawFeatures);this._queryErrorHandler=dojo.hitch(this,this._queryErrorHandler);},initialize:function(map){this.map=map;var _1da=this.featureLayer;if(_1da._collection){this._applyTimeFilter();}else{this._fetchAll();}this._init=true;},propertyChangeHandler:function(type){if(this._init){if(type){this._fetchAll();}else{this._applyTimeFilter();}}},destroy:function(){this._init=false;},drawFeature:function(_1db){var _1dc=this.featureLayer,_1dd=_1dc.objectIdField,oid=_1db.attributes[_1dd];this._addFeatureIIf(oid,_1db);this._incRefCount(oid);},resume:function(){this.propertyChangeHandler(0);},refresh:function(){var _1de=this.featureLayer;if(_1de._collection){_1de._fireUpdateStart();_1de._refresh(true);_1de._fireUpdateEnd();}else{this._fetchAll();}},_getRequestId:function(_1df){var id="_"+_1df.name+_1df.layerId+_1df._ulid;return id.replace(/[^a-zA-Z0-9\_]+/g,"_");},_fetchAll:function(){var _1e0=this.featureLayer;if(_1e0._collection){return;}_1e0._fireUpdateStart();this._clearIIf();this._sendRequest();},_sendRequest:function(){var map=this.map,_1e1=this.featureLayer,_1e2=_1e1.getDefinitionExpression();var _1e3=new esri.tasks.Query();_1e3.outFields=_1e1._getOutFields();_1e3.where=_1e2||"1=1";_1e3.returnGeometry=true;_1e3.outSpatialReference=new esri.SpatialReference(map.spatialReference.toJson());_1e3.timeExtent=_1e1.getTimeDefinition();_1e3.maxAllowableOffset=_1e1._maxOffset;if(_1e1._ts){_1e3._ts=(new Date()).getTime();}var _1e4;if(_1e1._usePatch){_1e4=this._getRequestId(_1e1);this._cancelPendingRequest(null,_1e4);}_1e1._task.execute(_1e3,this._drawFeatures,this._queryErrorHandler,_1e4);},_drawFeatures:function(_1e5){this._purgeRequests();var _1e6=_1e5.features,_1e7=this.featureLayer,_1e8=_1e7.objectIdField,i,len=_1e6.length,_1e9,oid;for(i=0;i<len;i++){_1e9=_1e6[i];oid=_1e9.attributes[_1e8];this._addFeatureIIf(oid,_1e9);this._incRefCount(oid);}this._applyTimeFilter(true);_1e7._fireUpdateEnd(null,_1e5.exceededTransferLimit?{queryLimitExceeded:true}:null);if(_1e5.exceededTransferLimit){_1e7.onQueryLimitExceeded();}},_queryErrorHandler:function(err){this._purgeRequests();var _1ea=this.featureLayer;_1ea._errorHandler(err);_1ea._fireUpdateEnd(err);}});dojo.declare("esri.layers._OnDemandMode",[esri.layers._RenderMode],{constructor:function(_1eb){this.featureLayer=_1eb;this._featureMap={};this._queryErrorHandler=dojo.hitch(this,this._queryErrorHandler);},initialize:function(map){this.map=map;this._initialize();this._init=true;},propertyChangeHandler:function(type){if(this._init){if(type<2){this._zoomHandler();}}},destroy:function(){this._disableConnectors();this._init=false;},drawFeature:function(_1ec){var _1ed=this._gridLayer,geom=_1ec.geometry,_1ee=[];if(!geom){return;}_1ee=_1ed.getCellsInExtent((geom.type==="point")?{xmin:geom.x,ymin:geom.y,xmax:geom.x,ymax:geom.y}:geom.getExtent(),false).cells;var _1ef=this._cellMap,i,cell,oid=_1ec.attributes[this.featureLayer.objectIdField],_1f0,row,col;for(i=0;i<_1ee.length;i++){cell=_1ee[i];_1f0=cell.latticeID;row=cell.row;col=cell.col;if(_1f0){cell=(_1ef[_1f0]=(_1ef[_1f0]||cell));}else{_1ef[row]=_1ef[row]||{};cell=(_1ef[row][col]=(_1ef[row][col]||cell));}cell.features=cell.features||[];cell.features.push(_1ec);this._addFeatureIIf(oid,_1ec);this._incRefCount(oid);}},suspend:function(){if(!this._init){return;}this._disableConnectors();},resume:function(){if(!this._init){return;}this._enableConnectors();this._zoomHandler();},refresh:function(){this._zoomHandler();},_initialize:function(){var map=this.map,_1f1=this.featureLayer;var _1f2=_1f1._srInfo;this._gridLayer=new esri.layers._GridLayout(new esri.geometry.Point(_1f2?_1f2.valid[0]:map.extent.xmin,map.extent.ymax,map.spatialReference),{width:_1f1._tileWidth,height:_1f1._tileHeight},{width:map.width,height:map.height},_1f2);this._ioQueue=[];if(!_1f1._suspended){this._zoomHandler();this._enableConnectors();}},_enableConnectors:function(){var map=this.map;this._zoomConnect=dojo.connect(map,"onZoomEnd",this,this._zoomHandler);this._panConnect=dojo.connect(map,"onPanEnd",this,this._panHandler);this._resizeConnect=dojo.connect(map,"onResize",this,this._panHandler);},_disableConnectors:function(){dojo.disconnect(this._zoomConnect);dojo.disconnect(this._panConnect);dojo.disconnect(this._resizeConnect);},_zoomHandler:function(){this._processIOQueue(true);var _1f3=this.featureLayer,map=this.map;if(_1f3._suspended){return;}_1f3._fireUpdateStart();this._clearIIf();var _1f4=_1f3._trackManager;if(_1f4){_1f4.clearTracks();}this._cellMap={};this._gridLayer.setResolution(map.extent);this._sendRequest();},_panHandler:function(){this.featureLayer._fireUpdateStart();this._sendRequest(this.featureLayer._resized&&arguments[0]);},_getRequestId:function(_1f5,cell){var id="_"+_1f5.name+_1f5.layerId+_1f5._ulid+"_"+cell.resolution+"_"+(cell.latticeID||(cell.row+"_"+cell.col));return id.replace(/[^a-zA-Z0-9\_]+/g,"_");},_sendRequest:function(_1f6){this._exceeds=false;var _1f7=this.featureLayer,map=this.map,_1f8=_1f6||map.extent,_1f9=this._gridLayer.getCellsInExtent(_1f8,_1f7.latticeTiling),_1fa=_1f9.cells;if(!_1f7._editable){var _1fb=this._cellMap;_1fa=dojo.filter(_1fa,function(cell){if(cell.lattice){if(_1fb[cell.latticeID]){return false;}}else{if(_1fb[cell.row]&&_1fb[cell.row][cell.col]){return false;}}return true;});}var _1fc=_1f7._getOutFields(),_1fd=_1f7.getDefinitionExpression(),time=_1f7._getOffsettedTE(_1f7._mapTimeExtent),_1fe=_1f7._usePatch,_1ff=this._ioQueue,i,self=this,func=this._drawFeatures,cell,_200,_201;this._pending=this._pending||0;for(i=0;i<_1fa.length;i++){cell=_1fa[i];_200=new esri.tasks.Query();_200.geometry=cell.extent||cell.lattice;_200.outFields=_1fc;_200.where=_1fd;if(_1f7.latticeTiling&&cell.extent){_200.spatialRelationship=esri.tasks.Query.SPATIAL_REL_CONTAINS;}_200.returnGeometry=true;_200.timeExtent=time;_200.maxAllowableOffset=_1f7._maxOffset;if(_1f7._ts){_200._ts=(new Date()).getTime();}_201=null;if(_1fe){_201=this._getRequestId(_1f7,cell);if(this._isPending(_201)){continue;}}this._pending++;_1ff.push(_1f7._task.execute(_200,function(){var _202=cell;return function(_203){func.apply(self,[_203,_202]);};}.call(this),this._queryErrorHandler,_201));}this._removeOldCells(_1f8);this._endCheck();},_drawFeatures:function(_204,cell){this._exceeds=this._exceeds||_204.exceededTransferLimit;this._finalizeIO();var _205=this.featureLayer,map=this.map,_206=map.extent,_207=cell.extent,row=cell.row,col=cell.col,_208=_205.objectIdField,_209=_204.features,_20a=this._gridLayer,_20b=this._cellMap,i,len,_20c=cell.latticeID,_20d=_20c?_20b[_20c]:(_20b[row]&&_20b[row][col]);if((cell.resolution!=_20a._resolution)||(_20c?(_20c!==_20a.getLatticeID(_206)):(!_20a.intersects(_207,_206)))){if(_20d){this._removeCell(row,col,_20c);}}else{if(_20d){this._updateCell(_20d,_209);}else{cell.features=_209;if(_20c){_20b[_20c]=cell;}else{_20b[row]=_20b[row]||{};_20b[row][col]=cell;}len=_209.length;for(i=0;i<len;i++){var _20e=_209[i];var oid=_20e.attributes[_208];this._addFeatureIIf(oid,_20e);this._incRefCount(oid);}}}this._endCheck();},_queryErrorHandler:function(err){this._finalizeIO();this.featureLayer._errorHandler(err);this._endCheck(true);},_finalizeIO:function(){this._purgeRequests();this._pending--;},_endCheck:function(_20f){if(this._pending===0){this._processIOQueue();var _210=this.featureLayer,_211=_210._trackManager;if(_211){_211.clearTracks();_211.addFeatures(_210.graphics);if(_210._ager){dojo.forEach(_210.graphics,function(_212){if(_212._shape){_210._repaint(_212);}});}_211.moveLatestToFront();_211.drawTracks();}this.featureLayer._fireUpdateEnd(_20f&&new Error("FeatureLayer: "+esri.bundle.layers.FeatureLayer.updateError),this._exceeds?{queryLimitExceeded:true}:null);if(this._exceeds){_210.onQueryLimitExceeded();}}},_processIOQueue:function(_213){this._ioQueue=dojo.filter(this._ioQueue,function(dfd){var keep=dfd.fired>-1?false:true;return keep;});if(_213){dojo.forEach(this._ioQueue,this._cancelPendingRequest);}},_removeOldCells:function(_214){var _215=this._cellMap,_216=this._gridLayer,_217,_218;for(_217 in _215){if(_215[_217]){var row=_215[_217],_219=row.latticeID,_21a=0,_21b=0;if(_219){_21a++;if(_219!==_216.getLatticeID(_214)){this._removeCell(null,null,_219);_21b++;}}else{for(_218 in row){if(row[_218]){_21a++;var _21c=row[_218].extent;if(!_216.intersects(_21c,_214)){this._removeCell(_217,_218);_21b++;}}}}if(_21b===_21a){delete _215[_217];}}}},_updateCell:function(cell,_21d){var _21e=this.featureLayer,_21f=_21e.objectIdField,_220=_21e._selectedFeatures,i,len=_21d.length;cell.features=cell.features||[];for(i=0;i<len;i++){var _221=_21d[i];var oid=_221.attributes[_21f];var _222=this._addFeatureIIf(oid,_221);if(_222===_221){this._incRefCount(oid);cell.features.push(_222);}else{if(!(oid in _220)){_222.setGeometry(_221.geometry);_222.setAttributes(_221.attributes);}}}},_removeCell:function(row,col,_223){var _224=this._cellMap,_225=this.featureLayer,_226=_225.objectIdField;var cell=_223?_224[_223]:(_224[row]&&_224[row][col]);if(cell){if(_223){delete _224[_223];}else{delete _224[row][col];}var _227=cell.features,i;for(i=0;i<_227.length;i++){var _228=_227[i];var oid=_228.attributes[_226];this._decRefCount(oid);if(oid in _225._selectedFeatures){continue;}this._removeFeatureIIf(oid);}}}});dojo.declare("esri.layers._GridLayout",null,{constructor:function(_229,_22a,_22b,_22c){this.origin=_229;this.cellWidth=_22a.width;this.cellHeight=_22a.height;this.mapWidth=_22b.width;this.mapHeight=_22b.height;this.srInfo=_22c;},setResolution:function(_22d){this._resolution=(_22d.xmax-_22d.xmin)/this.mapWidth;if(this.srInfo){var _22e=Math.round((2*this.srInfo.valid[1])/this._resolution),_22f=Math.round(_22e/this.cellWidth);this._frameStats=[_22f,0,_22f-1];}},getCellCoordinates:function(_230){var res=this._resolution,_231=this.origin;return {row:Math.floor((_231.y-_230.y)/(this.cellHeight*res)),col:Math.floor((_230.x-_231.x)/(this.cellWidth*res))};},normalize:function(col){var _232=this._frameStats;if(_232){var _233=_232[0],m180=_232[1],p180=_232[2];if(col<m180){col=col%_233;col=col<m180?col+_233:col;}else{if(col>p180){col=col%_233;}}}return col;},intersects:function(_234,_235){var _236=this.srInfo;if(_236){return dojo.some(_235._getParts(_236),function(_237){return _234.intersects(_237.extent);});}else{return _234.intersects(_235);}},getCellExtent:function(row,col){var res=this._resolution,_238=this.origin,_239=this.cellWidth,_23a=this.cellHeight;return new esri.geometry.Extent((col*_239*res)+_238.x,_238.y-((row+1)*_23a*res),((col+1)*_239*res)+_238.x,_238.y-(row*_23a*res),new esri.SpatialReference(_238.spatialReference.toJson()));},getLatticeID:function(_23b){var _23c=this.getCellCoordinates({x:_23b.xmin,y:_23b.ymax}),_23d=this.getCellCoordinates({x:_23b.xmax,y:_23b.ymin}),_23e=_23c.row,_23f=_23d.row,_240=this.normalize(_23c.col),_241=this.normalize(_23d.col);return _23e+"_"+_23f+"_"+_240+"_"+_241;},sorter:function(a,b){return (a<b)?-1:1;},getCellsInExtent:function(_242,_243){var _244=this.getCellCoordinates({x:_242.xmin,y:_242.ymax}),_245=this.getCellCoordinates({x:_242.xmax,y:_242.ymin}),_246=_244.row,_247=_245.row,_248=_244.col,_249=_245.col,_24a=[],i,j,nj,_24b=[],_24c=[],len,xmin,xmax,ymin,ymax,_24d=[],_24e,_24f;for(i=_246;i<=_247;i++){for(j=_248;j<=_249;j++){nj=this.normalize(j);_242=this.getCellExtent(i,nj);_24a.push({row:i,col:nj,extent:_242,resolution:this._resolution});if(_243){_24b.push(_242.xmin,_242.xmax);_24c.push(_242.ymin,_242.ymax);}}}_248=this.normalize(_248);_249=this.normalize(_249);_24b.sort(this.sorter);_24c.sort(this.sorter);len=_24b.length;for(i=len-1;i>=0;i--){if(i<(len-1)){if(_24b[i]===_24b[i+1]){_24b.splice(i,1);}}}len=_24c.length;for(i=len-1;i>=0;i--){if(i<(len-1)){if(_24c[i]===_24c[i+1]){_24c.splice(i,1);}}}if(_24b.length&&_24c.length){xmin=_24b[0];xmax=_24b[_24b.length-1];ymin=_24c[0];ymax=_24c[_24c.length-1];len=_24b.length;for(i=0;i<len;i++){_24d.push([[_24b[i],ymax],[_24b[i],ymin]]);}len=_24c.length;for(i=0;i<len;i++){_24d.push([[xmin,_24c[i]],[xmax,_24c[i]]]);}_24e=new esri.geometry.Polyline({paths:_24d,spatialReference:this.origin.spatialReference.toJson()});_24f=_246+"_"+_247+"_"+_248+"_"+_249;_24a.push({latticeID:_24f,lattice:_24e,resolution:this._resolution});}return {minRow:_246,maxRow:_247,minCol:_248,maxCol:_249,cells:_24a};}});dojo.declare("esri.layers._TrackManager",null,{constructor:function(_250){this.layer=_250;this.trackMap={};},initialize:function(map){this.map=map;var _251=this.layer,_252=_251.renderer.trackRenderer;if(_252&&(_251.geometryType==="esriGeometryPoint")){var _253=(this.container=new esri.layers._GraphicsLayer({id:_251.id+"_tracks",_child:true}));_253._setMap(map,_251._div);_253.setRenderer(_252);}},addFeatures:function(_254){var tkid,_255=this.trackMap,_256=this.layer,_257=_256._trackIdField;dojo.forEach(_254,function(_258){var _259=_258.attributes;tkid=_259[_257];var ary=(_255[tkid]=(_255[tkid]||[]));ary.push(_258);});var _25a=_256._startTimeField,_25b=_256.objectIdField;var _25c=function(a,b){var _25d=a.attributes[_25a],_25e=b.attributes[_25a];if(_25d===_25e){return (a.attributes[_25b]<b.attributes[_25b])?-1:1;}else{return (_25d<_25e)?-1:1;}};for(tkid in _255){_255[tkid].sort(_25c);}},drawTracks:function(){var _25f=this.container;if(!_25f){return;}var _260=this.trackMap,sr=this.map.spatialReference,tkid,ary,path,i,_261;for(tkid in _260){ary=_260[tkid];path=[];for(i=ary.length-1;i>=0;i--){_261=ary[i].geometry;if(_261){path.push([_261.x,_261.y]);}}if(path.length>0){_25f.add(new esri.Graphic(new esri.geometry.Polyline({paths:[path],spatialReference:sr})));}}},moveLatestToFront:function(){dojo.forEach(this.getLatestObservations(),function(_262){var _263=_262._shape;_263&&_263._moveToFront();this._repaint(_262,null,true);},this.layer);},getLatestObservations:function(){var _264=[];if(!this.layer.renderer.latestObservationRenderer){return _264;}var _265=this.trackMap,tkid;for(tkid in _265){var ary=_265[tkid];_264.push(ary[ary.length-1]);}return _264;},clearTracks:function(){var _266=this.getLatestObservations();this.trackMap={};var _267=this.container;if(_267){_267.clear();}dojo.forEach(_266,function(_268){this._repaint(_268,null,true);},this.layer);},isLatestObservation:function(_269){var _26a=this.layer._trackIdField;var _26b=this.trackMap[_269.attributes[_26a]];if(_26b){return (_26b[_26b.length-1]===_269);}return false;},destroy:function(){var _26c=this.container;if(_26c){_26c.clear();_26c._unsetMap(this.map,this.layer._div);this.container=null;}this.map=null;this.layer=null;this.trackMap=null;}});}if(!dojo._hasResource["dojox.gfx.Mover"]){dojo._hasResource["dojox.gfx.Mover"]=true;dojo.provide("dojox.gfx.Mover");dojo.declare("dojox.gfx.Mover",null,{constructor:function(_26d,e,host){this.shape=_26d;this.lastX=e.clientX;this.lastY=e.clientY;var h=this.host=host,d=document;this.events=[dojo.connect(d,"onmousemove",this,"onFirstMove"),dojo.connect(d,"ontouchmove",this,"onFirstMove"),dojo.connect(d,"onmousemove",this,"onMouseMove"),dojo.connect(d,"ontouchmove",this,"onMouseMove"),dojo.connect(d,"onmouseup",this,"destroy"),dojo.connect(d,"ontouchend",this,"destroy"),dojo.connect(d,"ondragstart",dojo,"stopEvent"),dojo.connect(d,"onselectstart",dojo,"stopEvent")];if(h&&h.onMoveStart){h.onMoveStart(this);}},onMouseMove:function(e){var pos=e.touches?e.touches[0]:e;var x=pos.clientX;var y=pos.clientY;this.host.onMove(this,{dx:x-this.lastX,dy:y-this.lastY});this.lastX=x;this.lastY=y;dojo.stopEvent(e);},onFirstMove:function(){this.host.onFirstMove(this);dojo.disconnect(this.events.shift());dojo.disconnect(this.events.shift());},destroy:function(){dojo.forEach(this.events,dojo.disconnect);var h=this.host;if(h&&h.onMoveStop){h.onMoveStop(this);}this.events=this.shape=null;}});}if(!dojo._hasResource["dojox.gfx.Moveable"]){dojo._hasResource["dojox.gfx.Moveable"]=true;dojo.provide("dojox.gfx.Moveable");dojo.declare("dojox.gfx.Moveable",null,{constructor:function(_26e,_26f){this.shape=_26e;this.delay=(_26f&&_26f.delay>0)?_26f.delay:0;this.mover=(_26f&&_26f.mover)?_26f.mover:dojox.gfx.Mover;this.leftButtonOnly=_26f&&_26f.leftButtonOnly;this.events=[this.shape.connect("onmousedown",this,"onMouseDown"),this.shape.connect("ontouchstart",this,"onMouseDown")];},destroy:function(){dojo.forEach(this.events,this.shape.disconnect,this.shape);this.events=this.shape=null;},onMouseDown:function(e){var pos=e.touches?e.touches[0]:e;if(this.delay){this.events.push(this.shape.connect("onmousemove",this,"onMouseMove"));this.events.push(this.shape.connect("ontouchmove",this,"onMouseMove"));this.events.push(this.shape.connect("onmouseup",this,"onMouseUp"));this.events.push(this.shape.connect("ontouchend",this,"onMouseUp"));this._lastX=pos.clientX;this._lastY=pos.clientY;}else{if(!this.leftButtonOnly||(pos.button===dojo.mouseButtons.LEFT)){new this.mover(this.shape,pos,this);}}dojo.stopEvent(e);},onMouseMove:function(e){var pos=e.touches?e.touches[0]:e;if(Math.abs(pos.clientX-this._lastX)>this.delay||Math.abs(pos.clientY-this._lastY)>this.delay){this.onMouseUp(e);new this.mover(this.shape,pos,this);}dojo.stopEvent(e);},onMouseUp:function(e){this.shape.disconnect(this.events.shift());this.shape.disconnect(this.events.shift());},onMoveStart:function(_270){dojo.publish("/gfx/move/start",[_270]);dojo.addClass(dojo.body(),"dojoMove");},onMoveStop:function(_271){dojo.publish("/gfx/move/stop",[_271]);dojo.removeClass(dojo.body(),"dojoMove");},onFirstMove:function(_272){},onMove:function(_273,_274){this.onMoving(_273,_274);this.shape.applyLeftTransform(_274);this.onMoved(_273,_274);},onMoving:function(_275,_276){},onMoved:function(_277,_278){}});}if(!dojo._hasResource["dojox.gfx.move"]){dojo._hasResource["dojox.gfx.move"]=true;dojo.provide("dojox.gfx.move");}if(!dojo._hasResource["esri.toolbars._GraphicMover"]){dojo._hasResource["esri.toolbars._GraphicMover"]=true;dojo.provide("esri.toolbars._GraphicMover");dojo.declare("esri.toolbars._Mover",dojox.gfx.Mover,{constructor:function(_279,e,host){this.__e=e;}});dojo.declare("esri.toolbars._GraphicMover",null,{constructor:function(_27a,map,_27b){this.graphic=_27a;this.map=map;this.toolbar=_27b;this._enableGraphicMover();this._moved=false;},refresh:function(_27c){var _27d=this.graphic.getDojoShape();if(_27d&&(_27c||!_27d._hostGraphic)){this._disableGraphicMover();this._enableGraphicMover();}},destroy:function(){this._disableGraphicMover();},hasMoved:function(){return this._moved;},_enableGraphicMover:function(){var _27e=this.graphic;var _27f=_27e.getDojoShape();if(_27f){_27f._hostGraphic=_27e;this._moveable=new dojox.gfx.Moveable(_27f,{mover:esri.toolbars._Mover});this._moveStartHandle=dojo.connect(this._moveable,"onMoveStart",this,this._moveStartHandler);this._firstMoveHandle=dojo.connect(this._moveable,"onFirstMove",this,this._firstMoveHandler);this._movingHandle=dojo.connect(this._moveable,"onMoving",this,this._movingHandler);this._moveStopHandle=dojo.connect(this._moveable,"onMoveStop",this,this._moveStopHandler);var node=_27f.getEventSource();if(node){dojo.style(node,"cursor",this.toolbar._cursors.move);}}},_disableGraphicMover:function(){var _280=this._moveable;if(_280){dojo.disconnect(this._moveStartHandle);dojo.disconnect(this._firstMoveHandle);dojo.disconnect(this._movingHandle);dojo.disconnect(this._moveStopHandle);var _281=_280.shape;if(_281){_281._hostGraphic=null;var node=_281.getEventSource();if(node){dojo.style(node,"cursor",null);}}_280.destroy();}this._moveable=null;},_moveStartHandler:function(){var _282=this.graphic;this._startTx=_282.getDojoShape().getTransform();if(this.graphic.geometry.type==="point"){var map=this.map;if(map.snappingManager){map.snappingManager._setUpSnapping();}}this.toolbar.onGraphicMoveStart(_282);},_firstMoveHandler:function(){this.toolbar._beginOperation("MOVE");this.toolbar.onGraphicFirstMove(this.graphic);},_movingHandler:function(_283){this.toolbar.onGraphicMove(this.graphic,_283.shape.getTransform());},_moveStopHandler:function(_284){var _285=this.graphic,map=this.map,mx=dojox.gfx.matrix,_286=_285.geometry,type=_286.type,_287=_285.getDojoShape(),tx=_287.getTransform();if(dojo.toJson(tx)!==dojo.toJson(this._startTx)){this._moved=true;switch(type){case "point":var _288=[tx,mx.invert(this._startTx)];var _289;if(map.snappingManager){_289=map.snappingManager._snappingPoint;}_286=_289||map.toMap(mx.multiplyPoint(_288,map.toScreen(_286,true)));if(map.snappingManager){map.snappingManager._killOffSnapping();}break;case "polyline":_286=this._updatePolyGeometry(_286,_286.paths,tx);break;case "polygon":_286=this._updatePolyGeometry(_286,_286.rings,tx);break;}_287.setTransform(null);_285.setGeometry(_286);}else{this._moved=false;}this.toolbar._endOperation("MOVE");this.toolbar.onGraphicMoveStop(_285,tx);if(!this._moved){var e=_284.__e,_28a=this.map.position,pt=new esri.geometry.Point(e.pageX-_28a.x,e.pageY-_28a.y);this.toolbar.onGraphicClick(_285,{screenPoint:pt,mapPoint:this.map.toMap(pt)});}},_updatePolyGeometry:function(_28b,_28c,_28d){var map=this.map;var _28e=_28b.getPoint(0,0);var _28f=map.toMap(map.toScreen(_28e).offset(_28d.dx,_28d.dy));var _290=_28f.x-_28e.x;var _291=_28f.y-_28e.y;for(var i=0;i<_28c.length;i++){var seg=_28c[i];for(var j=0;j<seg.length;j++){var _292=_28b.getPoint(i,j);_28b.setPoint(i,j,_292.offset(_290,_291));}}return _28b;}});}if(!dojo._hasResource["dijit._KeyNavContainer"]){dojo._hasResource["dijit._KeyNavContainer"]=true;dojo.provide("dijit._KeyNavContainer");dojo.declare("dijit._KeyNavContainer",dijit._Container,{tabIndex:"0",_keyNavCodes:{},connectKeyNavHandlers:function(_293,_294){var _295=(this._keyNavCodes={});var prev=dojo.hitch(this,this.focusPrev);var next=dojo.hitch(this,this.focusNext);dojo.forEach(_293,function(code){_295[code]=prev;});dojo.forEach(_294,function(code){_295[code]=next;});_295[dojo.keys.HOME]=dojo.hitch(this,"focusFirstChild");_295[dojo.keys.END]=dojo.hitch(this,"focusLastChild");this.connect(this.domNode,"onkeypress","_onContainerKeypress");this.connect(this.domNode,"onfocus","_onContainerFocus");},startupKeyNavChildren:function(){dojo.forEach(this.getChildren(),dojo.hitch(this,"_startupChild"));},addChild:function(_296,_297){dijit._KeyNavContainer.superclass.addChild.apply(this,arguments);this._startupChild(_296);},focus:function(){this.focusFirstChild();},focusFirstChild:function(){var _298=this._getFirstFocusableChild();if(_298){this.focusChild(_298);}},focusLastChild:function(){var _299=this._getLastFocusableChild();if(_299){this.focusChild(_299);}},focusNext:function(){var _29a=this._getNextFocusableChild(this.focusedChild,1);this.focusChild(_29a);},focusPrev:function(){var _29b=this._getNextFocusableChild(this.focusedChild,-1);this.focusChild(_29b,true);},focusChild:function(_29c,last){if(this.focusedChild&&_29c!==this.focusedChild){this._onChildBlur(this.focusedChild);}_29c.set("tabIndex",this.tabIndex);_29c.focus(last?"end":"start");this._set("focusedChild",_29c);},_startupChild:function(_29d){_29d.set("tabIndex","-1");this.connect(_29d,"_onFocus",function(){_29d.set("tabIndex",this.tabIndex);});this.connect(_29d,"_onBlur",function(){_29d.set("tabIndex","-1");});},_onContainerFocus:function(evt){if(evt.target!==this.domNode){return;}this.focusFirstChild();dojo.attr(this.domNode,"tabIndex","-1");},_onBlur:function(evt){if(this.tabIndex){dojo.attr(this.domNode,"tabIndex",this.tabIndex);}this.inherited(arguments);},_onContainerKeypress:function(evt){if(evt.ctrlKey||evt.altKey){return;}var func=this._keyNavCodes[evt.charOrCode];if(func){func();dojo.stopEvent(evt);}},_onChildBlur:function(_29e){},_getFirstFocusableChild:function(){return this._getNextFocusableChild(null,1);},_getLastFocusableChild:function(){return this._getNextFocusableChild(null,-1);},_getNextFocusableChild:function(_29f,dir){if(_29f){_29f=this._getSiblingOfChild(_29f,dir);}var _2a0=this.getChildren();for(var i=0;i<_2a0.length;i++){if(!_29f){_29f=_2a0[(dir>0)?0:(_2a0.length-1)];}if(_29f.isFocusable()){return _29f;}_29f=this._getSiblingOfChild(_29f,dir);}return null;}});}if(!dojo._hasResource["dijit._Contained"]){dojo._hasResource["dijit._Contained"]=true;dojo.provide("dijit._Contained");dojo.declare("dijit._Contained",null,{getParent:function(){var _2a1=dijit.getEnclosingWidget(this.domNode.parentNode);return _2a1&&_2a1.isContainer?_2a1:null;},_getSibling:function(_2a2){var node=this.domNode;do{node=node[_2a2+"Sibling"];}while(node&&node.nodeType!=1);return node&&dijit.byNode(node);},getPreviousSibling:function(){return this._getSibling("previous");},getNextSibling:function(){return this._getSibling("next");},getIndexInParent:function(){var p=this.getParent();if(!p||!p.getIndexOfChild){return -1;}return p.getIndexOfChild(this);}});}if(!dojo._hasResource["dijit.MenuItem"]){dojo._hasResource["dijit.MenuItem"]=true;dojo.provide("dijit.MenuItem");dojo.declare("dijit.MenuItem",[dijit._Widget,dijit._Templated,dijit._Contained,dijit._CssStateMixin],{templateString:dojo.cache("dijit","templates/MenuItem.html","<tr class=\"dijitReset dijitMenuItem\" dojoAttachPoint=\"focusNode\" role=\"menuitem\" tabIndex=\"-1\"\r\n\t\tdojoAttachEvent=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\r\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\r\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitIcon dijitMenuItemIcon\" dojoAttachPoint=\"iconNode\"/>\r\n\t</td>\r\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" dojoAttachPoint=\"containerNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" dojoAttachPoint=\"accelKeyNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\">\r\n\t\t<div dojoAttachPoint=\"arrowWrapper\" style=\"visibility: hidden\">\r\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuExpand\"/>\r\n\t\t\t<span class=\"dijitMenuExpandA11y\">+</span>\r\n\t\t</div>\r\n\t</td>\r\n</tr>\r\n"),attributeMap:dojo.delegate(dijit._Widget.prototype.attributeMap,{label:{node:"containerNode",type:"innerHTML"},iconClass:{node:"iconNode",type:"class"}}),baseClass:"dijitMenuItem",label:"",iconClass:"",accelKey:"",disabled:false,_fillContent:function(_2a3){if(_2a3&&!("label" in this.params)){this.set("label",_2a3.innerHTML);}},buildRendering:function(){this.inherited(arguments);var _2a4=this.id+"_text";dojo.attr(this.containerNode,"id",_2a4);if(this.accelKeyNode){dojo.attr(this.accelKeyNode,"id",this.id+"_accel");_2a4+=" "+this.id+"_accel";}dijit.setWaiState(this.domNode,"labelledby",_2a4);dojo.setSelectable(this.domNode,false);},_onHover:function(){this.getParent().onItemHover(this);},_onUnhover:function(){this.getParent().onItemUnhover(this);this._set("hovering",false);},_onClick:function(evt){this.getParent().onItemClick(this,evt);dojo.stopEvent(evt);},onClick:function(evt){},focus:function(){try{if(dojo.isIE==8){this.containerNode.focus();}dijit.focus(this.focusNode);}catch(e){}},_onFocus:function(){this._setSelected(true);this.getParent()._onItemFocus(this);this.inherited(arguments);},_setSelected:function(_2a5){dojo.toggleClass(this.domNode,"dijitMenuItemSelected",_2a5);},setLabel:function(_2a6){dojo.deprecated("dijit.MenuItem.setLabel() is deprecated.  Use set('label', ...) instead.","","2.0");this.set("label",_2a6);},setDisabled:function(_2a7){dojo.deprecated("dijit.Menu.setDisabled() is deprecated.  Use set('disabled', bool) instead.","","2.0");this.set("disabled",_2a7);},_setDisabledAttr:function(_2a8){dijit.setWaiState(this.focusNode,"disabled",_2a8?"true":"false");this._set("disabled",_2a8);},_setAccelKeyAttr:function(_2a9){this.accelKeyNode.style.display=_2a9?"":"none";this.accelKeyNode.innerHTML=_2a9;dojo.attr(this.containerNode,"colSpan",_2a9?"1":"2");this._set("accelKey",_2a9);}});}if(!dojo._hasResource["dijit.PopupMenuItem"]){dojo._hasResource["dijit.PopupMenuItem"]=true;dojo.provide("dijit.PopupMenuItem");dojo.declare("dijit.PopupMenuItem",dijit.MenuItem,{_fillContent:function(){if(this.srcNodeRef){var _2aa=dojo.query("*",this.srcNodeRef);dijit.PopupMenuItem.superclass._fillContent.call(this,_2aa[0]);this.dropDownContainer=this.srcNodeRef;}},startup:function(){if(this._started){return;}this.inherited(arguments);if(!this.popup){var node=dojo.query("[widgetId]",this.dropDownContainer)[0];this.popup=dijit.byNode(node);}dojo.body().appendChild(this.popup.domNode);this.popup.startup();this.popup.domNode.style.display="none";if(this.arrowWrapper){dojo.style(this.arrowWrapper,"visibility","");}dijit.setWaiState(this.focusNode,"haspopup","true");},destroyDescendants:function(){if(this.popup){if(!this.popup._destroyed){this.popup.destroyRecursive();}delete this.popup;}this.inherited(arguments);}});}if(!dojo._hasResource["dijit.CheckedMenuItem"]){dojo._hasResource["dijit.CheckedMenuItem"]=true;dojo.provide("dijit.CheckedMenuItem");dojo.declare("dijit.CheckedMenuItem",dijit.MenuItem,{templateString:dojo.cache("dijit","templates/CheckedMenuItem.html","<tr class=\"dijitReset dijitMenuItem\" dojoAttachPoint=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\"\r\n\t\tdojoAttachEvent=\"onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick\">\r\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\r\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon dijitCheckedMenuItemIcon\" dojoAttachPoint=\"iconNode\"/>\r\n\t\t<span class=\"dijitCheckedMenuItemIconChar\">&#10003;</span>\r\n\t</td>\r\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" dojoAttachPoint=\"containerNode,labelNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" dojoAttachPoint=\"accelKeyNode\"></td>\r\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\">&nbsp;</td>\r\n</tr>\r\n"),checked:false,_setCheckedAttr:function(_2ab){dojo.toggleClass(this.domNode,"dijitCheckedMenuItemChecked",_2ab);dijit.setWaiState(this.domNode,"checked",_2ab);this._set("checked",_2ab);},onChange:function(_2ac){},_onClick:function(e){if(!this.disabled){this.set("checked",!this.checked);this.onChange(this.checked);}this.inherited(arguments);}});}if(!dojo._hasResource["dijit.MenuSeparator"]){dojo._hasResource["dijit.MenuSeparator"]=true;dojo.provide("dijit.MenuSeparator");dojo.declare("dijit.MenuSeparator",[dijit._Widget,dijit._Templated,dijit._Contained],{templateString:dojo.cache("dijit","templates/MenuSeparator.html","<tr class=\"dijitMenuSeparator\">\r\n\t<td class=\"dijitMenuSeparatorIconCell\">\r\n\t\t<div class=\"dijitMenuSeparatorTop\"></div>\r\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\r\n\t</td>\r\n\t<td colspan=\"3\" class=\"dijitMenuSeparatorLabelCell\">\r\n\t\t<div class=\"dijitMenuSeparatorTop dijitMenuSeparatorLabel\"></div>\r\n\t\t<div class=\"dijitMenuSeparatorBottom\"></div>\r\n\t</td>\r\n</tr>\r\n"),buildRendering:function(){this.inherited(arguments);dojo.setSelectable(this.domNode,false);},isFocusable:function(){return false;}});}if(!dojo._hasResource["dijit.Menu"]){dojo._hasResource["dijit.Menu"]=true;dojo.provide("dijit.Menu");dojo.declare("dijit._MenuBase",[dijit._Widget,dijit._Templated,dijit._KeyNavContainer],{parentMenu:null,popupDelay:500,startup:function(){if(this._started){return;}dojo.forEach(this.getChildren(),function(_2ad){_2ad.startup();});this.startupKeyNavChildren();this.inherited(arguments);},onExecute:function(){},onCancel:function(_2ae){},_moveToPopup:function(evt){if(this.focusedChild&&this.focusedChild.popup&&!this.focusedChild.disabled){this.focusedChild._onClick(evt);}else{var _2af=this._getTopMenu();if(_2af&&_2af._isMenuBar){_2af.focusNext();}}},_onPopupHover:function(evt){if(this.currentPopup&&this.currentPopup._pendingClose_timer){var _2b0=this.currentPopup.parentMenu;if(_2b0.focusedChild){_2b0.focusedChild._setSelected(false);}_2b0.focusedChild=this.currentPopup.from_item;_2b0.focusedChild._setSelected(true);this._stopPendingCloseTimer(this.currentPopup);}},onItemHover:function(item){if(this.isActive){this.focusChild(item);if(this.focusedChild.popup&&!this.focusedChild.disabled&&!this.hover_timer){this.hover_timer=setTimeout(dojo.hitch(this,"_openPopup"),this.popupDelay);}}if(this.focusedChild){this.focusChild(item);}this._hoveredChild=item;},_onChildBlur:function(item){this._stopPopupTimer();item._setSelected(false);var _2b1=item.popup;if(_2b1){this._stopPendingCloseTimer(_2b1);_2b1._pendingClose_timer=setTimeout(function(){_2b1._pendingClose_timer=null;if(_2b1.parentMenu){_2b1.parentMenu.currentPopup=null;}dijit.popup.close(_2b1);},this.popupDelay);}},onItemUnhover:function(item){if(this.isActive){this._stopPopupTimer();}if(this._hoveredChild==item){this._hoveredChild=null;}},_stopPopupTimer:function(){if(this.hover_timer){clearTimeout(this.hover_timer);this.hover_timer=null;}},_stopPendingCloseTimer:function(_2b2){if(_2b2._pendingClose_timer){clearTimeout(_2b2._pendingClose_timer);_2b2._pendingClose_timer=null;}},_stopFocusTimer:function(){if(this._focus_timer){clearTimeout(this._focus_timer);this._focus_timer=null;}},_getTopMenu:function(){for(var top=this;top.parentMenu;top=top.parentMenu){}return top;},onItemClick:function(item,evt){if(typeof this.isShowingNow=="undefined"){this._markActive();}this.focusChild(item);if(item.disabled){return false;}if(item.popup){this._openPopup();}else{this.onExecute();item.onClick(evt);}},_openPopup:function(){this._stopPopupTimer();var _2b3=this.focusedChild;if(!_2b3){return;}var _2b4=_2b3.popup;if(_2b4.isShowingNow){return;}if(this.currentPopup){this._stopPendingCloseTimer(this.currentPopup);dijit.popup.close(this.currentPopup);}_2b4.parentMenu=this;_2b4.from_item=_2b3;var self=this;dijit.popup.open({parent:this,popup:_2b4,around:_2b3.domNode,orient:this._orient||(this.isLeftToRight()?{"TR":"TL","TL":"TR","BR":"BL","BL":"BR"}:{"TL":"TR","TR":"TL","BL":"BR","BR":"BL"}),onCancel:function(){self.focusChild(_2b3);self._cleanUp();_2b3._setSelected(true);self.focusedChild=_2b3;},onExecute:dojo.hitch(this,"_cleanUp")});this.currentPopup=_2b4;_2b4.connect(_2b4.domNode,"onmouseenter",dojo.hitch(self,"_onPopupHover"));if(_2b4.focus){_2b4._focus_timer=setTimeout(dojo.hitch(_2b4,function(){this._focus_timer=null;this.focus();}),0);}},_markActive:function(){this.isActive=true;dojo.replaceClass(this.domNode,"dijitMenuActive","dijitMenuPassive");},onOpen:function(e){this.isShowingNow=true;this._markActive();},_markInactive:function(){this.isActive=false;dojo.replaceClass(this.domNode,"dijitMenuPassive","dijitMenuActive");},onClose:function(){this._stopFocusTimer();this._markInactive();this.isShowingNow=false;this.parentMenu=null;},_closeChild:function(){this._stopPopupTimer();var _2b5=this.focusedChild&&this.focusedChild.from_item;if(this.currentPopup){if(dijit._curFocus&&dojo.isDescendant(dijit._curFocus,this.currentPopup.domNode)){this.focusedChild.focusNode.focus();}dijit.popup.close(this.currentPopup);this.currentPopup=null;}if(this.focusedChild){this.focusedChild._setSelected(false);this.focusedChild._onUnhover();this.focusedChild=null;}},_onItemFocus:function(item){if(this._hoveredChild&&this._hoveredChild!=item){this._hoveredChild._onUnhover();}},_onBlur:function(){this._cleanUp();this.inherited(arguments);},_cleanUp:function(){this._closeChild();if(typeof this.isShowingNow=="undefined"){this._markInactive();}}});dojo.declare("dijit.Menu",dijit._MenuBase,{constructor:function(){this._bindings=[];},templateString:dojo.cache("dijit","templates/Menu.html","<table class=\"dijit dijitMenu dijitMenuPassive dijitReset dijitMenuTable\" role=\"menu\" tabIndex=\"${tabIndex}\" dojoAttachEvent=\"onkeypress:_onKeyPress\" cellspacing=\"0\">\r\n\t<tbody class=\"dijitReset\" dojoAttachPoint=\"containerNode\"></tbody>\r\n</table>\r\n"),baseClass:"dijitMenu",targetNodeIds:[],contextMenuForWindow:false,leftClickToOpen:false,refocus:true,postCreate:function(){if(this.contextMenuForWindow){this.bindDomNode(dojo.body());}else{dojo.forEach(this.targetNodeIds,this.bindDomNode,this);}var k=dojo.keys,l=this.isLeftToRight();this._openSubMenuKey=l?k.RIGHT_ARROW:k.LEFT_ARROW;this._closeSubMenuKey=l?k.LEFT_ARROW:k.RIGHT_ARROW;this.connectKeyNavHandlers([k.UP_ARROW],[k.DOWN_ARROW]);},_onKeyPress:function(evt){if(evt.ctrlKey||evt.altKey){return;}switch(evt.charOrCode){case this._openSubMenuKey:this._moveToPopup(evt);dojo.stopEvent(evt);break;case this._closeSubMenuKey:if(this.parentMenu){if(this.parentMenu._isMenuBar){this.parentMenu.focusPrev();}else{this.onCancel(false);}}else{dojo.stopEvent(evt);}break;}},_iframeContentWindow:function(_2b6){var win=dojo.window.get(this._iframeContentDocument(_2b6))||this._iframeContentDocument(_2b6)["__parent__"]||(_2b6.name&&dojo.doc.frames[_2b6.name])||null;return win;},_iframeContentDocument:function(_2b7){var doc=_2b7.contentDocument||(_2b7.contentWindow&&_2b7.contentWindow.document)||(_2b7.name&&dojo.doc.frames[_2b7.name]&&dojo.doc.frames[_2b7.name].document)||null;return doc;},bindDomNode:function(node){node=dojo.byId(node);var cn;if(node.tagName.toLowerCase()=="iframe"){var _2b8=node,win=this._iframeContentWindow(_2b8);cn=dojo.withGlobal(win,dojo.body);}else{cn=(node==dojo.body()?dojo.doc.documentElement:node);}var _2b9={node:node,iframe:_2b8};dojo.attr(node,"_dijitMenu"+this.id,this._bindings.push(_2b9));var _2ba=dojo.hitch(this,function(cn){return [dojo.connect(cn,this.leftClickToOpen?"onclick":"oncontextmenu",this,function(evt){dojo.stopEvent(evt);this._scheduleOpen(evt.target,_2b8,{x:evt.pageX,y:evt.pageY});}),dojo.connect(cn,"onkeydown",this,function(evt){if(evt.shiftKey&&evt.keyCode==dojo.keys.F10){dojo.stopEvent(evt);this._scheduleOpen(evt.target,_2b8);}})];});_2b9.connects=cn?_2ba(cn):[];if(_2b8){_2b9.onloadHandler=dojo.hitch(this,function(){var win=this._iframeContentWindow(_2b8);cn=dojo.withGlobal(win,dojo.body);_2b9.connects=_2ba(cn);});if(_2b8.addEventListener){_2b8.addEventListener("load",_2b9.onloadHandler,false);}else{_2b8.attachEvent("onload",_2b9.onloadHandler);}}},unBindDomNode:function(_2bb){var node;try{node=dojo.byId(_2bb);}catch(e){return;}var _2bc="_dijitMenu"+this.id;if(node&&dojo.hasAttr(node,_2bc)){var bid=dojo.attr(node,_2bc)-1,b=this._bindings[bid];dojo.forEach(b.connects,dojo.disconnect);var _2bd=b.iframe;if(_2bd){if(_2bd.removeEventListener){_2bd.removeEventListener("load",b.onloadHandler,false);}else{_2bd.detachEvent("onload",b.onloadHandler);}}dojo.removeAttr(node,_2bc);delete this._bindings[bid];}},_scheduleOpen:function(_2be,_2bf,_2c0){if(!this._openTimer){this._openTimer=setTimeout(dojo.hitch(this,function(){delete this._openTimer;this._openMyself({target:_2be,iframe:_2bf,coords:_2c0});}),1);}},_openMyself:function(args){var _2c1=args.target,_2c2=args.iframe,_2c3=args.coords;if(_2c3){if(_2c2){var od=_2c1.ownerDocument,ifc=dojo.position(_2c2,true),win=this._iframeContentWindow(_2c2),_2c4=dojo.withGlobal(win,"_docScroll",dojo);var cs=dojo.getComputedStyle(_2c2),tp=dojo._toPixelValue,left=(dojo.isIE&&dojo.isQuirks?0:tp(_2c2,cs.paddingLeft))+(dojo.isIE&&dojo.isQuirks?tp(_2c2,cs.borderLeftWidth):0),top=(dojo.isIE&&dojo.isQuirks?0:tp(_2c2,cs.paddingTop))+(dojo.isIE&&dojo.isQuirks?tp(_2c2,cs.borderTopWidth):0);_2c3.x+=ifc.x+left-_2c4.x;_2c3.y+=ifc.y+top-_2c4.y;}}else{_2c3=dojo.position(_2c1,true);_2c3.x+=10;_2c3.y+=10;}var self=this;var _2c5=dijit.getFocus(this);function _2c6(){if(self.refocus){dijit.focus(_2c5);}dijit.popup.close(self);};dijit.popup.open({popup:this,x:_2c3.x,y:_2c3.y,onExecute:_2c6,onCancel:_2c6,orient:this.isLeftToRight()?"L":"R"});this.focus();this._onBlur=function(){this.inherited("_onBlur",arguments);dijit.popup.close(this);};},uninitialize:function(){dojo.forEach(this._bindings,function(b){if(b){this.unBindDomNode(b.node);}},this);this.inherited(arguments);}});}if(!dojo._hasResource["esri.toolbars._VertexMover"]){dojo._hasResource["esri.toolbars._VertexMover"]=true;dojo.provide("esri.toolbars._VertexMover");dojo.declare("esri.toolbars.VertexMover",null,{constructor:function(_2c7,_2c8,_2c9,_2ca,_2cb,_2cc,_2cd,_2ce){this.point=_2c7;this.symbol=_2c8;this.relatedGraphic=_2c9;this.segIndex=_2ca;this.ptIndex=_2cb;this.segLength=_2cc;this.editor=_2cd;this.map=_2cd.map;this._scratchGL=_2cd.toolbar._scratchGL;this._placeholder=_2ce||false;this._type=_2c9.geometry.type;this._init();this._enable();},refresh:function(_2cf){if(_2cf||this._needRefresh()){this._disable();this._enable();}},destroy:function(){this._disable();if(this.graphic){this._scratchGL.remove(this.graphic);}this.point=this.symbol=this.graphic=this.relatedGraphic=this.segIndex=this.ptIndex=this.segLength=this.editor=this.map=this._scratchGL=null;},_init:function(){var _2d0=new esri.geometry.Point(this.point.toJson());var _2d1=new esri.Graphic(_2d0,this.symbol);switch(this._type){case "multipoint":_2d1._shape=this.relatedGraphic.getDojoShape().children[this.ptIndex];break;case "polyline":case "polygon":this._scratchGL.add(_2d1);break;}this.graphic=_2d1;},_enable:function(){var _2d2=this.graphic.getDojoShape();if(_2d2){_2d2._hasMover=true;this._moveable=this._getMoveable(_2d2);var node=_2d2.getEventSource();if(node){dojo.style(node,"cursor",this.editor.toolbar._cursors[this._placeholder?"move-gv":"move-v"]);}}},_disable:function(){var _2d3=this._moveable;if(_2d3){dojo.disconnect(this._startHandle);dojo.disconnect(this._firstHandle);dojo.disconnect(this._movingHandle);dojo.disconnect(this._stopHandle);var _2d4=_2d3.shape;if(_2d4){var node=_2d4.getEventSource();if(node){dojo.style(node,"cursor",null);}}_2d3.destroy();this._moveable=null;}},_needRefresh:function(){var _2d5=this.graphic.getDojoShape(),need=false;if(_2d5){switch(this._type){case "multipoint":var _2d6=this.relatedGraphic.getDojoShape();if(_2d6){var _2d7=_2d6.children[this.ptIndex];if(_2d5!==_2d7){_2d5=_2d7;this.graphic._shape=_2d5;need=true;}}break;case "polyline":case "polygon":need=!_2d5._hasMover;break;}}return need;},_getMoveable:function(_2d8){var _2d9=new dojox.gfx.Moveable(_2d8,dojo.isMac&&dojo.isFF&&!esri.isTouchEnabled&&{leftButtonOnly:true});this._startHandle=dojo.connect(_2d9,"onMoveStart",this,this._moveStartHandler);this._firstHandle=dojo.connect(_2d9,"onFirstMove",this,this._firstMoveHandler);this._movingHandle=dojo.connect(_2d9,"onMoving",this,this._movingHandler);this._stopHandle=dojo.connect(_2d9,"onMoveStop",this,this._moveStopHandler);return _2d9;},_getPtIndex:function(){return this.ptIndex+(this._placeholder?1:0);},_getInfo:function(){return {graphic:this.graphic,isGhost:this._placeholder,segmentIndex:this.segIndex,pointIndex:this._getPtIndex()};},_moveStartHandler:function(_2da){var map=this.map;if(map.snappingManager){map.snappingManager._setUpSnapping();}_2da.shape.moveToFront();this.constructor.onMoveStart(this);this.editor.toolbar.onVertexMoveStart(this.relatedGraphic,this._getInfo());},_firstMoveHandler:function(_2db){var _2dc=_2db.shape;var _2dd=this._getControlEdges();var _2de=this._scratchGL._div;var i,_2df=[],_2e0=_2db.host.shape._wrapOffsets[0]||0;for(i=0;i<_2dd.length;i++){var edge=_2dd[i];edge.x1+=_2e0;edge.x2+=_2e0;_2df.push([_2de.createLine({x1:edge.x1,y1:edge.y1,x2:edge.x2,y2:edge.y2}).setStroke(this.editor._lineStroke),edge.x1,edge.y1,edge.x2,edge.y2]);}_2dc._lines=_2df;_2db.shape.moveToFront();this.constructor.onFirstMove(this);this.editor.toolbar.onVertexFirstMove(this.relatedGraphic,this._getInfo());},_movingHandler:function(_2e1){var _2e2=_2e1.shape,tx=_2e2.getTransform();var i,_2e3=_2e2._lines;for(i=0;i<_2e3.length;i++){var line=_2e3[i];line[0].setShape({x1:line[1]+tx.dx,y1:line[2]+tx.dy,x2:line[3],y2:line[4]});}this.editor.toolbar.onVertexMove(this.relatedGraphic,this._getInfo(),tx);},_moveStopHandler:function(_2e4){var _2e5=_2e4.shape,tx=_2e5.getTransform(),map=this.map;var host=this.graphic;var i,_2e6=_2e5._lines;if(_2e6){for(i=0;i<_2e6.length;i++){_2e6[i][0].removeShape();}_2e5._lines=null;}var ph=false,_2e7=true,info=this._getInfo();if(tx&&(tx.dx||tx.dy)){if(this._placeholder){this._placeholder=false;ph=true;}}else{_2e7=false;}var _2e8;if(this.map.snappingManager){_2e8=this.map.snappingManager._snappingPoint;}var _2e9=_2e8||map.toMap(map.toScreen(host.geometry).offset(tx.dx,tx.dy));if(this.map.snappingManager){this.map.snappingManager._killOffSnapping();}_2e5.setTransform(null);host.setGeometry(_2e9);this.constructor.onMoveStop(this,tx);this.editor.toolbar.onVertexMoveStop(this.relatedGraphic,info,tx);if(!_2e7){this.editor.toolbar.onVertexClick(this.relatedGraphic,info);}if(ph){this.editor.toolbar.onVertexAdd(this.relatedGraphic,this._getInfo());}},_getControlEdges:function(){var map=this.map;var _2ea=this.relatedGraphic.geometry;var _2eb=this.segIndex,_2ec=this.ptIndex,_2ed=this.segLength;var _2ee=this._scratchGL._div;var _2ef=_2ee.getTransform();var sdx=_2ef.dx,sdy=_2ef.dy;var pt=map.toScreen(this.graphic.geometry);var x=pt.x-sdx,y=pt.y-sdy;var _2f0=[];var _2f1=this.editor._getControlPoints(this,_2ea,_2eb,_2ec,_2ed);if(_2f1[0]){_2f0.push({x1:x,y1:y,x2:_2f1[0].x-sdx,y2:_2f1[0].y-sdy});}if(_2f1[1]){_2f0.push({x1:x,y1:y,x2:_2f1[1].x-sdx,y2:_2f1[1].y-sdy});}return _2f0;}});dojo.mixin(esri.toolbars.VertexMover,{onMoveStart:function(){},onFirstMove:function(){},onMoveStop:function(){}});}if(!dojo._hasResource["esri.toolbars._VertexEditor"]){dojo._hasResource["esri.toolbars._VertexEditor"]=true;dojo.provide("esri.toolbars._VertexEditor");dojo.declare("esri.toolbars._GraphicVertexEditor",null,{constructor:function(_2f2,map,_2f3){this.graphic=_2f2;this.map=map;this.toolbar=_2f3;var _2f4=_2f3._options;this._symbol1=_2f4.vertexSymbol;this._symbol2=_2f4.ghostVertexSymbol;var _2f5=_2f4.ghostLineSymbol;this._lineStroke={style:_2f5.style,width:_2f5.width,color:_2f5.color};this._canDel=_2f4.allowDeleteVertices;this._canAdd=_2f4.allowAddVertices;this._addControllers();},destroy:function(){this._removeControllers();},refresh:function(_2f6){if(_2f6){this._removeControllers();this._addControllers();}else{this._refresh(this._vertexMovers);this._refresh(this._mpVertexMovers);}},suspend:function(){if(!this._suspended){this._removeControllers();}this._suspended=true;},resume:function(){if(this._suspended){this._addControllers();}this._suspended=false;},_addControllers:function(){this._firstMoveHandle=dojo.connect(esri.toolbars.VertexMover,"onFirstMove",this,this._firstMoveHandler);this._moveStopHandle=dojo.connect(esri.toolbars.VertexMover,"onMoveStop",this,this._moveStopHandler);this._vertexMovers=this._add(this._getSegments(this.graphic.geometry),this._symbol1);if(this._canAdd){this._mpVertexMovers=this._add(this._getMidpointSegments(this.graphic.geometry),this._symbol2,true);}var _2f7=this._getGraphicsLayer();this._mouseOverHandle=dojo.connect(_2f7,"onMouseOver",this,this._mouseOverHandler);this._mouseOutHandle=dojo.connect(_2f7,"onMouseOut",this,this._mouseOutHandler);if(this._canDel){this._ctxMenu=new dijit.Menu({style:"font-size: 12px; margin-left: 5px; margin-top: 5px;"});var _2f8=(this._ctxDelete=new dijit.MenuItem({label:esri.bundle.toolbars.edit.deleteLabel,iconClass:"vertexDeleteIcon",style:"outline: none;"}));this._deleteHandle=dojo.connect(_2f8,"onClick",this,this._deleteHandler);this._ctxMenu.addChild(_2f8);this._ctxMenu.startup();}},_removeControllers:function(){dojo.disconnect(this._firstMoveHandle);dojo.disconnect(this._moveStopHandle);dojo.disconnect(this._mouseOverHandle);dojo.disconnect(this._mouseOutHandle);dojo.disconnect(this._deleteHandle);if(this._ctxMenu){this._ctxDelete=null;this._unbindCtxNode();this._ctxMenu.destroyRecursive();}this._remove(this._vertexMovers);this._remove(this._mpVertexMovers);this._vertexMovers=this._mpVertexMovers=null;},_add:function(_2f9,_2fa,_2fb){var i,j,_2fc=this.graphic,_2fd=[];for(i=0;i<_2f9.length;i++){var _2fe=_2f9[i],_2ff=[];for(j=0;j<_2fe.length;j++){_2ff.push(new esri.toolbars.VertexMover(_2fe[j],_2fa,_2fc,i,j,_2fe.length,this,_2fb));}_2fd.push(_2ff);}return _2fd;},_remove:function(_300){if(_300){dojo.forEach(_300,function(_301){dojo.forEach(_301,function(_302){_302.destroy();});});}},_refresh:function(_303){if(_303){dojo.forEach(_303,function(_304){dojo.forEach(_304,function(_305){_305.refresh();});});}},_isNew:function(_306){return (dojo.indexOf(this._vertexMovers[_306.segIndex],_306)===-1)?true:false;},_getGraphicsLayer:function(){return this.toolbar._scratchGL;},_deleteHandler:function(evt){var _307=this._selectedMover,_308=_307.ptIndex;this._updateRelatedGraphic(_307,_307.relatedGraphic,_307.graphic.geometry,_307.segIndex,_307.ptIndex,_307.segLength,false,true);if(this._canAdd){this._deleteMidpoints(_307);}this._deleteVertex(_307);this.toolbar._endOperation("VERTICES");},_mouseOverHandler:function(evt){var _309=evt.graphic,_30a=this._findMover(_309);if(_30a){this.toolbar.onVertexMouseOver(this.graphic,_30a._getInfo());if(!_30a._placeholder){this._selectedMover=_30a;if(this._canDel){this._bindCtxNode(_309.getDojoShape().getNode());}}}},_mouseOutHandler:function(evt){var _30b=evt.graphic,_30c=this._findMover(_30b);if(_30c){this.toolbar.onVertexMouseOut(this.graphic,_30c._getInfo());}},_bindCtxNode:function(node){this._unbindCtxNode();this._ctxDelete.set("disabled",(this._selectedMover.segLength<=this.minLength)?true:false);this._ctxMenu.bindDomNode(node);this._bindNode=node;},_unbindCtxNode:function(){var node=this._bindNode;if(node){this._ctxMenu.unBindDomNode(node);}},_findMover:function(_30d){var i,_30e=[],_30f=this._mpVertexMovers;dojo.forEach(this._vertexMovers,function(_310){_30e=_30e.concat(_310);});if(_30f){dojo.forEach(_30f,function(_311){_30e=_30e.concat(_311);});}for(i=0;i<_30e.length;i++){var _312=_30e[i];if(_312.graphic===_30d){return _312;}}},_firstMoveHandler:function(_313){if(!this._isNew(_313)&&this._canAdd){this._hideRelatedMidpoints(_313);}this.toolbar._beginOperation("VERTICES");},_moveStopHandler:function(_314,tx){var add=this._isNew(_314);if(!tx||!tx.dx&&!tx.dy){if(!add&&this._canAdd){this._showRelatedMidpoints(_314);}return;}this._updateRelatedGraphic(_314,_314.relatedGraphic,_314.graphic.geometry,_314.segIndex,_314.ptIndex,_314.segLength,add);if(this._canAdd){if(add){this._addMidpoints(_314);}else{this._repositionRelatedMidpoints(_314);this._showRelatedMidpoints(_314);}}this.toolbar._endOperation("VERTICES");},_showRelatedMidpoints:function(_315){var i,_316=this._getAdjacentMidpoints(_315.ptIndex,_315.segLength),_317=this._mpVertexMovers[_315.segIndex];for(i=0;i<_316.length;i++){var mvr=_317[_316[i]];mvr.graphic.show();mvr.refresh();}},_hideRelatedMidpoints:function(_318){var i,_319=this._getAdjacentMidpoints(_318.ptIndex,_318.segLength),_31a=this._mpVertexMovers[_318.segIndex];for(i=0;i<_319.length;i++){_31a[_319[i]].graphic.hide();}},_repositionRelatedMidpoints:function(_31b){var i,_31c=this._getAdjacentMidpoints(_31b.ptIndex,_31b.segLength),_31d=this._mpVertexMovers[_31b.segIndex];for(i=0;i<_31c.length;i++){var _31e=this._getAdjacentVertices(_31c[i],_31b.segLength);var _31f=_31b.relatedGraphic.geometry.getPoint(_31b.segIndex,_31e[0]),_320=_31b.relatedGraphic.geometry.getPoint(_31b.segIndex,_31e[1]);var _321=new esri.geometry.Point({x:(_31f.x+_320.x)/2,y:(_31f.y+_320.y)/2,spatialReference:_31f.spatialReference.toJson()});_31d[_31c[i]].graphic.setGeometry(_321);}},_addMidpoints:function(_322){var _323=_322.segIndex,_324=_322.ptIndex,_325=_322.segLength;var _326=_324+1;var i,_327=_325+1;this._mpVertexMovers[_323].splice(_324,1);var _328=this._vertexMovers[_323];for(i=0;i<_326;i++){_328[i].segLength+=1;}for(i=_326;i<_328.length;i++){_328[i].ptIndex+=1;_328[i].segLength+=1;}_322.ptIndex=_326;_322.segLength=_328.length+1;_328.splice(_326,0,_322);_322.graphic.setSymbol(this._symbol1);_328=this._mpVertexMovers[_323];for(i=0;i<_324;i++){_328[i].segLength+=1;}for(i=_324;i<_325-1;i++){_328[i].ptIndex+=1;_328[i].segLength+=1;}var _329=this._getAdjacentVertices(_324,_327);var _32a=this._getAdjacentVertices(_324+1,_327);var _32b,_32c;_32b=_322.relatedGraphic.geometry.getPoint(_322.segIndex,_329[0]);_32c=_322.relatedGraphic.geometry.getPoint(_322.segIndex,_329[1]);var _32d=new esri.geometry.Point({x:(_32b.x+_32c.x)/2,y:(_32b.y+_32c.y)/2,spatialReference:_32b.spatialReference.toJson()});_32b=_322.relatedGraphic.geometry.getPoint(_322.segIndex,_32a[0]);_32c=_322.relatedGraphic.geometry.getPoint(_322.segIndex,_32a[1]);var _32e=new esri.geometry.Point({x:(_32b.x+_32c.x)/2,y:(_32b.y+_32c.y)/2,spatialReference:_32b.spatialReference.toJson()});var mvr1=new esri.toolbars.VertexMover(_32d,this._symbol2,this.graphic,_322.segIndex,_324,_327,this,true);var mvr2=new esri.toolbars.VertexMover(_32e,this._symbol2,this.graphic,_322.segIndex,_324+1,_327,this,true);_328.splice(_324,0,mvr1,mvr2);},_deleteVertex:function(_32f){var i,_330=_32f.segIndex,_331=_32f.ptIndex;var _332=this._vertexMovers[_330];for(i=0;i<_331;i++){_332[i].segLength-=1;}for(i=_331+1;i<_332.length;i++){var mvr=_332[i];mvr.ptIndex-=1;mvr.segLength-=1;}_332.splice(_331,1);var info=_32f._getInfo();_32f.destroy();this.toolbar.onVertexDelete(this.graphic,info);}});dojo.mixin(esri.toolbars._GraphicVertexEditor,{create:function(_333,map,_334){var type=_333.geometry.type;switch(type){case "multipoint":return new esri.toolbars._MultipointVertexEditor(_333,map,_334);break;case "polyline":return new esri.toolbars._PolylineVertexEditor(_333,map,_334);break;case "polygon":return new esri.toolbars._PolygonVertexEditor(_333,map,_334);break;}}});dojo.declare("esri.toolbars._MultipointVertexEditor",esri.toolbars._GraphicVertexEditor,{minLength:1,constructor:function(){this._moveStartHandle=dojo.connect(esri.toolbars.VertexMover,"onMoveStart",this,this._moveStartHandler);dojo.disconnect(this._firstMoveHandle);},destroy:function(){this.inherited(arguments);dojo.disconnect(this._moveStartHandle);},_getSegments:function(_335){var i,_336=_335.points,_337=[],sr=_335.spatialReference;for(i=0;i<_336.length;i++){var _338=_336[i];_337.push(new esri.geometry.Point({x:_338[0],y:_338[1],spatialReference:sr.toJson()}));}return [_337];},_getMidpointSegments:function(_339){return [];},_getControlPoints:function(_33a,_33b,_33c,_33d,_33e){return [];},_getGraphicsLayer:function(){return this.graphic._graphicsLayer;},_mouseOverHandler:function(evt){var _33f=evt.graphic,_340=this._findMover(evt);if(_340){this.toolbar.onVertexMouseOver(_33f,_340._getInfo());this._selectedMover=_340;if(this._canDel){this._bindCtxNode(_340.graphic.getDojoShape().getNode());}}},_mouseOutHandler:function(evt){var _341=evt.graphic,_342=this._findMover(evt);if(_342){this.toolbar.onVertexMouseOut(_341,_342._getInfo());}},_findMover:function(evt){var i,_343=[].concat(this._vertexMovers[0]),_344=evt.target;for(i=0;i<_343.length;i++){var _345=_343[i];if(_345.graphic.getDojoShape().getNode()===_344){return _345;}}},_moveStartHandler:function(_346){var geom=_346.relatedGraphic.geometry,_347=_346.ptIndex;var _348=_346.segLength-1;var _349=geom.points;var _34a=_349.splice(_347,1);_349.push(_34a[0]);var j,_34b=this._vertexMovers[0];for(j=_348;j>_347;j--){_34b[j].ptIndex-=1;}_34a=_34b.splice(_347,1);_34b.push(_34a[0]);_34a[0].ptIndex=_348;},_moveStopHandler:function(_34c){this._updateRelatedGraphic(_34c,_34c.relatedGraphic,_34c.graphic.geometry,_34c.segIndex,_34c.ptIndex,_34c.segLength);this.toolbar._endOperation("VERTICES");},_updateRelatedGraphic:function(_34d,_34e,_34f,_350,_351,_352,add,del){var geom=_34e.geometry;if(del){geom.removePoint(_351);}else{geom.setPoint(_351,_34f);}_34e.setGeometry(geom);},_deleteMidpoints:function(_353){}});dojo.declare("esri.toolbars._PolylineVertexEditor",esri.toolbars._GraphicVertexEditor,{minLength:2,_getSegments:function(_354){var i,j,_355=_354.paths,_356=[];for(i=0;i<_355.length;i++){var path=_355[i],_357=[];for(j=0;j<path.length;j++){_357.push(_354.getPoint(i,j));}_356.push(_357);}return _356;},_getMidpointSegments:function(_358){var i,j,_359=_358.paths,_35a=[],sr=_358.spatialReference;for(i=0;i<_359.length;i++){var path=_359[i],_35b=[];for(j=0;j<path.length-1;j++){var _35c=_358.getPoint(i,j),_35d=_358.getPoint(i,j+1);var midX=(_35c.x+_35d.x)/2,midY=(_35c.y+_35d.y)/2;var _35e=new esri.geometry.Point({x:midX,y:midY,spatialReference:sr.toJson()});_35b.push(_35e);}_35a.push(_35b);}return _35a;},_getControlPoints:function(_35f,_360,_361,_362,_363){var map=this.map,idx1,idx2,pt1,pt2;if(this._isNew(_35f)){idx1=_362;idx2=_362+1;if(idx1>=0){pt1=map.toScreen(_360.getPoint(_361,idx1));}if(idx2<=_363){pt2=map.toScreen(_360.getPoint(_361,idx2));}}else{idx1=_362-1;idx2=_362+1;if(idx1>=0){pt1=map.toScreen(_360.getPoint(_361,idx1));}if(idx2<_363){pt2=map.toScreen(_360.getPoint(_361,idx2));}}return [pt1,pt2];},_getAdjacentMidpoints:function(_364,_365){var _366=[];var idx1=_364-1;if(idx1>=0){_366.push(idx1);}var idx2=_364;if(idx2<_365-1){_366.push(idx2);}return _366;},_getAdjacentVertices:function(_367,_368){return [_367,_367+1];},_deleteMidpoints:function(_369){var _36a=_369.segIndex,_36b=_369.ptIndex,_36c=_369.segLength;var _36d=this._mpVertexMovers[_36a],_36e=_36d.length-1;var _36f=this._getAdjacentMidpoints(_36b,_36c).sort();var i,min=_36f[0];for(i=0;i<min;i++){_36d[i].segLength-=1;}for(i=min+1;i<_36d.length;i++){var mvr=_36d[i];mvr.ptIndex-=1;mvr.segLength-=1;}if(_36f.length===1){_36d.splice(min,1)[0].destroy();}else{var _370=this._getAdjacentVertices(min,_36e);var _371=_369.relatedGraphic.geometry.getPoint(_369.segIndex,_370[0]);var _372=_369.relatedGraphic.geometry.getPoint(_369.segIndex,_370[1]);var _373=new esri.geometry.Point({x:(_371.x+_372.x)/2,y:(_371.y+_372.y)/2,spatialReference:_371.spatialReference.toJson()});var mvr1=new esri.toolbars.VertexMover(_373,this._symbol2,this.graphic,_369.segIndex,min,_36e,this,true);var _374=_36d.splice(min,_36f.length,mvr1);for(i=0;i<_374.length;i++){_374[i].destroy();}}},_updateRelatedGraphic:function(_375,_376,_377,_378,_379,_37a,add,del){var geom=_376.geometry;if(add){geom.insertPoint(_378,_379+1,esri.geometry.fromJson(_377.toJson()));}else{if(del){geom.removePoint(_378,_379);}else{geom.setPoint(_378,_379,esri.geometry.fromJson(_377.toJson()));}}_376.setGeometry(geom);}});dojo.declare("esri.toolbars._PolygonVertexEditor",esri.toolbars._GraphicVertexEditor,{minLength:3,_getSegments:function(_37b){var i,j,_37c=_37b.rings,_37d=[];for(i=0;i<_37c.length;i++){var ring=_37c[i],_37e=[];for(j=0;j<ring.length-1;j++){_37e.push(_37b.getPoint(i,j));}_37d.push(_37e);}return _37d;},_getMidpointSegments:function(_37f){var i,j,_380=_37f.rings,_381=[],sr=_37f.spatialReference;for(i=0;i<_380.length;i++){var ring=_380[i],_382=[];for(j=0;j<ring.length-1;j++){var _383=_37f.getPoint(i,j),_384=_37f.getPoint(i,j+1);var midX=(_383.x+_384.x)/2,midY=(_383.y+_384.y)/2;var _385=new esri.geometry.Point({x:midX,y:midY,spatialReference:sr.toJson()});_382.push(_385);}_381.push(_382);}return _381;},_getControlPoints:function(_386,_387,_388,_389,_38a){var map=this.map,idx1,idx2,pt1,pt2;if(this._isNew(_386)){idx1=_389;idx2=(_389+1)%_38a;}else{idx1=_389-1;idx1=idx1<0?(_38a+idx1)%_38a:idx1;idx2=(_389+1)%_38a;}pt1=map.toScreen(_387.getPoint(_388,idx1));pt2=map.toScreen(_387.getPoint(_388,idx2));return [pt1,pt2];},_getAdjacentMidpoints:function(_38b,_38c){var idx1=_38b-1;idx1=idx1<0?(_38c+idx1)%_38c:idx1;var idx2=_38b;return [idx1,idx2];},_getAdjacentVertices:function(_38d,_38e){return [_38d,(_38d+1)%_38e];},_deleteMidpoints:function(_38f){var _390=_38f.segIndex,_391=_38f.ptIndex,_392=_38f.segLength;var _393=this._mpVertexMovers[_390],_394=_393.length-1,_395=this._getAdjacentMidpoints(_391,_392).sort(),_396,_397,_398,_399,i,mvr1,mvr,min=_395[0],max=_395[_395.length-1];if(_391===0){_396=this._getAdjacentVertices(_394-1,_394);_397=_38f.relatedGraphic.geometry.getPoint(_38f.segIndex,_396[0]);_398=_38f.relatedGraphic.geometry.getPoint(_38f.segIndex,_396[1]);_399=new esri.geometry.Point({x:(_397.x+_398.x)/2,y:(_397.y+_398.y)/2,spatialReference:_397.spatialReference.toJson()});mvr1=new esri.toolbars.VertexMover(_399,this._symbol2,this.graphic,_38f.segIndex,_394-1,_394,this,true);_393.splice(max,1,mvr1)[0].destroy();_393.splice(min,1)[0].destroy();for(i=0;i<_393.length-1;i++){mvr=_393[i];mvr.ptIndex-=1;mvr.segLength-=1;}}else{_396=this._getAdjacentVertices(min,_394);_397=_38f.relatedGraphic.geometry.getPoint(_38f.segIndex,_396[0]);_398=_38f.relatedGraphic.geometry.getPoint(_38f.segIndex,_396[1]);_399=new esri.geometry.Point({x:(_397.x+_398.x)/2,y:(_397.y+_398.y)/2,spatialReference:_397.spatialReference.toJson()});mvr1=new esri.toolbars.VertexMover(_399,this._symbol2,this.graphic,_38f.segIndex,min,_394,this,true);var _39a=_393.splice(min,_395.length,mvr1);for(i=0;i<_39a.length;i++){_39a[i].destroy();}for(i=0;i<min;i++){_393[i].segLength-=1;}for(i=min+1;i<_393.length;i++){mvr=_393[i];mvr.ptIndex-=1;mvr.segLength-=1;}}},_updateRelatedGraphic:function(_39b,_39c,_39d,_39e,_39f,_3a0,add,del){var geom=_39c.geometry;if(add){geom.insertPoint(_39e,_39f+1,esri.geometry.fromJson(_39d.toJson()));}else{if(del){geom.removePoint(_39e,_39f);if(_39f===0){geom.setPoint(_39e,_3a0-1,esri.geometry.fromJson(geom.getPoint(_39e,0).toJson()));}}else{geom.setPoint(_39e,_39f,esri.geometry.fromJson(_39d.toJson()));if(_39f===0){geom.setPoint(_39e,_3a0,esri.geometry.fromJson(_39d.toJson()));}}}_39c.setGeometry(geom);}});}if(!dojo._hasResource["esri.toolbars._Box"]){dojo._hasResource["esri.toolbars._Box"]=true;dojo.provide("esri.toolbars._Box");dojo.declare("esri.toolbars._Box",null,{constructor:function(_3a1,map,_3a2,_3a3,_3a4){this._graphic=_3a1;this._map=map;this._toolbar=_3a2;this._scale=_3a3;this._rotate=_3a4;this._defaultEventArgs={};this._scaleEvent="Scale";this._rotateEvent="Rotate";var _3a5=_3a2._options;this._markerSymbol=_3a5.boxHandleSymbol;this._lineSymbol=_3a5.boxLineSymbol;this._moveStartHandler=dojo.hitch(this,this._moveStartHandler);this._firstMoveHandler=dojo.hitch(this,this._firstMoveHandler);this._moveStopHandler=dojo.hitch(this,this._moveStopHandler);this._moveHandler=dojo.hitch(this,this._moveHandler);this._init();},destroy:function(){this._cleanUp();this._graphic=this._map=this._toolbar=this._markerSymbol=this._lineSymbol=null;},refresh:function(){this._draw();},suspend:function(){dojo.forEach(this._getAllGraphics(),function(g){g.hide();});},resume:function(){dojo.forEach(this._getAllGraphics(),function(g){g.show();});this._draw();},_init:function(){this._draw();},_cleanUp:function(){if(this._connects){dojo.forEach(this._connects,dojo.disconnect,dojo);}var _3a6=this._toolbar._scratchGL;if(this._anchors){dojo.forEach(this._anchors,function(info){_3a6.remove(info.graphic);var mov=info.moveable;if(mov){mov.destroy();}});}if(this._box){_3a6.remove(this._box);}this._box=this._anchors=this._connects=null;},_draw:function(){if(!this._graphic.getDojoShape()){this._cleanUp();return;}var map=this._map,_3a7=this._toolbar._scratchGL;var _3a8=this._getBoxCoords();var _3a9=new esri.geometry.Polyline(map.spatialReference);var path=dojo.clone(dojo.filter(_3a8,function(pt,_3aa){return (_3aa!==8&&_3aa%2===0);}));if(path[0]){path.push([path[0][0],path[0][1]]);}_3a9.addPath(path);if(this._rotate){_3a9.addPath([_3a8[1],_3a8[8]]);}if(this._box){this._box.setGeometry(_3a9);}else{this._box=new esri.Graphic(_3a9,this._lineSymbol);_3a7.add(this._box);}if(this._anchors){dojo.forEach(this._anchors,function(info,_3ab){if(!this._scale){_3ab=8;}var _3ac=new esri.geometry.Point(_3a8[_3ab],map.spatialReference);info.graphic.setGeometry(_3ac);var mov=info.moveable,_3ad=info.graphic.getDojoShape();if(_3ad){if(!mov){info.moveable=this._getMoveable(info.graphic,_3ab);}else{if(_3ad!==mov.shape){mov.destroy();info.moveable=this._getMoveable(info.graphic,_3ab);}}}},this);}else{this._anchors=[];this._connects=[];dojo.forEach(_3a8,function(_3ae,_3af){if(!this._scale&&_3af<8){return;}_3ae=new esri.geometry.Point(_3ae,map.spatialReference);var _3b0=new esri.Graphic(_3ae,this._markerSymbol);_3a7.add(_3b0);this._anchors.push({graphic:_3b0,moveable:this._getMoveable(_3b0,_3af)});},this);}},_getBoxCoords:function(_3b1){var _3b2=this._graphic,map=this._map,bbox=this._getTransformedBoundingBox(_3b2),_3b3=[],pt,next,_3b4;dojo.forEach(bbox,function(_3b5,_3b6,arr){pt=_3b5;next=arr[_3b6+1];if(!next){next=arr[0];}_3b4={x:(pt.x+next.x)/2,y:(pt.y+next.y)/2};if(!_3b1){pt=map.toMap(pt);_3b4=map.toMap(_3b4);}_3b3.push([pt.x,pt.y]);_3b3.push([_3b4.x,_3b4.y]);});if(this._rotate){var _3b7=dojo.clone(_3b3[1]);_3b7=_3b1?{x:_3b7[0],y:_3b7[1]}:map.toScreen({x:_3b7[0],y:_3b7[1]});_3b7.y-=this._toolbar._options.rotateHandleOffset;if(!_3b1){_3b7=map.toMap(_3b7);}_3b3.push([_3b7.x,_3b7.y]);}return _3b3;},_getTransformedBoundingBox:function(_3b8){var map=this._map;var _3b9=_3b8.geometry.getExtent();var _3ba=new esri.geometry.Point(_3b9.xmin,_3b9.ymax);var _3bb=new esri.geometry.Point(_3b9.xmax,_3b9.ymin);_3ba=map.toScreen(_3ba);_3bb=map.toScreen(_3bb);return [{x:_3ba.x,y:_3ba.y},{x:_3bb.x,y:_3ba.y},{x:_3bb.x,y:_3bb.y},{x:_3ba.x,y:_3bb.y}];},_getAllGraphics:function(){var _3bc=[this._box];if(this._anchors){dojo.forEach(this._anchors,function(_3bd){_3bc.push(_3bd.graphic);});}_3bc=dojo.filter(_3bc,esri._isDefined);return _3bc;},_getMoveable:function(_3be,_3bf){var _3c0=_3be.getDojoShape();if(!_3c0){return;}var _3c1=new dojox.gfx.Moveable(_3c0);_3c1._index=_3bf;this._connects.push(dojo.connect(_3c1,"onMoveStart",this._moveStartHandler));this._connects.push(dojo.connect(_3c1,"onFirstMove",this._firstMoveHandler));this._connects.push(dojo.connect(_3c1,"onMoveStop",this._moveStopHandler));_3c1.onMove=this._moveHandler;var node=_3c0.getEventSource();if(node){dojo.style(node,"cursor",this._toolbar._cursors["box"+_3bf]);}return _3c1;},_moveStartHandler:function(_3c2){this._toolbar["on"+(_3c2.host._index===8?this._rotateEvent:this._scaleEvent)+"Start"](this._graphic);},_firstMoveHandler:function(_3c3){var _3c4=_3c3.host._index,_3c5=(this._wrapOffset=_3c3.host.shape._wrapOffsets[0]||0),_3c6=this._graphic.getLayer()._div.getTransform(),mx=dojox.gfx.matrix,_3c7,_3c8,_3c9,_3ca=dojo.map(this._getBoxCoords(true),function(arr){return {x:arr[0]+_3c5,y:arr[1]};});if(_3c4===8){_3c7=mx.multiplyPoint(mx.invert(_3c6),_3ca[1]);_3c9={x:_3ca[1].x,y:_3ca[3].y};_3c8=mx.multiplyPoint(mx.invert(_3c6),_3c9);this._startLine=[_3c8,_3c7];this._moveLine=dojo.clone(this._startLine);}else{_3c7=mx.multiplyPoint(mx.invert(_3c6),_3ca[_3c4]);_3c8=mx.multiplyPoint(mx.invert(_3c6),_3ca[(_3c4+4)%8]);this._startBox=_3c8;this._startBox.width=(_3ca[4].x-_3ca[0].x);this._startBox.height=(_3ca[4].y-_3ca[0].y);this._moveBox=dojo.clone(this._startBox);this._xfactor=_3c7.x>_3c8.x?1:-1;this._yfactor=_3c7.y>_3c8.y?1:-1;if(_3c4===1||_3c4===5){this._xfactor=0;}else{if(_3c4===3||_3c4===7){this._yfactor=0;}}}this._toolbar._beginOperation("BOX");this._toolbar["on"+(_3c4===8?this._rotateEvent:this._scaleEvent)+"FirstMove"](this._graphic);},_moveHandler:function(_3cb,_3cc){var _3cd=_3cb.host._index,args=this._defaultEventArgs,_3ce,move,tx,pt,_3cf,_3d0,_3d1;args.angle=0;args.scaleX=1;args.scaleY=1;if(_3cd===8){_3ce=this._startLine;move=this._moveLine;pt=move[1];pt.x+=_3cc.dx;pt.y+=_3cc.dy;_3cf=this._getAngle(_3ce,move);tx=dojox.gfx.matrix.rotategAt(_3cf,_3ce[0]);this._graphic.getDojoShape().setTransform(tx);args.transform=tx;args.angle=_3cf;args.around=_3ce[0];}else{_3ce=this._startBox;move=this._moveBox;move.width+=(_3cc.dx*this._xfactor);move.height+=(_3cc.dy*this._yfactor);_3d0=move.width/_3ce.width;_3d1=move.height/_3ce.height;if(isNaN(_3d0)||_3d0===Infinity||_3d0===-Infinity){_3d0=1;}if(isNaN(_3d1)||_3d1===Infinity||_3d1===-Infinity){_3d1=1;}tx=dojox.gfx.matrix.scaleAt(_3d0,_3d1,_3ce);this._graphic.getDojoShape().setTransform(tx);args.transform=tx;args.scaleX=_3d0;args.scaleY=_3d1;args.around=_3ce;}this._toolbar["on"+(_3cd===8?this._rotateEvent:this._scaleEvent)](this._graphic,args);},_moveStopHandler:function(_3d2){var _3d3=this._graphic,_3d4=_3d3.geometry.toJson(),_3d5=_3d3.getDojoShape(),_3d6=_3d5.getTransform(),_3d7=_3d3.getLayer()._div.getTransform();this._updateSegments(_3d4.paths||_3d4.rings,_3d6,_3d7);_3d5.setTransform(null);_3d3.setGeometry(esri.geometry.fromJson(_3d4));this._draw();this._startBox=this._moveBox=this._xfactor=this._yfactor=null;this._startLine=this._moveLine=null;this._toolbar._endOperation("BOX");this._defaultEventArgs.transform=_3d6;this._toolbar["on"+(_3d2.host._index===8?this._rotateEvent:this._scaleEvent)+"Stop"](this._graphic,this._defaultEventArgs);},_updateSegments:function(_3d8,_3d9,_3da){var mx=dojox.gfx.matrix,map=this._map,_3db=this._wrapOffset||0;dojo.forEach(_3d8,function(_3dc){dojo.forEach(_3dc,function(_3dd){var _3de=map.toScreen({x:_3dd[0],y:_3dd[1]},true);_3de.x+=_3db;_3de=mx.multiplyPoint([_3da,_3d9,mx.invert(_3da)],_3de);_3de.x-=_3db;var _3df=map.toMap(_3de);_3dd[0]=_3df.x;_3dd[1]=_3df.y;});});},_getAngle:function(_3e0,_3e1){var _3e2=Math.atan2(_3e0[0].y-_3e0[1].y,_3e0[0].x-_3e0[1].x)*180/Math.PI,_3e3=Math.atan2(_3e1[0].y-_3e1[1].y,_3e1[0].x-_3e1[1].x)*180/Math.PI;return _3e3-_3e2;}});}if(!dojo._hasResource["esri.toolbars.edit"]){dojo._hasResource["esri.toolbars.edit"]=true;dojo.provide("esri.toolbars.edit");(function(){var link=document.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=dojo.moduleUrl("esri","toolbars/css/edit.css").toString();document.getElementsByTagName("head").item(0).appendChild(link);}());dojo.declare("esri.toolbars.Edit",esri.toolbars._Toolbar,{constructor:function(map,_3e4){this._map=map;this._tool=0;this._scratchGL=map.graphics;var _3e5=esri.isTouchEnabled;this._defaultOptions=dojo.mixin({vertexSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,_3e5?20:12,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([0,0,0,0.5]),1),new dojo.Color([128,128,128])),ghostVertexSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,_3e5?18:10,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([0,0,0,0.5]),1),new dojo.Color([255,255,255,0.75])),ghostLineSymbol:new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT,new dojo.Color([128,128,128]),2),allowDeleteVertices:true,allowAddVertices:true,rotateHandleOffset:_3e5?24:16,boxLineSymbol:new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH,new dojo.Color([64,64,64]),1),boxHandleSymbol:new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE,_3e5?16:9,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([0,0,0,0.5]),1),new dojo.Color([255,255,255,0.75]))},_3e4||{});},activate:function(tool,_3e6,_3e7){this.deactivate();this._graphic=_3e6;this._options=dojo.mixin(dojo.mixin({},this._defaultOptions),_3e7||{});var MOVE=esri.toolbars.Edit.MOVE,EDIT=esri.toolbars.Edit.EDIT_VERTICES;var _3e8=esri.toolbars.Edit.SCALE,_3e9=esri.toolbars.Edit.ROTATE;var move=false,edit=false,box=false;if((tool&MOVE)===MOVE){move=this._enableMove(_3e6);}var _3ea=((tool&_3e8)===_3e8),_3eb=((tool&_3e9)===_3e9);if(_3ea||_3eb){box=this._enableBoxEditing(_3e6,_3ea,_3eb);}if((tool&EDIT)===EDIT){edit=this._enableVertexEditing(_3e6);}if(!(move||edit||box)){throw new Error("[esri.toolbars.Edit::activate] "+esri.bundle.toolbars.edit.invalidType);}this._tool=tool;var map=this._map;if(this._tool){this._mapPanEndHandle=dojo.connect(map,"onPanEnd",this,this._mapPanEndHandler);this._mapExtChgHandle=dojo.connect(map,"onExtentChange",this,this._mapExtentChangeHandler);this.onActivate(this._tool,_3e6);}if(map.snappingManager&&(move||edit)){map.snappingManager._startSelectionLayerQuery();}},deactivate:function(){var tool=this._tool,_3ec=this._graphic;if(!tool){return;}var _3ed=!!this._modified;this._clear();dojo.disconnect(this._mapPanEndHandle);dojo.disconnect(this._mapExtChgHandle);this._graphic=null;this.onDeactivate(tool,_3ec,{isModified:_3ed});if(this._map.snappingManager){this._map.snappingManager._stopSelectionLayerQuery();}},refresh:function(){this._refreshMoveables(true);},getCurrentState:function(){return {tool:this._tool,graphic:this._graphic,isModified:!!this._modified};},onActivate:function(tool,_3ee){},onDeactivate:function(tool,_3ef,info){},onGraphicMoveStart:function(_3f0){},onGraphicFirstMove:function(_3f1){this._modified=true;},onGraphicMove:function(_3f2,_3f3){},onGraphicMoveStop:function(_3f4,_3f5){},onGraphicClick:function(_3f6,info){},onVertexMoveStart:function(_3f7,_3f8){},onVertexFirstMove:function(_3f9,_3fa){this._modified=true;},onVertexMove:function(_3fb,_3fc,_3fd){},onVertexMoveStop:function(_3fe,_3ff,_400){},onVertexAdd:function(_401,_402){this._modified=true;},onVertexClick:function(_403,_404){},onVertexMouseOver:function(_405,_406){},onVertexMouseOut:function(_407,_408){},onVertexDelete:function(_409,_40a){this._modified=true;},onScaleStart:function(_40b){},onScaleFirstMove:function(_40c){this._modified=true;},onScale:function(_40d,info){},onScaleStop:function(_40e,info){},onRotateStart:function(_40f){},onRotateFirstMove:function(_410){this._modified=true;},onRotate:function(_411,info){},onRotateStop:function(_412,info){},_enableMove:function(_413){var map=this._map,type=_413.geometry.type;switch(type){case "point":case "polyline":case "polygon":this._graphicMover=new esri.toolbars._GraphicMover(_413,map,this);return true;case "multipoint":break;}return false;},_enableVertexEditing:function(_414){var map=this._map,type=_414.geometry.type;switch(type){case "point":break;case "multipoint":case "polyline":case "polygon":this._vertexEditor=esri.toolbars._GraphicVertexEditor.create(_414,map,this);return true;}return false;},_enableBoxEditing:function(_415,_416,_417){var map=this._map,type=_415.geometry.type;switch(type){case "point":case "multipoint":break;case "polyline":case "polygon":this._boxEditor=new esri.toolbars._Box(_415,map,this,_416,_417);return true;}return false;},_disableMove:function(){var _418=this._graphicMover;if(_418){_418.destroy();this._graphicMover=null;}},_disableVertexEditing:function(){var _419=this._vertexEditor;if(_419){_419.destroy();this._vertexEditor=null;}},_disableBoxEditing:function(){var box=this._boxEditor;if(box){box.destroy();this._boxEditor=null;}},_clear:function(){this._disableMove();this._disableVertexEditing();this._disableBoxEditing();this._tool=0;this._modified=false;},_mapPanEndHandler:function(){this._refreshMoveables();},_mapExtentChangeHandler:function(e,d,_41a){if(_41a){this._refreshMoveables();}},_refreshMoveables:function(_41b){var _41c=dojo.filter([this._graphicMover,this._vertexEditor,this._boxEditor],esri._isDefined);dojo.forEach(_41c,function(mov){mov.refresh(_41b);});},_beginOperation:function(_41d){dojo.forEach(this._getAffectedTools(_41d),function(tool){tool.suspend();});},_endOperation:function(_41e){dojo.forEach(this._getAffectedTools(_41e),function(tool){tool.resume();});},_getAffectedTools:function(_41f){var _420=[];switch(_41f){case "MOVE":_420=[this._vertexEditor,this._boxEditor];break;case "VERTICES":_420=[this._boxEditor];break;case "BOX":_420=[this._vertexEditor];break;}_420=dojo.filter(_420,esri._isDefined);return _420;}});dojo.mixin(esri.toolbars.Edit,{MOVE:1,EDIT_VERTICES:2,SCALE:4,ROTATE:8});}if(!dojo._hasResource["dojo.data.util.filter"]){dojo._hasResource["dojo.data.util.filter"]=true;dojo.provide("dojo.data.util.filter");dojo.getObject("data.util.filter",true,dojo);dojo.data.util.filter.patternToRegExp=function(_421,_422){var rxp="^";var c=null;for(var i=0;i<_421.length;i++){c=_421.charAt(i);switch(c){case "\\":rxp+=c;i++;rxp+=_421.charAt(i);break;case "*":rxp+=".*";break;case "?":rxp+=".";break;case "$":case "^":case "/":case "+":case ".":case "|":case "(":case ")":case "{":case "}":case "[":case "]":rxp+="\\";default:rxp+=c;}}rxp+="$";if(_422){return new RegExp(rxp,"mi");}else{return new RegExp(rxp,"m");}};}if(!dojo._hasResource["dojo.data.util.sorter"]){dojo._hasResource["dojo.data.util.sorter"]=true;dojo.provide("dojo.data.util.sorter");dojo.getObject("data.util.sorter",true,dojo);dojo.data.util.sorter.basicComparator=function(a,b){var r=-1;if(a===null){a=undefined;}if(b===null){b=undefined;}if(a==b){r=0;}else{if(a>b||a==null){r=1;}}return r;};dojo.data.util.sorter.createSortFunction=function(_423,_424){var _425=[];function _426(attr,dir,comp,s){return function(_427,_428){var a=s.getValue(_427,attr);var b=s.getValue(_428,attr);return dir*comp(a,b);};};var _429;var map=_424.comparatorMap;var bc=dojo.data.util.sorter.basicComparator;for(var i=0;i<_423.length;i++){_429=_423[i];var attr=_429.attribute;if(attr){var dir=(_429.descending)?-1:1;var comp=bc;if(map){if(typeof attr!=="string"&&("toString" in attr)){attr=attr.toString();}comp=map[attr]||bc;}_425.push(_426(attr,dir,comp,_424));}}return function(rowA,rowB){var i=0;while(i<_425.length){var ret=_425[i++](rowA,rowB);if(ret!==0){return ret;}}return 0;};};}if(!dojo._hasResource["dojo.data.util.simpleFetch"]){dojo._hasResource["dojo.data.util.simpleFetch"]=true;dojo.provide("dojo.data.util.simpleFetch");dojo.getObject("data.util.simpleFetch",true,dojo);dojo.data.util.simpleFetch.fetch=function(_42a){_42a=_42a||{};if(!_42a.store){_42a.store=this;}var self=this;var _42b=function(_42c,_42d){if(_42d.onError){var _42e=_42d.scope||dojo.global;_42d.onError.call(_42e,_42c,_42d);}};var _42f=function(_430,_431){var _432=_431.abort||null;var _433=false;var _434=_431.start?_431.start:0;var _435=(_431.count&&(_431.count!==Infinity))?(_434+_431.count):_430.length;_431.abort=function(){_433=true;if(_432){_432.call(_431);}};var _436=_431.scope||dojo.global;if(!_431.store){_431.store=self;}if(_431.onBegin){_431.onBegin.call(_436,_430.length,_431);}if(_431.sort){_430.sort(dojo.data.util.sorter.createSortFunction(_431.sort,self));}if(_431.onItem){for(var i=_434;(i<_430.length)&&(i<_435);++i){var item=_430[i];if(!_433){_431.onItem.call(_436,item,_431);}}}if(_431.onComplete&&!_433){var _437=null;if(!_431.onItem){_437=_430.slice(_434,_435);}_431.onComplete.call(_436,_437,_431);}};this._fetchItems(_42a,_42f,_42b);return _42a;};}if(!dojo._hasResource["dojo.data.ItemFileReadStore"]){dojo._hasResource["dojo.data.ItemFileReadStore"]=true;dojo.provide("dojo.data.ItemFileReadStore");dojo.declare("dojo.data.ItemFileReadStore",null,{constructor:function(_438){this._arrayOfAllItems=[];this._arrayOfTopLevelItems=[];this._loadFinished=false;this._jsonFileUrl=_438.url;this._ccUrl=_438.url;this.url=_438.url;this._jsonData=_438.data;this.data=null;this._datatypeMap=_438.typeMap||{};if(!this._datatypeMap["Date"]){this._datatypeMap["Date"]={type:Date,deserialize:function(_439){return dojo.date.stamp.fromISOString(_439);}};}this._features={"dojo.data.api.Read":true,"dojo.data.api.Identity":true};this._itemsByIdentity=null;this._storeRefPropName="_S";this._itemNumPropName="_0";this._rootItemPropName="_RI";this._reverseRefMap="_RRM";this._loadInProgress=false;this._queuedFetches=[];if(_438.urlPreventCache!==undefined){this.urlPreventCache=_438.urlPreventCache?true:false;}if(_438.hierarchical!==undefined){this.hierarchical=_438.hierarchical?true:false;}if(_438.clearOnClose){this.clearOnClose=true;}if("failOk" in _438){this.failOk=_438.failOk?true:false;}},url:"",_ccUrl:"",data:null,typeMap:null,clearOnClose:false,urlPreventCache:false,failOk:false,hierarchical:true,_assertIsItem:function(item){if(!this.isItem(item)){throw new Error("dojo.data.ItemFileReadStore: Invalid item argument.");}},_assertIsAttribute:function(_43a){if(typeof _43a!=="string"){throw new Error("dojo.data.ItemFileReadStore: Invalid attribute argument.");}},getValue:function(item,_43b,_43c){var _43d=this.getValues(item,_43b);return (_43d.length>0)?_43d[0]:_43c;},getValues:function(item,_43e){this._assertIsItem(item);this._assertIsAttribute(_43e);return (item[_43e]||[]).slice(0);},getAttributes:function(item){this._assertIsItem(item);var _43f=[];for(var key in item){if((key!==this._storeRefPropName)&&(key!==this._itemNumPropName)&&(key!==this._rootItemPropName)&&(key!==this._reverseRefMap)){_43f.push(key);}}return _43f;},hasAttribute:function(item,_440){this._assertIsItem(item);this._assertIsAttribute(_440);return (_440 in item);},containsValue:function(item,_441,_442){var _443=undefined;if(typeof _442==="string"){_443=dojo.data.util.filter.patternToRegExp(_442,false);}return this._containsValue(item,_441,_442,_443);},_containsValue:function(item,_444,_445,_446){return dojo.some(this.getValues(item,_444),function(_447){if(_447!==null&&!dojo.isObject(_447)&&_446){if(_447.toString().match(_446)){return true;}}else{if(_445===_447){return true;}}});},isItem:function(_448){if(_448&&_448[this._storeRefPropName]===this){if(this._arrayOfAllItems[_448[this._itemNumPropName]]===_448){return true;}}return false;},isItemLoaded:function(_449){return this.isItem(_449);},loadItem:function(_44a){this._assertIsItem(_44a.item);},getFeatures:function(){return this._features;},getLabel:function(item){if(this._labelAttr&&this.isItem(item)){return this.getValue(item,this._labelAttr);}return undefined;},getLabelAttributes:function(item){if(this._labelAttr){return [this._labelAttr];}return null;},_fetchItems:function(_44b,_44c,_44d){var self=this,_44e=function(_44f,_450){var _451=[],i,key;if(_44f.query){var _452,_453=_44f.queryOptions?_44f.queryOptions.ignoreCase:false;var _454={};for(key in _44f.query){_452=_44f.query[key];if(typeof _452==="string"){_454[key]=dojo.data.util.filter.patternToRegExp(_452,_453);}else{if(_452 instanceof RegExp){_454[key]=_452;}}}for(i=0;i<_450.length;++i){var _455=true;var _456=_450[i];if(_456===null){_455=false;}else{for(key in _44f.query){_452=_44f.query[key];if(!self._containsValue(_456,key,_452,_454[key])){_455=false;}}}if(_455){_451.push(_456);}}_44c(_451,_44f);}else{for(i=0;i<_450.length;++i){var item=_450[i];if(item!==null){_451.push(item);}}_44c(_451,_44f);}};if(this._loadFinished){_44e(_44b,this._getItemsArray(_44b.queryOptions));}else{if(this._jsonFileUrl!==this._ccUrl){dojo.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl.  _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null){this._jsonData=this.data;this.data=null;}if(this._jsonFileUrl){if(this._loadInProgress){this._queuedFetches.push({args:_44b,filter:_44e});}else{this._loadInProgress=true;var _457={url:self._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk};var _458=dojo.xhrGet(_457);_458.addCallback(function(data){try{self._getItemsFromLoadedData(data);self._loadFinished=true;self._loadInProgress=false;_44e(_44b,self._getItemsArray(_44b.queryOptions));self._handleQueuedFetches();}catch(e){self._loadFinished=true;self._loadInProgress=false;_44d(e,_44b);}});_458.addErrback(function(_459){self._loadInProgress=false;_44d(_459,_44b);});var _45a=null;if(_44b.abort){_45a=_44b.abort;}_44b.abort=function(){var df=_458;if(df&&df.fired===-1){df.cancel();df=null;}if(_45a){_45a.call(_44b);}};}}else{if(this._jsonData){try{this._loadFinished=true;this._getItemsFromLoadedData(this._jsonData);this._jsonData=null;_44e(_44b,this._getItemsArray(_44b.queryOptions));}catch(e){_44d(e,_44b);}}else{_44d(new Error("dojo.data.ItemFileReadStore: No JSON source data was provided as either URL or a nested Javascript object."),_44b);}}}},_handleQueuedFetches:function(){if(this._queuedFetches.length>0){for(var i=0;i<this._queuedFetches.length;i++){var _45b=this._queuedFetches[i],_45c=_45b.args,_45d=_45b.filter;if(_45d){_45d(_45c,this._getItemsArray(_45c.queryOptions));}else{this.fetchItemByIdentity(_45c);}}this._queuedFetches=[];}},_getItemsArray:function(_45e){if(_45e&&_45e.deep){return this._arrayOfAllItems;}return this._arrayOfTopLevelItems;},close:function(_45f){if(this.clearOnClose&&this._loadFinished&&!this._loadInProgress){if(((this._jsonFileUrl==""||this._jsonFileUrl==null)&&(this.url==""||this.url==null))&&this.data==null){console.debug("dojo.data.ItemFileReadStore: WARNING!  Data reload "+" information has not been provided."+"  Please set 'url' or 'data' to the appropriate value before"+" the next fetch");}this._arrayOfAllItems=[];this._arrayOfTopLevelItems=[];this._loadFinished=false;this._itemsByIdentity=null;this._loadInProgress=false;this._queuedFetches=[];}},_getItemsFromLoadedData:function(_460){var _461=false,self=this;function _462(_463){var _464=((_463!==null)&&(typeof _463==="object")&&(!dojo.isArray(_463)||_461)&&(!dojo.isFunction(_463))&&(_463.constructor==Object||dojo.isArray(_463))&&(typeof _463._reference==="undefined")&&(typeof _463._type==="undefined")&&(typeof _463._value==="undefined")&&self.hierarchical);return _464;};function _465(_466){self._arrayOfAllItems.push(_466);for(var _467 in _466){var _468=_466[_467];if(_468){if(dojo.isArray(_468)){var _469=_468;for(var k=0;k<_469.length;++k){var _46a=_469[k];if(_462(_46a)){_465(_46a);}}}else{if(_462(_468)){_465(_468);}}}}};this._labelAttr=_460.label;var i,item;this._arrayOfAllItems=[];this._arrayOfTopLevelItems=_460.items;for(i=0;i<this._arrayOfTopLevelItems.length;++i){item=this._arrayOfTopLevelItems[i];if(dojo.isArray(item)){_461=true;}_465(item);item[this._rootItemPropName]=true;}var _46b={},key;for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];for(key in item){if(key!==this._rootItemPropName){var _46c=item[key];if(_46c!==null){if(!dojo.isArray(_46c)){item[key]=[_46c];}}else{item[key]=[null];}}_46b[key]=key;}}while(_46b[this._storeRefPropName]){this._storeRefPropName+="_";}while(_46b[this._itemNumPropName]){this._itemNumPropName+="_";}while(_46b[this._reverseRefMap]){this._reverseRefMap+="_";}var _46d;var _46e=_460.identifier;if(_46e){this._itemsByIdentity={};this._features["dojo.data.api.Identity"]=_46e;for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];_46d=item[_46e];var _46f=_46d[0];if(!Object.hasOwnProperty.call(this._itemsByIdentity,_46f)){this._itemsByIdentity[_46f]=item;}else{if(this._jsonFileUrl){throw new Error("dojo.data.ItemFileReadStore:  The json data as specified by: ["+this._jsonFileUrl+"] is malformed.  Items within the list have identifier: ["+_46e+"].  Value collided: ["+_46f+"]");}else{if(this._jsonData){throw new Error("dojo.data.ItemFileReadStore:  The json data provided by the creation arguments is malformed.  Items within the list have identifier: ["+_46e+"].  Value collided: ["+_46f+"]");}}}}}else{this._features["dojo.data.api.Identity"]=Number;}for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];item[this._storeRefPropName]=this;item[this._itemNumPropName]=i;}for(i=0;i<this._arrayOfAllItems.length;++i){item=this._arrayOfAllItems[i];for(key in item){_46d=item[key];for(var j=0;j<_46d.length;++j){_46c=_46d[j];if(_46c!==null&&typeof _46c=="object"){if(("_type" in _46c)&&("_value" in _46c)){var type=_46c._type;var _470=this._datatypeMap[type];if(!_470){throw new Error("dojo.data.ItemFileReadStore: in the typeMap constructor arg, no object class was specified for the datatype '"+type+"'");}else{if(dojo.isFunction(_470)){_46d[j]=new _470(_46c._value);}else{if(dojo.isFunction(_470.deserialize)){_46d[j]=_470.deserialize(_46c._value);}else{throw new Error("dojo.data.ItemFileReadStore: Value provided in typeMap was neither a constructor, nor a an object with a deserialize function");}}}}if(_46c._reference){var _471=_46c._reference;if(!dojo.isObject(_471)){_46d[j]=this._getItemByIdentity(_471);}else{for(var k=0;k<this._arrayOfAllItems.length;++k){var _472=this._arrayOfAllItems[k],_473=true;for(var _474 in _471){if(_472[_474]!=_471[_474]){_473=false;}}if(_473){_46d[j]=_472;}}}if(this.referenceIntegrity){var _475=_46d[j];if(this.isItem(_475)){this._addReferenceToMap(_475,item,key);}}}else{if(this.isItem(_46c)){if(this.referenceIntegrity){this._addReferenceToMap(_46c,item,key);}}}}}}}},_addReferenceToMap:function(_476,_477,_478){},getIdentity:function(item){var _479=this._features["dojo.data.api.Identity"];if(_479===Number){return item[this._itemNumPropName];}else{var _47a=item[_479];if(_47a){return _47a[0];}}return null;},fetchItemByIdentity:function(_47b){var item,_47c;if(!this._loadFinished){var self=this;if(this._jsonFileUrl!==this._ccUrl){dojo.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl.  _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null&&this._jsonData==null){this._jsonData=this.data;this.data=null;}if(this._jsonFileUrl){if(this._loadInProgress){this._queuedFetches.push({args:_47b});}else{this._loadInProgress=true;var _47d={url:self._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk};var _47e=dojo.xhrGet(_47d);_47e.addCallback(function(data){var _47f=_47b.scope?_47b.scope:dojo.global;try{self._getItemsFromLoadedData(data);self._loadFinished=true;self._loadInProgress=false;item=self._getItemByIdentity(_47b.identity);if(_47b.onItem){_47b.onItem.call(_47f,item);}self._handleQueuedFetches();}catch(error){self._loadInProgress=false;if(_47b.onError){_47b.onError.call(_47f,error);}}});_47e.addErrback(function(_480){self._loadInProgress=false;if(_47b.onError){var _481=_47b.scope?_47b.scope:dojo.global;_47b.onError.call(_481,_480);}});}}else{if(this._jsonData){self._getItemsFromLoadedData(self._jsonData);self._jsonData=null;self._loadFinished=true;item=self._getItemByIdentity(_47b.identity);if(_47b.onItem){_47c=_47b.scope?_47b.scope:dojo.global;_47b.onItem.call(_47c,item);}}}}else{item=this._getItemByIdentity(_47b.identity);if(_47b.onItem){_47c=_47b.scope?_47b.scope:dojo.global;_47b.onItem.call(_47c,item);}}},_getItemByIdentity:function(_482){var item=null;if(this._itemsByIdentity&&Object.hasOwnProperty.call(this._itemsByIdentity,_482)){item=this._itemsByIdentity[_482];}else{if(Object.hasOwnProperty.call(this._arrayOfAllItems,_482)){item=this._arrayOfAllItems[_482];}}if(item===undefined){item=null;}return item;},getIdentityAttributes:function(item){var _483=this._features["dojo.data.api.Identity"];if(_483===Number){return null;}else{return [_483];}},_forceLoad:function(){var self=this;if(this._jsonFileUrl!==this._ccUrl){dojo.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl.  _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null){this._jsonData=this.data;this.data=null;}if(this._jsonFileUrl){var _484={url:this._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk,sync:true};var _485=dojo.xhrGet(_484);_485.addCallback(function(data){try{if(self._loadInProgress!==true&&!self._loadFinished){self._getItemsFromLoadedData(data);self._loadFinished=true;}else{if(self._loadInProgress){throw new Error("dojo.data.ItemFileReadStore:  Unable to perform a synchronous load, an async load is in progress.");}}}catch(e){console.log(e);throw e;}});_485.addErrback(function(_486){throw _486;});}else{if(this._jsonData){self._getItemsFromLoadedData(self._jsonData);self._jsonData=null;self._loadFinished=true;}}}});dojo.extend(dojo.data.ItemFileReadStore,dojo.data.util.simpleFetch);}if(!dojo._hasResource["dijit.layout._LayoutWidget"]){dojo._hasResource["dijit.layout._LayoutWidget"]=true;dojo.provide("dijit.layout._LayoutWidget");dojo.declare("dijit.layout._LayoutWidget",[dijit._Widget,dijit._Container,dijit._Contained],{baseClass:"dijitLayoutContainer",isLayoutContainer:true,buildRendering:function(){this.inherited(arguments);dojo.addClass(this.domNode,"dijitContainer");},startup:function(){if(this._started){return;}this.inherited(arguments);var _487=this.getParent&&this.getParent();if(!(_487&&_487.isLayoutContainer)){this.resize();this.connect(dojo.isIE?this.domNode:dojo.global,"onresize",function(){this.resize();});}},resize:function(_488,_489){var node=this.domNode;if(_488){dojo.marginBox(node,_488);if(_488.t){node.style.top=_488.t+"px";}if(_488.l){node.style.left=_488.l+"px";}}var mb=_489||{};dojo.mixin(mb,_488||{});if(!("h" in mb)||!("w" in mb)){mb=dojo.mixin(dojo.marginBox(node),mb);}var cs=dojo.getComputedStyle(node);var me=dojo._getMarginExtents(node,cs);var be=dojo._getBorderExtents(node,cs);var bb=(this._borderBox={w:mb.w-(me.w+be.w),h:mb.h-(me.h+be.h)});var pe=dojo._getPadExtents(node,cs);this._contentBox={l:dojo._toPixelValue(node,cs.paddingLeft),t:dojo._toPixelValue(node,cs.paddingTop),w:bb.w-pe.w,h:bb.h-pe.h};this.layout();},layout:function(){},_setupChild:function(_48a){var cls=this.baseClass+"-child "+(_48a.baseClass?this.baseClass+"-"+_48a.baseClass:"");dojo.addClass(_48a.domNode,cls);},addChild:function(_48b,_48c){this.inherited(arguments);if(this._started){this._setupChild(_48b);}},removeChild:function(_48d){var cls=this.baseClass+"-child"+(_48d.baseClass?" "+this.baseClass+"-"+_48d.baseClass:"");dojo.removeClass(_48d.domNode,cls);this.inherited(arguments);}});dijit.layout.marginBox2contentBox=function(node,mb){var cs=dojo.getComputedStyle(node);var me=dojo._getMarginExtents(node,cs);var pb=dojo._getPadBorderExtents(node,cs);return {l:dojo._toPixelValue(node,cs.paddingLeft),t:dojo._toPixelValue(node,cs.paddingTop),w:mb.w-(me.w+pb.w),h:mb.h-(me.h+pb.h)};};(function(){var _48e=function(word){return word.substring(0,1).toUpperCase()+word.substring(1);};var size=function(_48f,dim){var _490=_48f.resize?_48f.resize(dim):dojo.marginBox(_48f.domNode,dim);if(_490){dojo.mixin(_48f,_490);}else{dojo.mixin(_48f,dojo.marginBox(_48f.domNode));dojo.mixin(_48f,dim);}};dijit.layout.layoutChildren=function(_491,dim,_492,_493,_494){dim=dojo.mixin({},dim);dojo.addClass(_491,"dijitLayoutContainer");_492=dojo.filter(_492,function(item){return item.region!="center"&&item.layoutAlign!="client";}).concat(dojo.filter(_492,function(item){return item.region=="center"||item.layoutAlign=="client";}));dojo.forEach(_492,function(_495){var elm=_495.domNode,pos=(_495.region||_495.layoutAlign);var _496=elm.style;_496.left=dim.l+"px";_496.top=dim.t+"px";_496.position="absolute";dojo.addClass(elm,"dijitAlign"+_48e(pos));var _497={};if(_493&&_493==_495.id){_497[_495.region=="top"||_495.region=="bottom"?"h":"w"]=_494;}if(pos=="top"||pos=="bottom"){_497.w=dim.w;size(_495,_497);dim.h-=_495.h;if(pos=="top"){dim.t+=_495.h;}else{_496.top=dim.t+dim.h+"px";}}else{if(pos=="left"||pos=="right"){_497.h=dim.h;size(_495,_497);dim.w-=_495.w;if(pos=="left"){dim.l+=_495.w;}else{_496.left=dim.l+dim.w+"px";}}else{if(pos=="client"||pos=="center"){size(_495,dim);}}}});};})();}if(!dojo._hasResource["dijit.dijit"]){dojo._hasResource["dijit.dijit"]=true;dojo.provide("dijit.dijit");}if(!dojo._hasResource["dojox.html.metrics"]){dojo._hasResource["dojox.html.metrics"]=true;dojo.provide("dojox.html.metrics");(function(){var dhm=dojox.html.metrics;dhm.getFontMeasurements=function(){var _498={"1em":0,"1ex":0,"100%":0,"12pt":0,"16px":0,"xx-small":0,"x-small":0,"small":0,"medium":0,"large":0,"x-large":0,"xx-large":0};if(dojo.isIE){dojo.doc.documentElement.style.fontSize="100%";}var div=dojo.doc.createElement("div");var ds=div.style;ds.position="absolute";ds.left="-100px";ds.top="0";ds.width="30px";ds.height="1000em";ds.borderWidth="0";ds.margin="0";ds.padding="0";ds.outline="0";ds.lineHeight="1";ds.overflow="hidden";dojo.body().appendChild(div);for(var p in _498){ds.fontSize=p;_498[p]=Math.round(div.offsetHeight*12/16)*16/12/1000;}dojo.body().removeChild(div);div=null;return _498;};var _499=null;dhm.getCachedFontMeasurements=function(_49a){if(_49a||!_499){_499=dhm.getFontMeasurements();}return _499;};var _49b=null,_49c={};dhm.getTextBox=function(text,_49d,_49e){var m,s;if(!_49b){m=_49b=dojo.doc.createElement("div");var c=dojo.doc.createElement("div");c.appendChild(m);s=c.style;s.overflow="scroll";s.position="absolute";s.left="0px";s.top="-10000px";s.width="1px";s.height="1px";s.visibility="hidden";s.borderWidth="0";s.margin="0";s.padding="0";s.outline="0";dojo.body().appendChild(c);}else{m=_49b;}m.className="";s=m.style;s.borderWidth="0";s.margin="0";s.padding="0";s.outline="0";if(arguments.length>1&&_49d){for(var i in _49d){if(i in _49c){continue;}s[i]=_49d[i];}}if(arguments.length>2&&_49e){m.className=_49e;}m.innerHTML=text;var box=dojo.position(m);box.w=m.parentNode.scrollWidth;return box;};var _49f={w:16,h:16};dhm.getScrollbar=function(){return {w:_49f.w,h:_49f.h};};dhm._fontResizeNode=null;dhm.initOnFontResize=function(_4a0){var f=dhm._fontResizeNode=dojo.doc.createElement("iframe");var fs=f.style;fs.position="absolute";fs.width="5em";fs.height="10em";fs.top="-10000px";if(dojo.isIE){f.onreadystatechange=function(){if(f.contentWindow.document.readyState=="complete"){f.onresize=f.contentWindow.parent[dojox._scopeName].html.metrics._fontresize;}};}else{f.onload=function(){f.contentWindow.onresize=f.contentWindow.parent[dojox._scopeName].html.metrics._fontresize;};}f.setAttribute("src","javascript:'<html><head><script>if(\"loadFirebugConsole\" in window){window.loadFirebugConsole();}</script></head><body></body></html>'");dojo.body().appendChild(f);dhm.initOnFontResize=function(){};};dhm.onFontResize=function(){};dhm._fontresize=function(){dhm.onFontResize();};dojo.addOnUnload(function(){var f=dhm._fontResizeNode;if(f){if(dojo.isIE&&f.onresize){f.onresize=null;}else{if(f.contentWindow&&f.contentWindow.onresize){f.contentWindow.onresize=null;}}dhm._fontResizeNode=null;}});dojo.addOnLoad(function(){try{var n=dojo.doc.createElement("div");n.style.cssText="top:0;left:0;width:100px;height:100px;overflow:scroll;position:absolute;visibility:hidden;";dojo.body().appendChild(n);_49f.w=n.offsetWidth-n.clientWidth;_49f.h=n.offsetHeight-n.clientHeight;dojo.body().removeChild(n);delete n;}catch(e){}if("fontSizeWatch" in dojo.config&&!!dojo.config.fontSizeWatch){dhm.initOnFontResize();}});})();}if(!dojo._hasResource["dojox.grid.util"]){dojo._hasResource["dojox.grid.util"]=true;dojo.provide("dojox.grid.util");(function(){var dgu=dojox.grid.util;dgu.na="...";dgu.rowIndexTag="gridRowIndex";dgu.gridViewTag="gridView";dgu.fire=function(ob,ev,args){var fn=ob&&ev&&ob[ev];return fn&&(args?fn.apply(ob,args):ob[ev]());};dgu.setStyleHeightPx=function(_4a1,_4a2){if(_4a2>=0){var s=_4a1.style;var v=_4a2+"px";if(_4a1&&s["height"]!=v){s["height"]=v;}}};dgu.mouseEvents=["mouseover","mouseout","mousedown","mouseup","click","dblclick","contextmenu"];dgu.keyEvents=["keyup","keydown","keypress"];dgu.funnelEvents=function(_4a3,_4a4,_4a5,_4a6){var evts=(_4a6?_4a6:dgu.mouseEvents.concat(dgu.keyEvents));for(var i=0,l=evts.length;i<l;i++){_4a4.connect(_4a3,"on"+evts[i],_4a5);}};dgu.removeNode=function(_4a7){_4a7=dojo.byId(_4a7);_4a7&&_4a7.parentNode&&_4a7.parentNode.removeChild(_4a7);return _4a7;};dgu.arrayCompare=function(inA,inB){for(var i=0,l=inA.length;i<l;i++){if(inA[i]!=inB[i]){return false;}}return (inA.length==inB.length);};dgu.arrayInsert=function(_4a8,_4a9,_4aa){if(_4a8.length<=_4a9){_4a8[_4a9]=_4aa;}else{_4a8.splice(_4a9,0,_4aa);}};dgu.arrayRemove=function(_4ab,_4ac){_4ab.splice(_4ac,1);};dgu.arraySwap=function(_4ad,inI,inJ){var _4ae=_4ad[inI];_4ad[inI]=_4ad[inJ];_4ad[inJ]=_4ae;};})();}if(!dojo._hasResource["dojox.grid._Scroller"]){dojo._hasResource["dojox.grid._Scroller"]=true;dojo.provide("dojox.grid._Scroller");(function(){var _4af=function(_4b0){var i=0,n,p=_4b0.parentNode;while((n=p.childNodes[i++])){if(n==_4b0){return i-1;}}return -1;};var _4b1=function(_4b2){if(!_4b2){return;}var _4b3=function(inW){return inW.domNode&&dojo.isDescendant(inW.domNode,_4b2,true);};var ws=dijit.registry.filter(_4b3);for(var i=0,w;(w=ws[i]);i++){w.destroy();}delete ws;};var _4b4=function(_4b5){var node=dojo.byId(_4b5);return (node&&node.tagName?node.tagName.toLowerCase():"");};var _4b6=function(_4b7,_4b8){var _4b9=[];var i=0,n;while((n=_4b7.childNodes[i])){i++;if(_4b4(n)==_4b8){_4b9.push(n);}}return _4b9;};var _4ba=function(_4bb){return _4b6(_4bb,"div");};dojo.declare("dojox.grid._Scroller",null,{constructor:function(_4bc){this.setContentNodes(_4bc);this.pageHeights=[];this.pageNodes=[];this.stack=[];},rowCount:0,defaultRowHeight:32,keepRows:100,contentNode:null,scrollboxNode:null,defaultPageHeight:0,keepPages:10,pageCount:0,windowHeight:0,firstVisibleRow:0,lastVisibleRow:0,averageRowHeight:0,page:0,pageTop:0,init:function(_4bd,_4be,_4bf){switch(arguments.length){case 3:this.rowsPerPage=_4bf;case 2:this.keepRows=_4be;case 1:this.rowCount=_4bd;default:break;}this.defaultPageHeight=this.defaultRowHeight*this.rowsPerPage;this.pageCount=this._getPageCount(this.rowCount,this.rowsPerPage);this.setKeepInfo(this.keepRows);this.invalidate();if(this.scrollboxNode){this.scrollboxNode.scrollTop=0;this.scroll(0);this.scrollboxNode.onscroll=dojo.hitch(this,"onscroll");}},_getPageCount:function(_4c0,_4c1){return _4c0?(Math.ceil(_4c0/_4c1)||1):0;},destroy:function(){this.invalidateNodes();delete this.contentNodes;delete this.contentNode;delete this.scrollboxNode;},setKeepInfo:function(_4c2){this.keepRows=_4c2;this.keepPages=!this.keepRows?this.keepPages:Math.max(Math.ceil(this.keepRows/this.rowsPerPage),2);},setContentNodes:function(_4c3){this.contentNodes=_4c3;this.colCount=(this.contentNodes?this.contentNodes.length:0);this.pageNodes=[];for(var i=0;i<this.colCount;i++){this.pageNodes[i]=[];}},getDefaultNodes:function(){return this.pageNodes[0]||[];},invalidate:function(){this._invalidating=true;this.invalidateNodes();this.pageHeights=[];this.height=(this.pageCount?(this.pageCount-1)*this.defaultPageHeight+this.calcLastPageHeight():0);this.resize();this._invalidating=false;},updateRowCount:function(_4c4){this.invalidateNodes();this.rowCount=_4c4;var _4c5=this.pageCount;if(_4c5===0){this.height=1;}this.pageCount=this._getPageCount(this.rowCount,this.rowsPerPage);if(this.pageCount<_4c5){for(var i=_4c5-1;i>=this.pageCount;i--){this.height-=this.getPageHeight(i);delete this.pageHeights[i];}}else{if(this.pageCount>_4c5){this.height+=this.defaultPageHeight*(this.pageCount-_4c5-1)+this.calcLastPageHeight();}}this.resize();},pageExists:function(_4c6){return Boolean(this.getDefaultPageNode(_4c6));},measurePage:function(_4c7){if(this.grid.rowHeight){var _4c8=this.grid.rowHeight+1;return ((_4c7+1)*this.rowsPerPage>this.rowCount?this.rowCount-_4c7*this.rowsPerPage:this.rowsPerPage)*_4c8;}var n=this.getDefaultPageNode(_4c7);return (n&&n.innerHTML)?n.offsetHeight:undefined;},positionPage:function(_4c9,_4ca){for(var i=0;i<this.colCount;i++){this.pageNodes[i][_4c9].style.top=_4ca+"px";}},repositionPages:function(_4cb){var _4cc=this.getDefaultNodes();var last=0;for(var i=0;i<this.stack.length;i++){last=Math.max(this.stack[i],last);}var n=_4cc[_4cb];var y=(n?this.getPageNodePosition(n)+this.getPageHeight(_4cb):0);for(var p=_4cb+1;p<=last;p++){n=_4cc[p];if(n){if(this.getPageNodePosition(n)==y){return;}this.positionPage(p,y);}y+=this.getPageHeight(p);}},installPage:function(_4cd){for(var i=0;i<this.colCount;i++){this.contentNodes[i].appendChild(this.pageNodes[i][_4cd]);}},preparePage:function(_4ce,_4cf){var p=(_4cf?this.popPage():null);for(var i=0;i<this.colCount;i++){var _4d0=this.pageNodes[i];var _4d1=(p===null?this.createPageNode():this.invalidatePageNode(p,_4d0));_4d1.pageIndex=_4ce;_4d0[_4ce]=_4d1;}},renderPage:function(_4d2){var _4d3=[];var i,j;for(i=0;i<this.colCount;i++){_4d3[i]=this.pageNodes[i][_4d2];}for(i=0,j=_4d2*this.rowsPerPage;(i<this.rowsPerPage)&&(j<this.rowCount);i++,j++){this.renderRow(j,_4d3);}},removePage:function(_4d4){for(var i=0,j=_4d4*this.rowsPerPage;i<this.rowsPerPage;i++,j++){this.removeRow(j);}},destroyPage:function(_4d5){for(var i=0;i<this.colCount;i++){var n=this.invalidatePageNode(_4d5,this.pageNodes[i]);if(n){dojo.destroy(n);}}},pacify:function(_4d6){},pacifying:false,pacifyTicks:200,setPacifying:function(_4d7){if(this.pacifying!=_4d7){this.pacifying=_4d7;this.pacify(this.pacifying);}},startPacify:function(){this.startPacifyTicks=new Date().getTime();},doPacify:function(){var _4d8=(new Date().getTime()-this.startPacifyTicks)>this.pacifyTicks;this.setPacifying(true);this.startPacify();return _4d8;},endPacify:function(){this.setPacifying(false);},resize:function(){if(this.scrollboxNode){this.windowHeight=this.scrollboxNode.clientHeight;}for(var i=0;i<this.colCount;i++){dojox.grid.util.setStyleHeightPx(this.contentNodes[i],Math.max(1,this.height));}var _4d9=(!this._invalidating);if(!_4d9){var ah=this.grid.get("autoHeight");if(typeof ah=="number"&&ah<=Math.min(this.rowsPerPage,this.rowCount)){_4d9=true;}}if(_4d9){this.needPage(this.page,this.pageTop);}var _4da=(this.page<this.pageCount-1)?this.rowsPerPage:((this.rowCount%this.rowsPerPage)||this.rowsPerPage);var _4db=this.getPageHeight(this.page);this.averageRowHeight=(_4db>0&&_4da>0)?(_4db/_4da):0;},calcLastPageHeight:function(){if(!this.pageCount){return 0;}var _4dc=this.pageCount-1;var _4dd=((this.rowCount%this.rowsPerPage)||(this.rowsPerPage))*this.defaultRowHeight;this.pageHeights[_4dc]=_4dd;return _4dd;},updateContentHeight:function(inDh){this.height+=inDh;this.resize();},updatePageHeight:function(_4de,_4df,_4e0){if(this.pageExists(_4de)){var oh=this.getPageHeight(_4de);var h=(this.measurePage(_4de));if(h===undefined){h=oh;}this.pageHeights[_4de]=h;if(oh!=h){this.updateContentHeight(h-oh);var ah=this.grid.get("autoHeight");if((typeof ah=="number"&&ah>this.rowCount)||(ah===true&&!_4df)){if(!_4e0){this.grid.sizeChange();}else{var ns=this.grid.viewsNode.style;ns.height=parseInt(ns.height)+h-oh+"px";this.repositionPages(_4de);}}else{this.repositionPages(_4de);}}return h;}return 0;},rowHeightChanged:function(_4e1,_4e2){this.updatePageHeight(Math.floor(_4e1/this.rowsPerPage),false,_4e2);},invalidateNodes:function(){while(this.stack.length){this.destroyPage(this.popPage());}},createPageNode:function(){var p=document.createElement("div");dojo.attr(p,"role","presentation");p.style.position="absolute";p.style[dojo._isBodyLtr()?"left":"right"]="0";return p;},getPageHeight:function(_4e3){var ph=this.pageHeights[_4e3];return (ph!==undefined?ph:this.defaultPageHeight);},pushPage:function(_4e4){return this.stack.push(_4e4);},popPage:function(){return this.stack.shift();},findPage:function(_4e5){var i=0,h=0;for(var ph=0;i<this.pageCount;i++,h+=ph){ph=this.getPageHeight(i);if(h+ph>=_4e5){break;}}this.page=i;this.pageTop=h;},buildPage:function(_4e6,_4e7,_4e8){this.preparePage(_4e6,_4e7);this.positionPage(_4e6,_4e8);this.installPage(_4e6);this.renderPage(_4e6);this.pushPage(_4e6);},needPage:function(_4e9,_4ea){var h=this.getPageHeight(_4e9),oh=h;if(!this.pageExists(_4e9)){this.buildPage(_4e9,(!this.grid._autoHeight&&this.keepPages&&(this.stack.length>=this.keepPages)),_4ea);h=this.updatePageHeight(_4e9,true);}else{this.positionPage(_4e9,_4ea);}return h;},onscroll:function(){this.scroll(this.scrollboxNode.scrollTop);},scroll:function(_4eb){this.grid.scrollTop=_4eb;if(this.colCount){this.startPacify();this.findPage(_4eb);var h=this.height;var b=this.getScrollBottom(_4eb);for(var p=this.page,y=this.pageTop;(p<this.pageCount)&&((b<0)||(y<b));p++){y+=this.needPage(p,y);}this.firstVisibleRow=this.getFirstVisibleRow(this.page,this.pageTop,_4eb);this.lastVisibleRow=this.getLastVisibleRow(p-1,y,b);if(h!=this.height){this.repositionPages(p-1);}this.endPacify();}},getScrollBottom:function(_4ec){return (this.windowHeight>=0?_4ec+this.windowHeight:-1);},processNodeEvent:function(e,_4ed){var t=e.target;while(t&&(t!=_4ed)&&t.parentNode&&(t.parentNode.parentNode!=_4ed)){t=t.parentNode;}if(!t||!t.parentNode||(t.parentNode.parentNode!=_4ed)){return false;}var page=t.parentNode;e.topRowIndex=page.pageIndex*this.rowsPerPage;e.rowIndex=e.topRowIndex+_4af(t);e.rowTarget=t;return true;},processEvent:function(e){return this.processNodeEvent(e,this.contentNode);},renderRow:function(_4ee,_4ef){},removeRow:function(_4f0){},getDefaultPageNode:function(_4f1){return this.getDefaultNodes()[_4f1];},positionPageNode:function(_4f2,_4f3){},getPageNodePosition:function(_4f4){return _4f4.offsetTop;},invalidatePageNode:function(_4f5,_4f6){var p=_4f6[_4f5];if(p){delete _4f6[_4f5];this.removePage(_4f5,p);_4b1(p);p.innerHTML="";}return p;},getPageRow:function(_4f7){return _4f7*this.rowsPerPage;},getLastPageRow:function(_4f8){return Math.min(this.rowCount,this.getPageRow(_4f8+1))-1;},getFirstVisibleRow:function(_4f9,_4fa,_4fb){if(!this.pageExists(_4f9)){return 0;}var row=this.getPageRow(_4f9);var _4fc=this.getDefaultNodes();var rows=_4ba(_4fc[_4f9]);for(var i=0,l=rows.length;i<l&&_4fa<_4fb;i++,row++){_4fa+=rows[i].offsetHeight;}return (row?row-1:row);},getLastVisibleRow:function(_4fd,_4fe,_4ff){if(!this.pageExists(_4fd)){return 0;}var _500=this.getDefaultNodes();var row=this.getLastPageRow(_4fd);var rows=_4ba(_500[_4fd]);for(var i=rows.length-1;i>=0&&_4fe>_4ff;i--,row--){_4fe-=rows[i].offsetHeight;}return row+1;},findTopRow:function(_501){var _502=this.getDefaultNodes();var rows=_4ba(_502[this.page]);for(var i=0,l=rows.length,t=this.pageTop,h;i<l;i++){h=rows[i].offsetHeight;t+=h;if(t>=_501){this.offset=h-(t-_501);return i+this.page*this.rowsPerPage;}}return -1;},findScrollTop:function(_503){var _504=Math.floor(_503/this.rowsPerPage);var t=0;var i,l;for(i=0;i<_504;i++){t+=this.getPageHeight(i);}this.pageTop=t;this.page=_504;this.needPage(_504,this.pageTop);var _505=this.getDefaultNodes();var rows=_4ba(_505[_504]);var r=_503-this.rowsPerPage*_504;for(i=0,l=rows.length;i<l&&i<r;i++){t+=rows[i].offsetHeight;}return t;},dummy:0});})();}if(!dojo._hasResource["dojox.grid.cells._base"]){dojo._hasResource["dojox.grid.cells._base"]=true;dojo.provide("dojox.grid.cells._base");dojo.declare("dojox.grid._DeferredTextWidget",dijit._Widget,{deferred:null,_destroyOnRemove:true,postCreate:function(){if(this.deferred){this.deferred.addBoth(dojo.hitch(this,function(text){if(this.domNode){this.domNode.innerHTML=text;}}));}}});(function(){var _506=function(_507){try{dojox.grid.util.fire(_507,"focus");dojox.grid.util.fire(_507,"select");}catch(e){}};var _508=function(){setTimeout(dojo.hitch.apply(dojo,arguments),0);};var dgc=dojox.grid.cells;dojo.declare("dojox.grid.cells._Base",null,{styles:"",classes:"",editable:false,alwaysEditing:false,formatter:null,defaultValue:"...",value:null,hidden:false,noresize:false,draggable:true,_valueProp:"value",_formatPending:false,constructor:function(_509){this._props=_509||{};dojo.mixin(this,_509);if(this.draggable===undefined){this.draggable=true;}},_defaultFormat:function(_50a,_50b){var s=this.grid.formatterScope||this;var f=this.formatter;if(f&&s&&typeof f=="string"){f=this.formatter=s[f];}var v=(_50a!=this.defaultValue&&f)?f.apply(s,_50b):_50a;if(typeof v=="undefined"){return this.defaultValue;}if(v&&v.addBoth){v=new dojox.grid._DeferredTextWidget({deferred:v},dojo.create("span",{innerHTML:this.defaultValue}));}if(v&&v.declaredClass&&v.startup){return "<div class='dojoxGridStubNode' linkWidget='"+v.id+"' cellIdx='"+this.index+"'>"+this.defaultValue+"</div>";}return v;},format:function(_50c,_50d){var f,i=this.grid.edit.info,d=this.get?this.get(_50c,_50d):(this.value||this.defaultValue);d=(d&&d.replace&&this.grid.escapeHTMLInData)?d.replace(/&(?![a-z0-9]{1,8}\;)/ig,"&amp;").replace(/</g,"&lt;"):d;if(this.editable&&(this.alwaysEditing||(i.rowIndex==_50c&&i.cell==this))){return this.formatEditing(d,_50c);}else{return this._defaultFormat(d,[d,_50c,this]);}},formatEditing:function(_50e,_50f){},getNode:function(_510){return this.view.getCellNode(_510,this.index);},getHeaderNode:function(){return this.view.getHeaderCellNode(this.index);},getEditNode:function(_511){return (this.getNode(_511)||0).firstChild||0;},canResize:function(){var uw=this.unitWidth;return uw&&(uw!=="auto");},isFlex:function(){var uw=this.unitWidth;return uw&&dojo.isString(uw)&&(uw=="auto"||uw.slice(-1)=="%");},applyEdit:function(_512,_513){this.grid.edit.applyCellEdit(_512,this,_513);},cancelEdit:function(_514){this.grid.doCancelEdit(_514);},_onEditBlur:function(_515){if(this.grid.edit.isEditCell(_515,this.index)){this.grid.edit.apply();}},registerOnBlur:function(_516,_517){if(this.commitOnBlur){dojo.connect(_516,"onblur",function(e){setTimeout(dojo.hitch(this,"_onEditBlur",_517),250);});}},needFormatNode:function(_518,_519){this._formatPending=true;_508(this,"_formatNode",_518,_519);},cancelFormatNode:function(){this._formatPending=false;},_formatNode:function(_51a,_51b){if(this._formatPending){this._formatPending=false;dojo.setSelectable(this.grid.domNode,true);this.formatNode(this.getEditNode(_51b),_51a,_51b);}},formatNode:function(_51c,_51d,_51e){if(dojo.isIE){_508(this,"focus",_51e,_51c);}else{this.focus(_51e,_51c);}},dispatchEvent:function(m,e){if(m in this){return this[m](e);}},getValue:function(_51f){return this.getEditNode(_51f)[this._valueProp];},setValue:function(_520,_521){var n=this.getEditNode(_520);if(n){n[this._valueProp]=_521;}},focus:function(_522,_523){_506(_523||this.getEditNode(_522));},save:function(_524){this.value=this.value||this.getValue(_524);},restore:function(_525){this.setValue(_525,this.value);},_finish:function(_526){dojo.setSelectable(this.grid.domNode,false);this.cancelFormatNode();},apply:function(_527){this.applyEdit(this.getValue(_527),_527);this._finish(_527);},cancel:function(_528){this.cancelEdit(_528);this._finish(_528);}});dgc._Base.markupFactory=function(node,_529){var d=dojo;var _52a=d.trim(d.attr(node,"formatter")||"");if(_52a){_529.formatter=dojo.getObject(_52a)||_52a;}var get=d.trim(d.attr(node,"get")||"");if(get){_529.get=dojo.getObject(get);}var _52b=function(attr,cell,_52c){var _52d=d.trim(d.attr(node,attr)||"");if(_52d){cell[_52c||attr]=!(_52d.toLowerCase()=="false");}};_52b("sortDesc",_529);_52b("editable",_529);_52b("alwaysEditing",_529);_52b("noresize",_529);_52b("draggable",_529);var _52e=d.trim(d.attr(node,"loadingText")||d.attr(node,"defaultValue")||"");if(_52e){_529.defaultValue=_52e;}var _52f=function(attr,cell,_530){var _531=d.trim(d.attr(node,attr)||"")||undefined;if(_531){cell[_530||attr]=_531;}};_52f("styles",_529);_52f("headerStyles",_529);_52f("cellStyles",_529);_52f("classes",_529);_52f("headerClasses",_529);_52f("cellClasses",_529);};dojo.declare("dojox.grid.cells.Cell",dgc._Base,{constructor:function(){this.keyFilter=this.keyFilter;},keyFilter:null,formatEditing:function(_532,_533){this.needFormatNode(_532,_533);return "<input class=\"dojoxGridInput\" type=\"text\" value=\""+_532+"\">";},formatNode:function(_534,_535,_536){this.inherited(arguments);this.registerOnBlur(_534,_536);},doKey:function(e){if(this.keyFilter){var key=String.fromCharCode(e.charCode);if(key.search(this.keyFilter)==-1){dojo.stopEvent(e);}}},_finish:function(_537){this.inherited(arguments);var n=this.getEditNode(_537);try{dojox.grid.util.fire(n,"blur");}catch(e){}}});dgc.Cell.markupFactory=function(node,_538){dgc._Base.markupFactory(node,_538);var d=dojo;var _539=d.trim(d.attr(node,"keyFilter")||"");if(_539){_538.keyFilter=new RegExp(_539);}};dojo.declare("dojox.grid.cells.RowIndex",dgc.Cell,{name:"Row",postscript:function(){this.editable=false;},get:function(_53a){return _53a+1;}});dgc.RowIndex.markupFactory=function(node,_53b){dgc.Cell.markupFactory(node,_53b);};dojo.declare("dojox.grid.cells.Select",dgc.Cell,{options:null,values:null,returnIndex:-1,constructor:function(_53c){this.values=this.values||this.options;},formatEditing:function(_53d,_53e){this.needFormatNode(_53d,_53e);var h=["<select class=\"dojoxGridSelect\">"];for(var i=0,o,v;((o=this.options[i])!==undefined)&&((v=this.values[i])!==undefined);i++){h.push("<option",(_53d==v?" selected":"")," value=\""+v+"\"",">",o,"</option>");}h.push("</select>");return h.join("");},getValue:function(_53f){var n=this.getEditNode(_53f);if(n){var i=n.selectedIndex,o=n.options[i];return this.returnIndex>-1?i:o.value||o.innerHTML;}}});dgc.Select.markupFactory=function(node,cell){dgc.Cell.markupFactory(node,cell);var d=dojo;var _540=d.trim(d.attr(node,"options")||"");if(_540){var o=_540.split(",");if(o[0]!=_540){cell.options=o;}}var _541=d.trim(d.attr(node,"values")||"");if(_541){var v=_541.split(",");if(v[0]!=_541){cell.values=v;}}};dojo.declare("dojox.grid.cells.AlwaysEdit",dgc.Cell,{alwaysEditing:true,_formatNode:function(_542,_543){this.formatNode(this.getEditNode(_543),_542,_543);},applyStaticValue:function(_544){var e=this.grid.edit;e.applyCellEdit(this.getValue(_544),this,_544);e.start(this,_544,true);}});dgc.AlwaysEdit.markupFactory=function(node,cell){dgc.Cell.markupFactory(node,cell);};dojo.declare("dojox.grid.cells.Bool",dgc.AlwaysEdit,{_valueProp:"checked",formatEditing:function(_545,_546){return "<input class=\"dojoxGridInput\" type=\"checkbox\""+(_545?" checked=\"checked\"":"")+" style=\"width: auto\" />";},doclick:function(e){if(e.target.tagName=="INPUT"){this.applyStaticValue(e.rowIndex);}}});dgc.Bool.markupFactory=function(node,cell){dgc.AlwaysEdit.markupFactory(node,cell);};})();}if(!dojo._hasResource["dojox.grid.cells"]){dojo._hasResource["dojox.grid.cells"]=true;dojo.provide("dojox.grid.cells");}if(!dojo._hasResource["dojox.grid._Builder"]){dojo._hasResource["dojox.grid._Builder"]=true;dojo.provide("dojox.grid._Builder");(function(){var dg=dojox.grid;var _547=function(td){return td.cellIndex>=0?td.cellIndex:dojo.indexOf(td.parentNode.cells,td);};var _548=function(tr){return tr.rowIndex>=0?tr.rowIndex:dojo.indexOf(tr.parentNode.childNodes,tr);};var _549=function(_54a,_54b){return _54a&&((_54a.rows||0)[_54b]||_54a.childNodes[_54b]);};var _54c=function(node){for(var n=node;n&&n.tagName!="TABLE";n=n.parentNode){}return n;};var _54d=function(_54e,_54f){for(var n=_54e;n&&_54f(n);n=n.parentNode){}return n;};var _550=function(_551){var name=_551.toUpperCase();return function(node){return node.tagName!=name;};};var _552=dojox.grid.util.rowIndexTag;var _553=dojox.grid.util.gridViewTag;dg._Builder=dojo.extend(function(view){if(view){this.view=view;this.grid=view.grid;}},{view:null,_table:"<table class=\"dojoxGridRowTable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" role=\"presentation\"",getTableArray:function(){var html=[this._table];if(this.view.viewWidth){html.push([" style=\"width:",this.view.viewWidth,";\""].join(""));}html.push(">");return html;},generateCellMarkup:function(_554,_555,_556,_557){var _558=[],html;if(_557){var _559=_554.index!=_554.grid.getSortIndex()?"":_554.grid.sortInfo>0?"aria-sort=\"ascending\"":"aria-sort=\"descending\"";if(!_554.id){_554.id=this.grid.id+"Hdr"+_554.index;}html=["<th tabIndex=\"-1\" aria-readonly=\"true\" role=\"columnheader\"",_559,"id=\"",_554.id,"\""];}else{var _55a=this.grid.editable&&!_554.editable?"aria-readonly=\"true\"":"";html=["<td tabIndex=\"-1\" role=\"gridcell\"",_55a];}if(_554.colSpan){html.push(" colspan=\"",_554.colSpan,"\"");}if(_554.rowSpan){html.push(" rowspan=\"",_554.rowSpan,"\"");}html.push(" class=\"dojoxGridCell ");if(_554.classes){html.push(_554.classes," ");}if(_556){html.push(_556," ");}_558.push(html.join(""));_558.push("");html=["\" idx=\"",_554.index,"\" style=\""];if(_555&&_555[_555.length-1]!=";"){_555+=";";}html.push(_554.styles,_555||"",_554.hidden?"display:none;":"");if(_554.unitWidth){html.push("width:",_554.unitWidth,";");}_558.push(html.join(""));_558.push("");html=["\""];if(_554.attrs){html.push(" ",_554.attrs);}html.push(">");_558.push(html.join(""));_558.push("");_558.push(_557?"</th>":"</td>");return _558;},isCellNode:function(_55b){return Boolean(_55b&&_55b!=dojo.doc&&dojo.attr(_55b,"idx"));},getCellNodeIndex:function(_55c){return _55c?Number(dojo.attr(_55c,"idx")):-1;},getCellNode:function(_55d,_55e){for(var i=0,row;((row=_549(_55d.firstChild,i))&&row.cells);i++){for(var j=0,cell;(cell=row.cells[j]);j++){if(this.getCellNodeIndex(cell)==_55e){return cell;}}}return null;},findCellTarget:function(_55f,_560){var n=_55f;while(n&&(!this.isCellNode(n)||(n.offsetParent&&_553 in n.offsetParent.parentNode&&n.offsetParent.parentNode[_553]!=this.view.id))&&(n!=_560)){n=n.parentNode;}return n!=_560?n:null;},baseDecorateEvent:function(e){e.dispatch="do"+e.type;e.grid=this.grid;e.sourceView=this.view;e.cellNode=this.findCellTarget(e.target,e.rowNode);e.cellIndex=this.getCellNodeIndex(e.cellNode);e.cell=(e.cellIndex>=0?this.grid.getCell(e.cellIndex):null);},findTarget:function(_561,_562){var n=_561;while(n&&(n!=this.domNode)&&(!(_562 in n)||(_553 in n&&n[_553]!=this.view.id))){n=n.parentNode;}return (n!=this.domNode)?n:null;},findRowTarget:function(_563){return this.findTarget(_563,_552);},isIntraNodeEvent:function(e){try{return (e.cellNode&&e.relatedTarget&&dojo.isDescendant(e.relatedTarget,e.cellNode));}catch(x){return false;}},isIntraRowEvent:function(e){try{var row=e.relatedTarget&&this.findRowTarget(e.relatedTarget);return !row&&(e.rowIndex==-1)||row&&(e.rowIndex==row.gridRowIndex);}catch(x){return false;}},dispatchEvent:function(e){if(e.dispatch in this){return this[e.dispatch](e);}return false;},domouseover:function(e){if(e.cellNode&&(e.cellNode!=this.lastOverCellNode)){this.lastOverCellNode=e.cellNode;this.grid.onMouseOver(e);}this.grid.onMouseOverRow(e);},domouseout:function(e){if(e.cellNode&&(e.cellNode==this.lastOverCellNode)&&!this.isIntraNodeEvent(e,this.lastOverCellNode)){this.lastOverCellNode=null;this.grid.onMouseOut(e);if(!this.isIntraRowEvent(e)){this.grid.onMouseOutRow(e);}}},domousedown:function(e){if(e.cellNode){this.grid.onMouseDown(e);}this.grid.onMouseDownRow(e);}});dg._ContentBuilder=dojo.extend(function(view){dg._Builder.call(this,view);},dg._Builder.prototype,{update:function(){this.prepareHtml();},prepareHtml:function(){var _564=this.grid.get,_565=this.view.structure.cells;for(var j=0,row;(row=_565[j]);j++){for(var i=0,cell;(cell=row[i]);i++){cell.get=cell.get||(cell.value==undefined)&&_564;cell.markup=this.generateCellMarkup(cell,cell.cellStyles,cell.cellClasses,false);if(!this.grid.editable&&cell.editable){this.grid.editable=true;}}}},generateHtml:function(_566,_567){var html=this.getTableArray(),v=this.view,_568=v.structure.cells,item=this.grid.getItem(_567);dojox.grid.util.fire(this.view,"onBeforeRow",[_567,_568]);for(var j=0,row;(row=_568[j]);j++){if(row.hidden||row.header){continue;}html.push(!row.invisible?"<tr>":"<tr class=\"dojoxGridInvisible\">");for(var i=0,cell,m,cc,cs;(cell=row[i]);i++){m=cell.markup;cc=cell.customClasses=[];cs=cell.customStyles=[];m[5]=cell.format(_567,item);m[1]=cc.join(" ");m[3]=cs.join(";");html.push.apply(html,m);}html.push("</tr>");}html.push("</table>");return html.join("");},decorateEvent:function(e){e.rowNode=this.findRowTarget(e.target);if(!e.rowNode){return false;}e.rowIndex=e.rowNode[_552];this.baseDecorateEvent(e);e.cell=this.grid.getCell(e.cellIndex);return true;}});dg._HeaderBuilder=dojo.extend(function(view){this.moveable=null;dg._Builder.call(this,view);},dg._Builder.prototype,{_skipBogusClicks:false,overResizeWidth:4,minColWidth:1,update:function(){if(this.tableMap){this.tableMap.mapRows(this.view.structure.cells);}else{this.tableMap=new dg._TableMap(this.view.structure.cells);}},generateHtml:function(_569,_56a){var html=this.getTableArray(),_56b=this.view.structure.cells;dojox.grid.util.fire(this.view,"onBeforeRow",[-1,_56b]);for(var j=0,row;(row=_56b[j]);j++){if(row.hidden){continue;}html.push(!row.invisible?"<tr>":"<tr class=\"dojoxGridInvisible\">");for(var i=0,cell,_56c;(cell=row[i]);i++){cell.customClasses=[];cell.customStyles=[];if(this.view.simpleStructure){if(cell.draggable){if(cell.headerClasses){if(cell.headerClasses.indexOf("dojoDndItem")==-1){cell.headerClasses+=" dojoDndItem";}}else{cell.headerClasses="dojoDndItem";}}if(cell.attrs){if(cell.attrs.indexOf("dndType='gridColumn_")==-1){cell.attrs+=" dndType='gridColumn_"+this.grid.id+"'";}}else{cell.attrs="dndType='gridColumn_"+this.grid.id+"'";}}_56c=this.generateCellMarkup(cell,cell.headerStyles,cell.headerClasses,true);_56c[5]=(_56a!=undefined?_56a:_569(cell));_56c[3]=cell.customStyles.join(";");_56c[1]=cell.customClasses.join(" ");html.push(_56c.join(""));}html.push("</tr>");}html.push("</table>");return html.join("");},getCellX:function(e){var n,x=e.layerX;if(dojo.isMoz||dojo.isIE>=9){n=_54d(e.target,_550("th"));x-=(n&&n.offsetLeft)||0;var t=e.sourceView.getScrollbarWidth();if(!dojo._isBodyLtr()){table=_54d(n,_550("table"));x-=(table&&table.offsetLeft)||0;}}n=_54d(e.target,function(){if(!n||n==e.cellNode){return false;}x+=(n.offsetLeft<0?0:n.offsetLeft);return true;});return x;},decorateEvent:function(e){this.baseDecorateEvent(e);e.rowIndex=-1;e.cellX=this.getCellX(e);return true;},prepareResize:function(e,mod){do{var i=_547(e.cellNode);e.cellNode=(i?e.cellNode.parentNode.cells[i+mod]:null);e.cellIndex=(e.cellNode?this.getCellNodeIndex(e.cellNode):-1);}while(e.cellNode&&e.cellNode.style.display=="none");return Boolean(e.cellNode);},canResize:function(e){if(!e.cellNode||e.cellNode.colSpan>1){return false;}var cell=this.grid.getCell(e.cellIndex);return !cell.noresize&&cell.canResize();},overLeftResizeArea:function(e){if(dojo.hasClass(dojo.body(),"dojoDndMove")){return false;}if(dojo.isIE){var tN=e.target;if(dojo.hasClass(tN,"dojoxGridArrowButtonNode")||dojo.hasClass(tN,"dojoxGridArrowButtonChar")){return false;}}if(dojo._isBodyLtr()){return (e.cellIndex>0)&&(e.cellX>0&&e.cellX<this.overResizeWidth)&&this.prepareResize(e,-1);}var t=e.cellNode&&(e.cellX>0&&e.cellX<this.overResizeWidth);return t;},overRightResizeArea:function(e){if(dojo.hasClass(dojo.body(),"dojoDndMove")){return false;}if(dojo.isIE){var tN=e.target;if(dojo.hasClass(tN,"dojoxGridArrowButtonNode")||dojo.hasClass(tN,"dojoxGridArrowButtonChar")){return false;}}if(dojo._isBodyLtr()){return e.cellNode&&(e.cellX>=e.cellNode.offsetWidth-this.overResizeWidth);}return (e.cellIndex>0)&&(e.cellX>=e.cellNode.offsetWidth-this.overResizeWidth)&&this.prepareResize(e,-1);},domousemove:function(e){if(!this.moveable){var c=(this.overRightResizeArea(e)?"dojoxGridColResize":(this.overLeftResizeArea(e)?"dojoxGridColResize":""));if(c&&!this.canResize(e)){c="dojoxGridColNoResize";}dojo.toggleClass(e.sourceView.headerNode,"dojoxGridColNoResize",(c=="dojoxGridColNoResize"));dojo.toggleClass(e.sourceView.headerNode,"dojoxGridColResize",(c=="dojoxGridColResize"));if(dojo.isIE){var t=e.sourceView.headerNode.scrollLeft;e.sourceView.headerNode.scrollLeft=t;}if(c){dojo.stopEvent(e);}}},domousedown:function(e){if(!this.moveable){if((this.overRightResizeArea(e)||this.overLeftResizeArea(e))&&this.canResize(e)){this.beginColumnResize(e);}else{this.grid.onMouseDown(e);this.grid.onMouseOverRow(e);}}},doclick:function(e){if(this._skipBogusClicks){dojo.stopEvent(e);return true;}return false;},colResizeSetup:function(e,_56d){var _56e=dojo.contentBox(e.sourceView.headerNode);if(_56d){this.lineDiv=document.createElement("div");var vw=(dojo.position||dojo._abs)(e.sourceView.headerNode,true);var _56f=dojo.contentBox(e.sourceView.domNode);var l=e.pageX;if(!dojo._isBodyLtr()&&dojo.isIE<8){l-=dojox.html.metrics.getScrollbar().w;}dojo.style(this.lineDiv,{top:vw.y+"px",left:l+"px",height:(_56f.h+_56e.h)+"px"});dojo.addClass(this.lineDiv,"dojoxGridResizeColLine");this.lineDiv._origLeft=l;dojo.body().appendChild(this.lineDiv);}var _570=[],_571=this.tableMap.findOverlappingNodes(e.cellNode);for(var i=0,cell;(cell=_571[i]);i++){_570.push({node:cell,index:this.getCellNodeIndex(cell),width:cell.offsetWidth});}var view=e.sourceView;var adj=dojo._isBodyLtr()?1:-1;var _572=e.grid.views.views;var _573=[];for(var j=view.idx+adj,_574;(_574=_572[j]);j=j+adj){_573.push({node:_574.headerNode,left:window.parseInt(_574.headerNode.style.left)});}var _575=view.headerContentNode.firstChild;var drag={scrollLeft:e.sourceView.headerNode.scrollLeft,view:view,node:e.cellNode,index:e.cellIndex,w:dojo.contentBox(e.cellNode).w,vw:_56e.w,table:_575,tw:dojo.contentBox(_575).w,spanners:_570,followers:_573};return drag;},beginColumnResize:function(e){this.moverDiv=document.createElement("div");dojo.style(this.moverDiv,{position:"absolute",left:0});dojo.body().appendChild(this.moverDiv);dojo.addClass(this.grid.domNode,"dojoxGridColumnResizing");var m=(this.moveable=new dojo.dnd.Moveable(this.moverDiv));var drag=this.colResizeSetup(e,true);m.onMove=dojo.hitch(this,"doResizeColumn",drag);dojo.connect(m,"onMoveStop",dojo.hitch(this,function(){this.endResizeColumn(drag);if(drag.node.releaseCapture){drag.node.releaseCapture();}this.moveable.destroy();delete this.moveable;this.moveable=null;dojo.removeClass(this.grid.domNode,"dojoxGridColumnResizing");}));if(e.cellNode.setCapture){e.cellNode.setCapture();}m.onMouseDown(e);},doResizeColumn:function(_576,_577,_578){var _579=_578.l;var data={deltaX:_579,w:_576.w+(dojo._isBodyLtr()?_579:-_579),vw:_576.vw+_579,tw:_576.tw+_579};this.dragRecord={inDrag:_576,mover:_577,leftTop:_578};if(data.w>=this.minColWidth){if(!_577){this.doResizeNow(_576,data);}else{dojo.style(this.lineDiv,"left",(this.lineDiv._origLeft+data.deltaX)+"px");}}},endResizeColumn:function(_57a){if(this.dragRecord){var _57b=this.dragRecord.leftTop;var _57c=dojo._isBodyLtr()?_57b.l:-_57b.l;_57c+=Math.max(_57a.w+_57c,this.minColWidth)-(_57a.w+_57c);if(dojo.isWebKit&&_57a.spanners.length){_57c+=dojo._getPadBorderExtents(_57a.spanners[0].node).w;}var data={deltaX:_57c,w:_57a.w+_57c,vw:_57a.vw+_57c,tw:_57a.tw+_57c};this.doResizeNow(_57a,data);delete this.dragRecord;}dojo.destroy(this.lineDiv);dojo.destroy(this.moverDiv);dojo.destroy(this.moverDiv);delete this.moverDiv;this._skipBogusClicks=true;_57a.view.update();this._skipBogusClicks=false;this.grid.onResizeColumn(_57a.index);},doResizeNow:function(_57d,data){_57d.view.convertColPctToFixed();if(_57d.view.flexCells&&!_57d.view.testFlexCells()){var t=_54c(_57d.node);if(t){(t.style.width="");}}var i,s,sw,f,fl;for(i=0;(s=_57d.spanners[i]);i++){sw=s.width+data.deltaX;if(sw>0){s.node.style.width=sw+"px";_57d.view.setColWidth(s.index,sw);}}if(dojo._isBodyLtr()||!dojo.isIE){for(i=0;(f=_57d.followers[i]);i++){fl=f.left+data.deltaX;f.node.style.left=fl+"px";}}_57d.node.style.width=data.w+"px";_57d.view.setColWidth(_57d.index,data.w);_57d.view.headerNode.style.width=data.vw+"px";_57d.view.setColumnsWidth(data.tw);if(!dojo._isBodyLtr()){_57d.view.headerNode.scrollLeft=_57d.scrollLeft+data.deltaX;}}});dg._TableMap=dojo.extend(function(rows){this.mapRows(rows);},{map:null,mapRows:function(_57e){var _57f=_57e.length;if(!_57f){return;}this.map=[];var row;for(var k=0;(row=_57e[k]);k++){this.map[k]=[];}for(var j=0;(row=_57e[j]);j++){for(var i=0,x=0,cell,_580,_581;(cell=row[i]);i++){while(this.map[j][x]){x++;}this.map[j][x]={c:i,r:j};_581=cell.rowSpan||1;_580=cell.colSpan||1;for(var y=0;y<_581;y++){for(var s=0;s<_580;s++){this.map[j+y][x+s]=this.map[j][x];}}x+=_580;}}},dumpMap:function(){for(var j=0,row,h="";(row=this.map[j]);j++,h=""){for(var i=0,cell;(cell=row[i]);i++){h+=cell.r+","+cell.c+"   ";}}},getMapCoords:function(_582,_583){for(var j=0,row;(row=this.map[j]);j++){for(var i=0,cell;(cell=row[i]);i++){if(cell.c==_583&&cell.r==_582){return {j:j,i:i};}}}return {j:-1,i:-1};},getNode:function(_584,_585,_586){var row=_584&&_584.rows[_585];return row&&row.cells[_586];},_findOverlappingNodes:function(_587,_588,_589){var _58a=[];var m=this.getMapCoords(_588,_589);for(var j=0,row;(row=this.map[j]);j++){if(j==m.j){continue;}var rw=row[m.i];var n=(rw?this.getNode(_587,rw.r,rw.c):null);if(n){_58a.push(n);}}return _58a;},findOverlappingNodes:function(_58b){return this._findOverlappingNodes(_54c(_58b),_548(_58b.parentNode),_547(_58b));}});})();}if(!dojo._hasResource["dojo.dnd.Container"]){dojo._hasResource["dojo.dnd.Container"]=true;dojo.provide("dojo.dnd.Container");dojo.declare("dojo.dnd.Container",null,{skipForm:false,constructor:function(node,_58c){this.node=dojo.byId(node);if(!_58c){_58c={};}this.creator=_58c.creator||null;this.skipForm=_58c.skipForm;this.parent=_58c.dropParent&&dojo.byId(_58c.dropParent);this.map={};this.current=null;this.containerState="";dojo.addClass(this.node,"dojoDndContainer");if(!(_58c&&_58c._skipStartup)){this.startup();}this.events=[dojo.connect(this.node,"onmouseover",this,"onMouseOver"),dojo.connect(this.node,"onmouseout",this,"onMouseOut"),dojo.connect(this.node,"ondragstart",this,"onSelectStart"),dojo.connect(this.node,"onselectstart",this,"onSelectStart")];},creator:function(){},getItem:function(key){return this.map[key];},setItem:function(key,data){this.map[key]=data;},delItem:function(key){delete this.map[key];},forInItems:function(f,o){o=o||dojo.global;var m=this.map,e=dojo.dnd._empty;for(var i in m){if(i in e){continue;}f.call(o,m[i],i,this);}return o;},clearItems:function(){this.map={};},getAllNodes:function(){return dojo.query("> .dojoDndItem",this.parent);},sync:function(){var map={};this.getAllNodes().forEach(function(node){if(node.id){var item=this.getItem(node.id);if(item){map[node.id]=item;return;}}else{node.id=dojo.dnd.getUniqueId();}var type=node.getAttribute("dndType"),data=node.getAttribute("dndData");map[node.id]={data:data||node.innerHTML,type:type?type.split(/\s*,\s*/):["text"]};},this);this.map=map;return this;},insertNodes:function(data,_58d,_58e){if(!this.parent.firstChild){_58e=null;}else{if(_58d){if(!_58e){_58e=this.parent.firstChild;}}else{if(_58e){_58e=_58e.nextSibling;}}}if(_58e){for(var i=0;i<data.length;++i){var t=this._normalizedCreator(data[i]);this.setItem(t.node.id,{data:t.data,type:t.type});this.parent.insertBefore(t.node,_58e);}}else{for(var i=0;i<data.length;++i){var t=this._normalizedCreator(data[i]);this.setItem(t.node.id,{data:t.data,type:t.type});this.parent.appendChild(t.node);}}return this;},destroy:function(){dojo.forEach(this.events,dojo.disconnect);this.clearItems();this.node=this.parent=this.current=null;},markupFactory:function(_58f,node){_58f._skipStartup=true;return new dojo.dnd.Container(node,_58f);},startup:function(){if(!this.parent){this.parent=this.node;if(this.parent.tagName.toLowerCase()=="table"){var c=this.parent.getElementsByTagName("tbody");if(c&&c.length){this.parent=c[0];}}}this.defaultCreator=dojo.dnd._defaultCreator(this.parent);this.sync();},onMouseOver:function(e){var n=e.relatedTarget;while(n){if(n==this.node){break;}try{n=n.parentNode;}catch(x){n=null;}}if(!n){this._changeState("Container","Over");this.onOverEvent();}n=this._getChildByEvent(e);if(this.current==n){return;}if(this.current){this._removeItemClass(this.current,"Over");}if(n){this._addItemClass(n,"Over");}this.current=n;},onMouseOut:function(e){for(var n=e.relatedTarget;n;){if(n==this.node){return;}try{n=n.parentNode;}catch(x){n=null;}}if(this.current){this._removeItemClass(this.current,"Over");this.current=null;}this._changeState("Container","");this.onOutEvent();},onSelectStart:function(e){if(!this.skipForm||!dojo.dnd.isFormElement(e)){dojo.stopEvent(e);}},onOverEvent:function(){},onOutEvent:function(){},_changeState:function(type,_590){var _591="dojoDnd"+type;var _592=type.toLowerCase()+"State";dojo.replaceClass(this.node,_591+_590,_591+this[_592]);this[_592]=_590;},_addItemClass:function(node,type){dojo.addClass(node,"dojoDndItem"+type);},_removeItemClass:function(node,type){dojo.removeClass(node,"dojoDndItem"+type);},_getChildByEvent:function(e){var node=e.target;if(node){for(var _593=node.parentNode;_593;node=_593,_593=node.parentNode){if(_593==this.parent&&dojo.hasClass(node,"dojoDndItem")){return node;}}}return null;},_normalizedCreator:function(item,hint){var t=(this.creator||this.defaultCreator).call(this,item,hint);if(!dojo.isArray(t.type)){t.type=["text"];}if(!t.node.id){t.node.id=dojo.dnd.getUniqueId();}dojo.addClass(t.node,"dojoDndItem");return t;}});dojo.dnd._createNode=function(tag){if(!tag){return dojo.dnd._createSpan;}return function(text){return dojo.create(tag,{innerHTML:text});};};dojo.dnd._createTrTd=function(text){var tr=dojo.create("tr");dojo.create("td",{innerHTML:text},tr);return tr;};dojo.dnd._createSpan=function(text){return dojo.create("span",{innerHTML:text});};dojo.dnd._defaultCreatorNodes={ul:"li",ol:"li",div:"div",p:"div"};dojo.dnd._defaultCreator=function(node){var tag=node.tagName.toLowerCase();var c=tag=="tbody"||tag=="thead"?dojo.dnd._createTrTd:dojo.dnd._createNode(dojo.dnd._defaultCreatorNodes[tag]);return function(item,hint){var _594=item&&dojo.isObject(item),data,type,n;if(_594&&item.tagName&&item.nodeType&&item.getAttribute){data=item.getAttribute("dndData")||item.innerHTML;type=item.getAttribute("dndType");type=type?type.split(/\s*,\s*/):["text"];n=item;}else{data=(_594&&item.data)?item.data:item;type=(_594&&item.type)?item.type:["text"];n=(hint=="avatar"?dojo.dnd._createSpan:c)(String(data));}if(!n.id){n.id=dojo.dnd.getUniqueId();}return {node:n,data:data,type:type};};};}if(!dojo._hasResource["dojo.dnd.Selector"]){dojo._hasResource["dojo.dnd.Selector"]=true;dojo.provide("dojo.dnd.Selector");dojo.declare("dojo.dnd.Selector",dojo.dnd.Container,{constructor:function(node,_595){if(!_595){_595={};}this.singular=_595.singular;this.autoSync=_595.autoSync;this.selection={};this.anchor=null;this.simpleSelection=false;this.events.push(dojo.connect(this.node,"onmousedown",this,"onMouseDown"),dojo.connect(this.node,"onmouseup",this,"onMouseUp"));},singular:false,getSelectedNodes:function(){var t=new dojo.NodeList();var e=dojo.dnd._empty;for(var i in this.selection){if(i in e){continue;}t.push(dojo.byId(i));}return t;},selectNone:function(){return this._removeSelection()._removeAnchor();},selectAll:function(){this.forInItems(function(data,id){this._addItemClass(dojo.byId(id),"Selected");this.selection[id]=1;},this);return this._removeAnchor();},deleteSelectedNodes:function(){var e=dojo.dnd._empty;for(var i in this.selection){if(i in e){continue;}var n=dojo.byId(i);this.delItem(i);dojo.destroy(n);}this.anchor=null;this.selection={};return this;},forInSelectedItems:function(f,o){o=o||dojo.global;var s=this.selection,e=dojo.dnd._empty;for(var i in s){if(i in e){continue;}f.call(o,this.getItem(i),i,this);}},sync:function(){dojo.dnd.Selector.superclass.sync.call(this);if(this.anchor){if(!this.getItem(this.anchor.id)){this.anchor=null;}}var t=[],e=dojo.dnd._empty;for(var i in this.selection){if(i in e){continue;}if(!this.getItem(i)){t.push(i);}}dojo.forEach(t,function(i){delete this.selection[i];},this);return this;},insertNodes:function(_596,data,_597,_598){var _599=this._normalizedCreator;this._normalizedCreator=function(item,hint){var t=_599.call(this,item,hint);if(_596){if(!this.anchor){this.anchor=t.node;this._removeItemClass(t.node,"Selected");this._addItemClass(this.anchor,"Anchor");}else{if(this.anchor!=t.node){this._removeItemClass(t.node,"Anchor");this._addItemClass(t.node,"Selected");}}this.selection[t.node.id]=1;}else{this._removeItemClass(t.node,"Selected");this._removeItemClass(t.node,"Anchor");}return t;};dojo.dnd.Selector.superclass.insertNodes.call(this,data,_597,_598);this._normalizedCreator=_599;return this;},destroy:function(){dojo.dnd.Selector.superclass.destroy.call(this);this.selection=this.anchor=null;},markupFactory:function(_59a,node){_59a._skipStartup=true;return new dojo.dnd.Selector(node,_59a);},onMouseDown:function(e){if(this.autoSync){this.sync();}if(!this.current){return;}if(!this.singular&&!dojo.isCopyKey(e)&&!e.shiftKey&&(this.current.id in this.selection)){this.simpleSelection=true;if(e.button===dojo.mouseButtons.LEFT){dojo.stopEvent(e);}return;}if(!this.singular&&e.shiftKey){if(!dojo.isCopyKey(e)){this._removeSelection();}var c=this.getAllNodes();if(c.length){if(!this.anchor){this.anchor=c[0];this._addItemClass(this.anchor,"Anchor");}this.selection[this.anchor.id]=1;if(this.anchor!=this.current){var i=0;for(;i<c.length;++i){var node=c[i];if(node==this.anchor||node==this.current){break;}}for(++i;i<c.length;++i){var node=c[i];if(node==this.anchor||node==this.current){break;}this._addItemClass(node,"Selected");this.selection[node.id]=1;}this._addItemClass(this.current,"Selected");this.selection[this.current.id]=1;}}}else{if(this.singular){if(this.anchor==this.current){if(dojo.isCopyKey(e)){this.selectNone();}}else{this.selectNone();this.anchor=this.current;this._addItemClass(this.anchor,"Anchor");this.selection[this.current.id]=1;}}else{if(dojo.isCopyKey(e)){if(this.anchor==this.current){delete this.selection[this.anchor.id];this._removeAnchor();}else{if(this.current.id in this.selection){this._removeItemClass(this.current,"Selected");delete this.selection[this.current.id];}else{if(this.anchor){this._removeItemClass(this.anchor,"Anchor");this._addItemClass(this.anchor,"Selected");}this.anchor=this.current;this._addItemClass(this.current,"Anchor");this.selection[this.current.id]=1;}}}else{if(!(this.current.id in this.selection)){this.selectNone();this.anchor=this.current;this._addItemClass(this.current,"Anchor");this.selection[this.current.id]=1;}}}}dojo.stopEvent(e);},onMouseUp:function(e){if(!this.simpleSelection){return;}this.simpleSelection=false;this.selectNone();if(this.current){this.anchor=this.current;this._addItemClass(this.anchor,"Anchor");this.selection[this.current.id]=1;}},onMouseMove:function(e){this.simpleSelection=false;},onOverEvent:function(){this.onmousemoveEvent=dojo.connect(this.node,"onmousemove",this,"onMouseMove");},onOutEvent:function(){dojo.disconnect(this.onmousemoveEvent);delete this.onmousemoveEvent;},_removeSelection:function(){var e=dojo.dnd._empty;for(var i in this.selection){if(i in e){continue;}var node=dojo.byId(i);if(node){this._removeItemClass(node,"Selected");}}this.selection={};return this;},_removeAnchor:function(){if(this.anchor){this._removeItemClass(this.anchor,"Anchor");this.anchor=null;}return this;}});}if(!dojo._hasResource["dojo.dnd.Avatar"]){dojo._hasResource["dojo.dnd.Avatar"]=true;dojo.provide("dojo.dnd.Avatar");dojo.declare("dojo.dnd.Avatar",null,{constructor:function(_59b){this.manager=_59b;this.construct();},construct:function(){this.isA11y=dojo.hasClass(dojo.body(),"dijit_a11y");var a=dojo.create("table",{"class":"dojoDndAvatar",style:{position:"absolute",zIndex:"1999",margin:"0px"}}),_59c=this.manager.source,node,b=dojo.create("tbody",null,a),tr=dojo.create("tr",null,b),td=dojo.create("td",null,tr),icon=this.isA11y?dojo.create("span",{id:"a11yIcon",innerHTML:this.manager.copy?"+":"<"},td):null,span=dojo.create("span",{innerHTML:_59c.generateText?this._generateText():""},td),k=Math.min(5,this.manager.nodes.length),i=0;dojo.attr(tr,{"class":"dojoDndAvatarHeader",style:{opacity:0.9}});for(;i<k;++i){if(_59c.creator){node=_59c._normalizedCreator(_59c.getItem(this.manager.nodes[i].id).data,"avatar").node;}else{node=this.manager.nodes[i].cloneNode(true);if(node.tagName.toLowerCase()=="tr"){var _59d=dojo.create("table"),_59e=dojo.create("tbody",null,_59d);_59e.appendChild(node);node=_59d;}}node.id="";tr=dojo.create("tr",null,b);td=dojo.create("td",null,tr);td.appendChild(node);dojo.attr(tr,{"class":"dojoDndAvatarItem",style:{opacity:(9-i)/10}});}this.node=a;},destroy:function(){dojo.destroy(this.node);this.node=false;},update:function(){dojo[(this.manager.canDropFlag?"add":"remove")+"Class"](this.node,"dojoDndAvatarCanDrop");if(this.isA11y){var icon=dojo.byId("a11yIcon");var text="+";if(this.manager.canDropFlag&&!this.manager.copy){text="< ";}else{if(!this.manager.canDropFlag&&!this.manager.copy){text="o";}else{if(!this.manager.canDropFlag){text="x";}}}icon.innerHTML=text;}dojo.query(("tr.dojoDndAvatarHeader td span"+(this.isA11y?" span":"")),this.node).forEach(function(node){node.innerHTML=this._generateText();},this);},_generateText:function(){return this.manager.nodes.length.toString();}});}if(!dojo._hasResource["dojo.dnd.Manager"]){dojo._hasResource["dojo.dnd.Manager"]=true;dojo.provide("dojo.dnd.Manager");dojo.declare("dojo.dnd.Manager",null,{constructor:function(){this.avatar=null;this.source=null;this.nodes=[];this.copy=true;this.target=null;this.canDropFlag=false;this.events=[];},OFFSET_X:16,OFFSET_Y:16,overSource:function(_59f){if(this.avatar){this.target=(_59f&&_59f.targetState!="Disabled")?_59f:null;this.canDropFlag=Boolean(this.target);this.avatar.update();}dojo.publish("/dnd/source/over",[_59f]);},outSource:function(_5a0){if(this.avatar){if(this.target==_5a0){this.target=null;this.canDropFlag=false;this.avatar.update();dojo.publish("/dnd/source/over",[null]);}}else{dojo.publish("/dnd/source/over",[null]);}},startDrag:function(_5a1,_5a2,copy){this.source=_5a1;this.nodes=_5a2;this.copy=Boolean(copy);this.avatar=this.makeAvatar();dojo.body().appendChild(this.avatar.node);dojo.publish("/dnd/start",[_5a1,_5a2,this.copy]);this.events=[dojo.connect(dojo.doc,"onmousemove",this,"onMouseMove"),dojo.connect(dojo.doc,"onmouseup",this,"onMouseUp"),dojo.connect(dojo.doc,"onkeydown",this,"onKeyDown"),dojo.connect(dojo.doc,"onkeyup",this,"onKeyUp"),dojo.connect(dojo.doc,"ondragstart",dojo.stopEvent),dojo.connect(dojo.body(),"onselectstart",dojo.stopEvent)];var c="dojoDnd"+(copy?"Copy":"Move");dojo.addClass(dojo.body(),c);},canDrop:function(flag){var _5a3=Boolean(this.target&&flag);if(this.canDropFlag!=_5a3){this.canDropFlag=_5a3;this.avatar.update();}},stopDrag:function(){dojo.removeClass(dojo.body(),["dojoDndCopy","dojoDndMove"]);dojo.forEach(this.events,dojo.disconnect);this.events=[];this.avatar.destroy();this.avatar=null;this.source=this.target=null;this.nodes=[];},makeAvatar:function(){return new dojo.dnd.Avatar(this);},updateAvatar:function(){this.avatar.update();},onMouseMove:function(e){var a=this.avatar;if(a){dojo.dnd.autoScrollNodes(e);var s=a.node.style;s.left=(e.pageX+this.OFFSET_X)+"px";s.top=(e.pageY+this.OFFSET_Y)+"px";var copy=Boolean(this.source.copyState(dojo.isCopyKey(e)));if(this.copy!=copy){this._setCopyStatus(copy);}}},onMouseUp:function(e){if(this.avatar){if(this.target&&this.canDropFlag){var copy=Boolean(this.source.copyState(dojo.isCopyKey(e))),_5a4=[this.source,this.nodes,copy,this.target,e];dojo.publish("/dnd/drop/before",_5a4);dojo.publish("/dnd/drop",_5a4);}else{dojo.publish("/dnd/cancel");}this.stopDrag();}},onKeyDown:function(e){if(this.avatar){switch(e.keyCode){case dojo.keys.CTRL:var copy=Boolean(this.source.copyState(true));if(this.copy!=copy){this._setCopyStatus(copy);}break;case dojo.keys.ESCAPE:dojo.publish("/dnd/cancel");this.stopDrag();break;}}},onKeyUp:function(e){if(this.avatar&&e.keyCode==dojo.keys.CTRL){var copy=Boolean(this.source.copyState(false));if(this.copy!=copy){this._setCopyStatus(copy);}}},_setCopyStatus:function(copy){this.copy=copy;this.source._markDndStatus(this.copy);this.updateAvatar();dojo.replaceClass(dojo.body(),"dojoDnd"+(this.copy?"Copy":"Move"),"dojoDnd"+(this.copy?"Move":"Copy"));}});dojo.dnd._manager=null;dojo.dnd.manager=function(){if(!dojo.dnd._manager){dojo.dnd._manager=new dojo.dnd.Manager();}return dojo.dnd._manager;};}if(!dojo._hasResource["dojo.dnd.Source"]){dojo._hasResource["dojo.dnd.Source"]=true;dojo.provide("dojo.dnd.Source");dojo.declare("dojo.dnd.Source",dojo.dnd.Selector,{isSource:true,horizontal:false,copyOnly:false,selfCopy:false,selfAccept:true,skipForm:false,withHandles:false,autoSync:false,delay:0,accept:["text"],generateText:true,constructor:function(node,_5a5){dojo.mixin(this,dojo.mixin({},_5a5));var type=this.accept;if(type.length){this.accept={};for(var i=0;i<type.length;++i){this.accept[type[i]]=1;}}this.isDragging=false;this.mouseDown=false;this.targetAnchor=null;this.targetBox=null;this.before=true;this._lastX=0;this._lastY=0;this.sourceState="";if(this.isSource){dojo.addClass(this.node,"dojoDndSource");}this.targetState="";if(this.accept){dojo.addClass(this.node,"dojoDndTarget");}if(this.horizontal){dojo.addClass(this.node,"dojoDndHorizontal");}this.topics=[dojo.subscribe("/dnd/source/over",this,"onDndSourceOver"),dojo.subscribe("/dnd/start",this,"onDndStart"),dojo.subscribe("/dnd/drop",this,"onDndDrop"),dojo.subscribe("/dnd/cancel",this,"onDndCancel")];},checkAcceptance:function(_5a6,_5a7){if(this==_5a6){return !this.copyOnly||this.selfAccept;}for(var i=0;i<_5a7.length;++i){var type=_5a6.getItem(_5a7[i].id).type;var flag=false;for(var j=0;j<type.length;++j){if(type[j] in this.accept){flag=true;break;}}if(!flag){return false;}}return true;},copyState:function(_5a8,self){if(_5a8){return true;}if(arguments.length<2){self=this==dojo.dnd.manager().target;}if(self){if(this.copyOnly){return this.selfCopy;}}else{return this.copyOnly;}return false;},destroy:function(){dojo.dnd.Source.superclass.destroy.call(this);dojo.forEach(this.topics,dojo.unsubscribe);this.targetAnchor=null;},markupFactory:function(_5a9,node){_5a9._skipStartup=true;return new dojo.dnd.Source(node,_5a9);},onMouseMove:function(e){if(this.isDragging&&this.targetState=="Disabled"){return;}dojo.dnd.Source.superclass.onMouseMove.call(this,e);var m=dojo.dnd.manager();if(!this.isDragging){if(this.mouseDown&&this.isSource&&(Math.abs(e.pageX-this._lastX)>this.delay||Math.abs(e.pageY-this._lastY)>this.delay)){var _5aa=this.getSelectedNodes();if(_5aa.length){m.startDrag(this,_5aa,this.copyState(dojo.isCopyKey(e),true));}}}if(this.isDragging){var _5ab=false;if(this.current){if(!this.targetBox||this.targetAnchor!=this.current){this.targetBox=dojo.position(this.current,true);}if(this.horizontal){_5ab=(e.pageX-this.targetBox.x)<(this.targetBox.w/2);}else{_5ab=(e.pageY-this.targetBox.y)<(this.targetBox.h/2);}}if(this.current!=this.targetAnchor||_5ab!=this.before){this._markTargetAnchor(_5ab);m.canDrop(!this.current||m.source!=this||!(this.current.id in this.selection));}}},onMouseDown:function(e){if(!this.mouseDown&&this._legalMouseDown(e)&&(!this.skipForm||!dojo.dnd.isFormElement(e))){this.mouseDown=true;this._lastX=e.pageX;this._lastY=e.pageY;dojo.dnd.Source.superclass.onMouseDown.call(this,e);}},onMouseUp:function(e){if(this.mouseDown){this.mouseDown=false;dojo.dnd.Source.superclass.onMouseUp.call(this,e);}},onDndSourceOver:function(_5ac){if(this!=_5ac){this.mouseDown=false;if(this.targetAnchor){this._unmarkTargetAnchor();}}else{if(this.isDragging){var m=dojo.dnd.manager();m.canDrop(this.targetState!="Disabled"&&(!this.current||m.source!=this||!(this.current.id in this.selection)));}}},onDndStart:function(_5ad,_5ae,copy){if(this.autoSync){this.sync();}if(this.isSource){this._changeState("Source",this==_5ad?(copy?"Copied":"Moved"):"");}var _5af=this.accept&&this.checkAcceptance(_5ad,_5ae);this._changeState("Target",_5af?"":"Disabled");if(this==_5ad){dojo.dnd.manager().overSource(this);}this.isDragging=true;},onDndDrop:function(_5b0,_5b1,copy,_5b2){if(this==_5b2){this.onDrop(_5b0,_5b1,copy);}this.onDndCancel();},onDndCancel:function(){if(this.targetAnchor){this._unmarkTargetAnchor();this.targetAnchor=null;}this.before=true;this.isDragging=false;this.mouseDown=false;this._changeState("Source","");this._changeState("Target","");},onDrop:function(_5b3,_5b4,copy){if(this!=_5b3){this.onDropExternal(_5b3,_5b4,copy);}else{this.onDropInternal(_5b4,copy);}},onDropExternal:function(_5b5,_5b6,copy){var _5b7=this._normalizedCreator;if(this.creator){this._normalizedCreator=function(node,hint){return _5b7.call(this,_5b5.getItem(node.id).data,hint);};}else{if(copy){this._normalizedCreator=function(node,hint){var t=_5b5.getItem(node.id);var n=node.cloneNode(true);n.id=dojo.dnd.getUniqueId();return {node:n,data:t.data,type:t.type};};}else{this._normalizedCreator=function(node,hint){var t=_5b5.getItem(node.id);_5b5.delItem(node.id);return {node:node,data:t.data,type:t.type};};}}this.selectNone();if(!copy&&!this.creator){_5b5.selectNone();}this.insertNodes(true,_5b6,this.before,this.current);if(!copy&&this.creator){_5b5.deleteSelectedNodes();}this._normalizedCreator=_5b7;},onDropInternal:function(_5b8,copy){var _5b9=this._normalizedCreator;if(this.current&&this.current.id in this.selection){return;}if(copy){if(this.creator){this._normalizedCreator=function(node,hint){return _5b9.call(this,this.getItem(node.id).data,hint);};}else{this._normalizedCreator=function(node,hint){var t=this.getItem(node.id);var n=node.cloneNode(true);n.id=dojo.dnd.getUniqueId();return {node:n,data:t.data,type:t.type};};}}else{if(!this.current){return;}this._normalizedCreator=function(node,hint){var t=this.getItem(node.id);return {node:node,data:t.data,type:t.type};};}this._removeSelection();this.insertNodes(true,_5b8,this.before,this.current);this._normalizedCreator=_5b9;},onDraggingOver:function(){},onDraggingOut:function(){},onOverEvent:function(){dojo.dnd.Source.superclass.onOverEvent.call(this);dojo.dnd.manager().overSource(this);if(this.isDragging&&this.targetState!="Disabled"){this.onDraggingOver();}},onOutEvent:function(){dojo.dnd.Source.superclass.onOutEvent.call(this);dojo.dnd.manager().outSource(this);if(this.isDragging&&this.targetState!="Disabled"){this.onDraggingOut();}},_markTargetAnchor:function(_5ba){if(this.current==this.targetAnchor&&this.before==_5ba){return;}if(this.targetAnchor){this._removeItemClass(this.targetAnchor,this.before?"Before":"After");}this.targetAnchor=this.current;this.targetBox=null;this.before=_5ba;if(this.targetAnchor){this._addItemClass(this.targetAnchor,this.before?"Before":"After");}},_unmarkTargetAnchor:function(){if(!this.targetAnchor){return;}this._removeItemClass(this.targetAnchor,this.before?"Before":"After");this.targetAnchor=null;this.targetBox=null;this.before=true;},_markDndStatus:function(copy){this._changeState("Source",copy?"Copied":"Moved");},_legalMouseDown:function(e){if(!dojo.mouseButtons.isLeft(e)){return false;}if(!this.withHandles){return true;}for(var node=e.target;node&&node!==this.node;node=node.parentNode){if(dojo.hasClass(node,"dojoDndHandle")){return true;}if(dojo.hasClass(node,"dojoDndItem")||dojo.hasClass(node,"dojoDndIgnore")){break;}}return false;}});dojo.declare("dojo.dnd.Target",dojo.dnd.Source,{constructor:function(node,_5bb){this.isSource=false;dojo.removeClass(this.node,"dojoDndSource");},markupFactory:function(_5bc,node){_5bc._skipStartup=true;return new dojo.dnd.Target(node,_5bc);}});dojo.declare("dojo.dnd.AutoSource",dojo.dnd.Source,{constructor:function(node,_5bd){this.autoSync=true;},markupFactory:function(_5be,node){_5be._skipStartup=true;return new dojo.dnd.AutoSource(node,_5be);}});}if(!dojo._hasResource["dojox.grid._View"]){dojo._hasResource["dojox.grid._View"]=true;dojo.provide("dojox.grid._View");(function(){var _5bf=function(_5c0,_5c1){return _5c0.style.cssText==undefined?_5c0.getAttribute("style"):_5c0.style.cssText;};dojo.declare("dojox.grid._View",[dijit._Widget,dijit._Templated],{defaultWidth:"18em",viewWidth:"",templateString:"<div class=\"dojoxGridView\" role=\"presentation\">\r\n\t<div class=\"dojoxGridHeader\" dojoAttachPoint=\"headerNode\" role=\"presentation\">\r\n\t\t<div dojoAttachPoint=\"headerNodeContainer\" style=\"width:9000em\" role=\"presentation\">\r\n\t\t\t<div dojoAttachPoint=\"headerContentNode\" role=\"row\"></div>\r\n\t\t</div>\r\n\t</div>\r\n\t<input type=\"checkbox\" class=\"dojoxGridHiddenFocus\" dojoAttachPoint=\"hiddenFocusNode\" role=\"presentation\" />\r\n\t<input type=\"checkbox\" class=\"dojoxGridHiddenFocus\" role=\"presentation\" />\r\n\t<div class=\"dojoxGridScrollbox\" dojoAttachPoint=\"scrollboxNode\" role=\"presentation\">\r\n\t\t<div class=\"dojoxGridContent\" dojoAttachPoint=\"contentNode\" hidefocus=\"hidefocus\" role=\"presentation\"></div>\r\n\t</div>\r\n</div>\r\n",themeable:false,classTag:"dojoxGrid",marginBottom:0,rowPad:2,_togglingColumn:-1,_headerBuilderClass:dojox.grid._HeaderBuilder,_contentBuilderClass:dojox.grid._ContentBuilder,postMixInProperties:function(){this.rowNodes={};},postCreate:function(){this.connect(this.scrollboxNode,"onscroll","doscroll");dojox.grid.util.funnelEvents(this.contentNode,this,"doContentEvent",["mouseover","mouseout","click","dblclick","contextmenu","mousedown"]);dojox.grid.util.funnelEvents(this.headerNode,this,"doHeaderEvent",["dblclick","mouseover","mouseout","mousemove","mousedown","click","contextmenu"]);this.content=new this._contentBuilderClass(this);this.header=new this._headerBuilderClass(this);if(!dojo._isBodyLtr()){this.headerNodeContainer.style.width="";}},destroy:function(){dojo.destroy(this.headerNode);delete this.headerNode;for(var i in this.rowNodes){dojo.destroy(this.rowNodes[i]);}this.rowNodes={};if(this.source){this.source.destroy();}this.inherited(arguments);},focus:function(){if(dojo.isIE||dojo.isWebKit||dojo.isOpera){this.hiddenFocusNode.focus();}else{this.scrollboxNode.focus();}},setStructure:function(_5c2){var vs=(this.structure=_5c2);if(vs.width&&!isNaN(vs.width)){this.viewWidth=vs.width+"em";}else{this.viewWidth=vs.width||(vs.noscroll?"auto":this.viewWidth);}this._onBeforeRow=vs.onBeforeRow||function(){};this._onAfterRow=vs.onAfterRow||function(){};this.noscroll=vs.noscroll;if(this.noscroll){this.scrollboxNode.style.overflow="hidden";}this.simpleStructure=Boolean(vs.cells.length==1);this.testFlexCells();this.updateStructure();},_cleanupRowWidgets:function(_5c3){if(_5c3){dojo.forEach(dojo.query("[widgetId]",_5c3).map(dijit.byNode),function(w){if(w._destroyOnRemove){w.destroy();delete w;}else{if(w.domNode&&w.domNode.parentNode){w.domNode.parentNode.removeChild(w.domNode);}}});}},onBeforeRow:function(_5c4,_5c5){this._onBeforeRow(_5c4,_5c5);if(_5c4>=0){this._cleanupRowWidgets(this.getRowNode(_5c4));}},onAfterRow:function(_5c6,_5c7,_5c8){this._onAfterRow(_5c6,_5c7,_5c8);var g=this.grid;dojo.forEach(dojo.query(".dojoxGridStubNode",_5c8),function(n){if(n&&n.parentNode){var lw=n.getAttribute("linkWidget");var _5c9=window.parseInt(dojo.attr(n,"cellIdx"),10);var _5ca=g.getCell(_5c9);var w=dijit.byId(lw);if(w){n.parentNode.replaceChild(w.domNode,n);if(!w._started){w.startup();}}else{n.innerHTML="";}}},this);},testFlexCells:function(){this.flexCells=false;for(var j=0,row;(row=this.structure.cells[j]);j++){for(var i=0,cell;(cell=row[i]);i++){cell.view=this;this.flexCells=this.flexCells||cell.isFlex();}}return this.flexCells;},updateStructure:function(){this.header.update();this.content.update();},getScrollbarWidth:function(){var _5cb=this.hasVScrollbar();var _5cc=dojo.style(this.scrollboxNode,"overflow");if(this.noscroll||!_5cc||_5cc=="hidden"){_5cb=false;}else{if(_5cc=="scroll"){_5cb=true;}}return (_5cb?dojox.html.metrics.getScrollbar().w:0);},getColumnsWidth:function(){var h=this.headerContentNode;return h&&h.firstChild?h.firstChild.offsetWidth:0;},setColumnsWidth:function(_5cd){this.headerContentNode.firstChild.style.width=_5cd+"px";if(this.viewWidth){this.viewWidth=_5cd+"px";}},getWidth:function(){return this.viewWidth||(this.getColumnsWidth()+this.getScrollbarWidth())+"px";},getContentWidth:function(){return Math.max(0,dojo._getContentBox(this.domNode).w-this.getScrollbarWidth())+"px";},render:function(){this.scrollboxNode.style.height="";this.renderHeader();if(this._togglingColumn>=0){this.setColumnsWidth(this.getColumnsWidth()-this._togglingColumn);this._togglingColumn=-1;}var _5ce=this.grid.layout.cells;var _5cf=dojo.hitch(this,function(node,_5d0){!dojo._isBodyLtr()&&(_5d0=!_5d0);var inc=_5d0?-1:1;var idx=this.header.getCellNodeIndex(node)+inc;var cell=_5ce[idx];while(cell&&cell.getHeaderNode()&&cell.getHeaderNode().style.display=="none"){idx+=inc;cell=_5ce[idx];}if(cell){return cell.getHeaderNode();}return null;});if(this.grid.columnReordering&&this.simpleStructure){if(this.source){this.source.destroy();}var _5d1="dojoxGrid_bottomMarker";var _5d2="dojoxGrid_topMarker";if(this.bottomMarker){dojo.destroy(this.bottomMarker);}this.bottomMarker=dojo.byId(_5d1);if(this.topMarker){dojo.destroy(this.topMarker);}this.topMarker=dojo.byId(_5d2);if(!this.bottomMarker){this.bottomMarker=dojo.create("div",{"id":_5d1,"class":"dojoxGridColPlaceBottom"},dojo.body());this._hide(this.bottomMarker);this.topMarker=dojo.create("div",{"id":_5d2,"class":"dojoxGridColPlaceTop"},dojo.body());this._hide(this.topMarker);}this.arrowDim=dojo.contentBox(this.bottomMarker);var _5d3=dojo.contentBox(this.headerContentNode.firstChild.rows[0]).h;this.source=new dojo.dnd.Source(this.headerContentNode.firstChild.rows[0],{horizontal:true,accept:["gridColumn_"+this.grid.id],viewIndex:this.index,generateText:false,onMouseDown:dojo.hitch(this,function(e){this.header.decorateEvent(e);if((this.header.overRightResizeArea(e)||this.header.overLeftResizeArea(e))&&this.header.canResize(e)&&!this.header.moveable){this.header.beginColumnResize(e);}else{if(this.grid.headerMenu){this.grid.headerMenu.onCancel(true);}if(e.button===(dojo.isIE?1:0)){dojo.dnd.Source.prototype.onMouseDown.call(this.source,e);}}}),onMouseOver:dojo.hitch(this,function(e){var src=this.source;if(src._getChildByEvent(e)){dojo.dnd.Source.prototype.onMouseOver.apply(src,arguments);}}),_markTargetAnchor:dojo.hitch(this,function(_5d4){var src=this.source;if(src.current==src.targetAnchor&&src.before==_5d4){return;}if(src.targetAnchor&&_5cf(src.targetAnchor,src.before)){src._removeItemClass(_5cf(src.targetAnchor,src.before),src.before?"After":"Before");}dojo.dnd.Source.prototype._markTargetAnchor.call(src,_5d4);var _5d5=_5d4?src.targetAnchor:_5cf(src.targetAnchor,src.before);var _5d6=0;if(!_5d5){_5d5=src.targetAnchor;_5d6=dojo.contentBox(_5d5).w+this.arrowDim.w/2+2;}var pos=(dojo.position||dojo._abs)(_5d5,true);var left=Math.floor(pos.x-this.arrowDim.w/2+_5d6);dojo.style(this.bottomMarker,"visibility","visible");dojo.style(this.topMarker,"visibility","visible");dojo.style(this.bottomMarker,{"left":left+"px","top":(_5d3+pos.y)+"px"});dojo.style(this.topMarker,{"left":left+"px","top":(pos.y-this.arrowDim.h)+"px"});if(src.targetAnchor&&_5cf(src.targetAnchor,src.before)){src._addItemClass(_5cf(src.targetAnchor,src.before),src.before?"After":"Before");}}),_unmarkTargetAnchor:dojo.hitch(this,function(){var src=this.source;if(!src.targetAnchor){return;}if(src.targetAnchor&&_5cf(src.targetAnchor,src.before)){src._removeItemClass(_5cf(src.targetAnchor,src.before),src.before?"After":"Before");}this._hide(this.bottomMarker);this._hide(this.topMarker);dojo.dnd.Source.prototype._unmarkTargetAnchor.call(src);}),destroy:dojo.hitch(this,function(){dojo.disconnect(this._source_conn);dojo.unsubscribe(this._source_sub);dojo.dnd.Source.prototype.destroy.call(this.source);if(this.bottomMarker){dojo.destroy(this.bottomMarker);delete this.bottomMarker;}if(this.topMarker){dojo.destroy(this.topMarker);delete this.topMarker;}}),onDndCancel:dojo.hitch(this,function(){dojo.dnd.Source.prototype.onDndCancel.call(this.source);this._hide(this.bottomMarker);this._hide(this.topMarker);})});this._source_conn=dojo.connect(this.source,"onDndDrop",this,"_onDndDrop");this._source_sub=dojo.subscribe("/dnd/drop/before",this,"_onDndDropBefore");this.source.startup();}},_hide:function(node){dojo.style(node,{left:"-10000px",top:"-10000px","visibility":"hidden"});},_onDndDropBefore:function(_5d7,_5d8,copy){if(dojo.dnd.manager().target!==this.source){return;}this.source._targetNode=this.source.targetAnchor;this.source._beforeTarget=this.source.before;var _5d9=this.grid.views.views;var _5da=_5d9[_5d7.viewIndex];var _5db=_5d9[this.index];if(_5db!=_5da){_5da.convertColPctToFixed();_5db.convertColPctToFixed();}},_onDndDrop:function(_5dc,_5dd,copy){if(dojo.dnd.manager().target!==this.source){if(dojo.dnd.manager().source===this.source){this._removingColumn=true;}return;}this._hide(this.bottomMarker);this._hide(this.topMarker);var _5de=function(n){return n?dojo.attr(n,"idx"):null;};var w=dojo.marginBox(_5dd[0]).w;if(_5dc.viewIndex!==this.index){var _5df=this.grid.views.views;var _5e0=_5df[_5dc.viewIndex];var _5e1=_5df[this.index];if(_5e0.viewWidth&&_5e0.viewWidth!="auto"){_5e0.setColumnsWidth(_5e0.getColumnsWidth()-w);}if(_5e1.viewWidth&&_5e1.viewWidth!="auto"){_5e1.setColumnsWidth(_5e1.getColumnsWidth());}}var stn=this.source._targetNode;var stb=this.source._beforeTarget;!dojo._isBodyLtr()&&(stb=!stb);var _5e2=this.grid.layout;var idx=this.index;delete this.source._targetNode;delete this.source._beforeTarget;_5e2.moveColumn(_5dc.viewIndex,idx,_5de(_5dd[0]),_5de(stn),stb);},renderHeader:function(){this.headerContentNode.innerHTML=this.header.generateHtml(this._getHeaderContent);if(this.flexCells){this.contentWidth=this.getContentWidth();this.headerContentNode.firstChild.style.width=this.contentWidth;}dojox.grid.util.fire(this,"onAfterRow",[-1,this.structure.cells,this.headerContentNode]);},_getHeaderContent:function(_5e3){var n=_5e3.name||_5e3.grid.getCellName(_5e3);var ret=["<div class=\"dojoxGridSortNode"];if(_5e3.index!=_5e3.grid.getSortIndex()){ret.push("\">");}else{ret=ret.concat([" ",_5e3.grid.sortInfo>0?"dojoxGridSortUp":"dojoxGridSortDown","\"><div class=\"dojoxGridArrowButtonChar\">",_5e3.grid.sortInfo>0?"&#9650;":"&#9660;","</div><div class=\"dojoxGridArrowButtonNode\" role=\"presentation\"></div>","<div class=\"dojoxGridColCaption\">"]);}ret=ret.concat([n,"</div></div>"]);return ret.join("");},resize:function(){this.adaptHeight();this.adaptWidth();},hasHScrollbar:function(_5e4){var _5e5=this._hasHScroll||false;if(this._hasHScroll==undefined||_5e4){if(this.noscroll){this._hasHScroll=false;}else{var _5e6=dojo.style(this.scrollboxNode,"overflow");if(_5e6=="hidden"){this._hasHScroll=false;}else{if(_5e6=="scroll"){this._hasHScroll=true;}else{this._hasHScroll=(this.scrollboxNode.offsetWidth-this.getScrollbarWidth()<this.contentNode.offsetWidth);}}}}if(_5e5!==this._hasHScroll){this.grid.update();}return this._hasHScroll;},hasVScrollbar:function(_5e7){var _5e8=this._hasVScroll||false;if(this._hasVScroll==undefined||_5e7){if(this.noscroll){this._hasVScroll=false;}else{var _5e9=dojo.style(this.scrollboxNode,"overflow");if(_5e9=="hidden"){this._hasVScroll=false;}else{if(_5e9=="scroll"){this._hasVScroll=true;}else{this._hasVScroll=(this.scrollboxNode.scrollHeight>this.scrollboxNode.clientHeight);}}}}if(_5e8!==this._hasVScroll){this.grid.update();}return this._hasVScroll;},convertColPctToFixed:function(){var _5ea=false;this.grid.initialWidth="";var _5eb=dojo.query("th",this.headerContentNode);var _5ec=dojo.map(_5eb,function(c,vIdx){var w=c.style.width;dojo.attr(c,"vIdx",vIdx);if(w&&w.slice(-1)=="%"){_5ea=true;}else{if(w&&w.slice(-2)=="px"){return window.parseInt(w,10);}}return dojo.contentBox(c).w;});if(_5ea){dojo.forEach(this.grid.layout.cells,function(cell,idx){if(cell.view==this){var _5ed=cell.view.getHeaderCellNode(cell.index);if(_5ed&&dojo.hasAttr(_5ed,"vIdx")){var vIdx=window.parseInt(dojo.attr(_5ed,"vIdx"));this.setColWidth(idx,_5ec[vIdx]);dojo.removeAttr(_5ed,"vIdx");}}},this);return true;}return false;},adaptHeight:function(_5ee){if(!this.grid._autoHeight){var h=(this.domNode.style.height&&parseInt(this.domNode.style.height.replace(/px/,""),10))||this.domNode.clientHeight;var self=this;var _5ef=function(){var v;for(var i in self.grid.views.views){v=self.grid.views.views[i];if(v!==self&&v.hasHScrollbar()){return true;}}return false;};if(_5ee||(this.noscroll&&_5ef())){h-=dojox.html.metrics.getScrollbar().h;}dojox.grid.util.setStyleHeightPx(this.scrollboxNode,h);}this.hasVScrollbar(true);},adaptWidth:function(){if(this.flexCells){this.contentWidth=this.getContentWidth();this.headerContentNode.firstChild.style.width=this.contentWidth;}var w=this.scrollboxNode.offsetWidth-this.getScrollbarWidth();if(!this._removingColumn){w=Math.max(w,this.getColumnsWidth())+"px";}else{w=Math.min(w,this.getColumnsWidth())+"px";this._removingColumn=false;}var cn=this.contentNode;cn.style.width=w;this.hasHScrollbar(true);},setSize:function(w,h){var ds=this.domNode.style;var hs=this.headerNode.style;if(w){ds.width=w;hs.width=w;}ds.height=(h>=0?h+"px":"");},renderRow:function(_5f0){var _5f1=this.createRowNode(_5f0);this.buildRow(_5f0,_5f1);this.grid.edit.restore(this,_5f0);return _5f1;},createRowNode:function(_5f2){var node=document.createElement("div");node.className=this.classTag+"Row";if(this instanceof dojox.grid._RowSelector){dojo.attr(node,"role","presentation");}else{dojo.attr(node,"role","row");if(this.grid.selectionMode!="none"){dojo.attr(node,"aria-selected","false");}}node[dojox.grid.util.gridViewTag]=this.id;node[dojox.grid.util.rowIndexTag]=_5f2;this.rowNodes[_5f2]=node;return node;},buildRow:function(_5f3,_5f4){this.buildRowContent(_5f3,_5f4);this.styleRow(_5f3,_5f4);},buildRowContent:function(_5f5,_5f6){_5f6.innerHTML=this.content.generateHtml(_5f5,_5f5);if(this.flexCells&&this.contentWidth){_5f6.firstChild.style.width=this.contentWidth;}dojox.grid.util.fire(this,"onAfterRow",[_5f5,this.structure.cells,_5f6]);},rowRemoved:function(_5f7){if(_5f7>=0){this._cleanupRowWidgets(this.getRowNode(_5f7));}this.grid.edit.save(this,_5f7);delete this.rowNodes[_5f7];},getRowNode:function(_5f8){return this.rowNodes[_5f8];},getCellNode:function(_5f9,_5fa){var row=this.getRowNode(_5f9);if(row){return this.content.getCellNode(row,_5fa);}},getHeaderCellNode:function(_5fb){if(this.headerContentNode){return this.header.getCellNode(this.headerContentNode,_5fb);}},styleRow:function(_5fc,_5fd){_5fd._style=_5bf(_5fd);this.styleRowNode(_5fc,_5fd);},styleRowNode:function(_5fe,_5ff){if(_5ff){this.doStyleRowNode(_5fe,_5ff);}},doStyleRowNode:function(_600,_601){this.grid.styleRowNode(_600,_601);},updateRow:function(_602){var _603=this.getRowNode(_602);if(_603){_603.style.height="";this.buildRow(_602,_603);}return _603;},updateRowStyles:function(_604){this.styleRowNode(_604,this.getRowNode(_604));},lastTop:0,firstScroll:0,doscroll:function(_605){var _606=dojo._isBodyLtr();if(this.firstScroll<2){if((!_606&&this.firstScroll==1)||(_606&&this.firstScroll===0)){var s=dojo.marginBox(this.headerNodeContainer);if(dojo.isIE){this.headerNodeContainer.style.width=s.w+this.getScrollbarWidth()+"px";}else{if(dojo.isMoz){this.headerNodeContainer.style.width=s.w-this.getScrollbarWidth()+"px";this.scrollboxNode.scrollLeft=_606?this.scrollboxNode.clientWidth-this.scrollboxNode.scrollWidth:this.scrollboxNode.scrollWidth-this.scrollboxNode.clientWidth;}}}this.firstScroll++;}this.headerNode.scrollLeft=this.scrollboxNode.scrollLeft;var top=this.scrollboxNode.scrollTop;if(top!==this.lastTop){this.grid.scrollTo(top);}},setScrollTop:function(_607){this.lastTop=_607;this.scrollboxNode.scrollTop=_607;return this.scrollboxNode.scrollTop;},doContentEvent:function(e){if(this.content.decorateEvent(e)){this.grid.onContentEvent(e);}},doHeaderEvent:function(e){if(this.header.decorateEvent(e)){this.grid.onHeaderEvent(e);}},dispatchContentEvent:function(e){return this.content.dispatchEvent(e);},dispatchHeaderEvent:function(e){return this.header.dispatchEvent(e);},setColWidth:function(_608,_609){this.grid.setCellWidth(_608,_609+"px");},update:function(){if(!this.domNode){return;}this.content.update();this.grid.update();var left=this.scrollboxNode.scrollLeft;this.scrollboxNode.scrollLeft=left;this.headerNode.scrollLeft=left;}});dojo.declare("dojox.grid._GridAvatar",dojo.dnd.Avatar,{construct:function(){var dd=dojo.doc;var a=dd.createElement("table");a.cellPadding=a.cellSpacing="0";a.className="dojoxGridDndAvatar";a.style.position="absolute";a.style.zIndex=1999;a.style.margin="0px";var b=dd.createElement("tbody");var tr=dd.createElement("tr");var td=dd.createElement("td");var img=dd.createElement("td");tr.className="dojoxGridDndAvatarItem";img.className="dojoxGridDndAvatarItemImage";img.style.width="16px";var _60a=this.manager.source,node;if(_60a.creator){node=_60a._normalizedCreator(_60a.getItem(this.manager.nodes[0].id).data,"avatar").node;}else{node=this.manager.nodes[0].cloneNode(true);var _60b,_60c;if(node.tagName.toLowerCase()=="tr"){_60b=dd.createElement("table");_60c=dd.createElement("tbody");_60c.appendChild(node);_60b.appendChild(_60c);node=_60b;}else{if(node.tagName.toLowerCase()=="th"){_60b=dd.createElement("table");_60c=dd.createElement("tbody");var r=dd.createElement("tr");_60b.cellPadding=_60b.cellSpacing="0";r.appendChild(node);_60c.appendChild(r);_60b.appendChild(_60c);node=_60b;}}}node.id="";td.appendChild(node);tr.appendChild(img);tr.appendChild(td);dojo.style(tr,"opacity",0.9);b.appendChild(tr);a.appendChild(b);this.node=a;var m=dojo.dnd.manager();this.oldOffsetY=m.OFFSET_Y;m.OFFSET_Y=1;},destroy:function(){dojo.dnd.manager().OFFSET_Y=this.oldOffsetY;this.inherited(arguments);}});var _60d=dojo.dnd.manager().makeAvatar;dojo.dnd.manager().makeAvatar=function(){var src=this.source;if(src.viewIndex!==undefined&&!dojo.hasClass(dojo.body(),"dijit_a11y")){return new dojox.grid._GridAvatar(this);}return _60d.call(dojo.dnd.manager());};})();}if(!dojo._hasResource["dojox.grid._RowSelector"]){dojo._hasResource["dojox.grid._RowSelector"]=true;dojo.provide("dojox.grid._RowSelector");dojo.declare("dojox.grid._RowSelector",dojox.grid._View,{defaultWidth:"2em",noscroll:true,padBorderWidth:2,buildRendering:function(){this.inherited("buildRendering",arguments);this.scrollboxNode.style.overflow="hidden";this.headerNode.style.visibility="hidden";},getWidth:function(){return this.viewWidth||this.defaultWidth;},buildRowContent:function(_60e,_60f){var w=this.contentWidth||0;_60f.innerHTML="<table class=\"dojoxGridRowbarTable\" style=\"width:"+w+"px;height:1px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" role=\"presentation\"><tr><td class=\"dojoxGridRowbarInner\">&nbsp;</td></tr></table>";},renderHeader:function(){},updateRow:function(){},resize:function(){this.adaptHeight();},adaptWidth:function(){if(!("contentWidth" in this)&&this.contentNode){this.contentWidth=this.contentNode.offsetWidth-this.padBorderWidth;}},doStyleRowNode:function(_610,_611){var n=["dojoxGridRowbar dojoxGridNonNormalizedCell"];if(this.grid.rows.isOver(_610)){n.push("dojoxGridRowbarOver");}if(this.grid.selection.isSelected(_610)){n.push("dojoxGridRowbarSelected");}_611.className=n.join(" ");},domouseover:function(e){this.grid.onMouseOverRow(e);},domouseout:function(e){if(!this.isIntraRowEvent(e)){this.grid.onMouseOutRow(e);}}});}if(!dojo._hasResource["dojox.grid._Layout"]){dojo._hasResource["dojox.grid._Layout"]=true;dojo.provide("dojox.grid._Layout");dojo.declare("dojox.grid._Layout",null,{constructor:function(_612){this.grid=_612;},cells:[],structure:null,defaultWidth:"6em",moveColumn:function(_613,_614,_615,_616,_617){var _618=this.structure[_613].cells[0];var _619=this.structure[_614].cells[0];var cell=null;var _61a=0;var _61b=0;for(var i=0,c;c=_618[i];i++){if(c.index==_615){_61a=i;break;}}cell=_618.splice(_61a,1)[0];cell.view=this.grid.views.views[_614];for(i=0,c=null;c=_619[i];i++){if(c.index==_616){_61b=i;break;}}if(!_617){_61b+=1;}_619.splice(_61b,0,cell);var _61c=this.grid.getCell(this.grid.getSortIndex());if(_61c){_61c._currentlySorted=this.grid.getSortAsc();}this.cells=[];_615=0;var v;for(i=0;v=this.structure[i];i++){for(var j=0,cs;cs=v.cells[j];j++){for(var k=0;c=cs[k];k++){c.index=_615;this.cells.push(c);if("_currentlySorted" in c){var si=_615+1;si*=c._currentlySorted?1:-1;this.grid.sortInfo=si;delete c._currentlySorted;}_615++;}}}dojo.forEach(this.cells,function(c){var _61d=c.markup[2].split(" ");var _61e=parseInt(_61d[1].substring(5));if(_61e!=c.index){_61d[1]="idx=\""+c.index+"\"";c.markup[2]=_61d.join(" ");}});this.grid.setupHeaderMenu();},setColumnVisibility:function(_61f,_620){var cell=this.cells[_61f];if(cell.hidden==_620){cell.hidden=!_620;var v=cell.view,w=v.viewWidth;if(w&&w!="auto"){v._togglingColumn=dojo.marginBox(cell.getHeaderNode()).w||0;}v.update();return true;}else{return false;}},addCellDef:function(_621,_622,_623){var self=this;var _624=function(_625){var w=0;if(_625.colSpan>1){w=0;}else{w=_625.width||self._defaultCellProps.width||self.defaultWidth;if(!isNaN(w)){w=w+"em";}}return w;};var _626={grid:this.grid,subrow:_621,layoutIndex:_622,index:this.cells.length};if(_623&&_623 instanceof dojox.grid.cells._Base){var _627=dojo.clone(_623);_626.unitWidth=_624(_627._props);_627=dojo.mixin(_627,this._defaultCellProps,_623._props,_626);return _627;}var _628=_623.type||_623.cellType||this._defaultCellProps.type||this._defaultCellProps.cellType||dojox.grid.cells.Cell;_626.unitWidth=_624(_623);return new _628(dojo.mixin({},this._defaultCellProps,_623,_626));},addRowDef:function(_629,_62a){var _62b=[];var _62c=0,_62d=0,_62e=true;for(var i=0,def,cell;(def=_62a[i]);i++){cell=this.addCellDef(_629,i,def);_62b.push(cell);this.cells.push(cell);if(_62e&&cell.relWidth){_62c+=cell.relWidth;}else{if(cell.width){var w=cell.width;if(typeof w=="string"&&w.slice(-1)=="%"){_62d+=window.parseInt(w,10);}else{if(w=="auto"){_62e=false;}}}}}if(_62c&&_62e){dojo.forEach(_62b,function(cell){if(cell.relWidth){cell.width=cell.unitWidth=((cell.relWidth/_62c)*(100-_62d))+"%";}});}return _62b;},addRowsDef:function(_62f){var _630=[];if(dojo.isArray(_62f)){if(dojo.isArray(_62f[0])){for(var i=0,row;_62f&&(row=_62f[i]);i++){_630.push(this.addRowDef(i,row));}}else{_630.push(this.addRowDef(0,_62f));}}return _630;},addViewDef:function(_631){this._defaultCellProps=_631.defaultCell||{};if(_631.width&&_631.width=="auto"){delete _631.width;}return dojo.mixin({},_631,{cells:this.addRowsDef(_631.rows||_631.cells)});},setStructure:function(_632){this.fieldIndex=0;this.cells=[];var s=this.structure=[];if(this.grid.rowSelector){var sel={type:dojox._scopeName+".grid._RowSelector"};if(dojo.isString(this.grid.rowSelector)){var _633=this.grid.rowSelector;if(_633=="false"){sel=null;}else{if(_633!="true"){sel["width"]=_633;}}}else{if(!this.grid.rowSelector){sel=null;}}if(sel){s.push(this.addViewDef(sel));}}var _634=function(def){return ("name" in def||"field" in def||"get" in def);};var _635=function(def){if(dojo.isArray(def)){if(dojo.isArray(def[0])||_634(def[0])){return true;}}return false;};var _636=function(def){return (def!==null&&dojo.isObject(def)&&("cells" in def||"rows" in def||("type" in def&&!_634(def))));};if(dojo.isArray(_632)){var _637=false;for(var i=0,st;(st=_632[i]);i++){if(_636(st)){_637=true;break;}}if(!_637){s.push(this.addViewDef({cells:_632}));}else{for(i=0;(st=_632[i]);i++){if(_635(st)){s.push(this.addViewDef({cells:st}));}else{if(_636(st)){s.push(this.addViewDef(st));}}}}}else{if(_636(_632)){s.push(this.addViewDef(_632));}}this.cellCount=this.cells.length;this.grid.setupHeaderMenu();}});}if(!dojo._hasResource["dojox.grid._ViewManager"]){dojo._hasResource["dojox.grid._ViewManager"]=true;dojo.provide("dojox.grid._ViewManager");dojo.declare("dojox.grid._ViewManager",null,{constructor:function(_638){this.grid=_638;},defaultWidth:200,views:[],resize:function(){this.onEach("resize");},render:function(){this.onEach("render");},addView:function(_639){_639.idx=this.views.length;this.views.push(_639);},destroyViews:function(){for(var i=0,v;v=this.views[i];i++){v.destroy();}this.views=[];},getContentNodes:function(){var _63a=[];for(var i=0,v;v=this.views[i];i++){_63a.push(v.contentNode);}return _63a;},forEach:function(_63b){for(var i=0,v;v=this.views[i];i++){_63b(v,i);}},onEach:function(_63c,_63d){_63d=_63d||[];for(var i=0,v;v=this.views[i];i++){if(_63c in v){v[_63c].apply(v,_63d);}}},normalizeHeaderNodeHeight:function(){var _63e=[];for(var i=0,v;(v=this.views[i]);i++){if(v.headerContentNode.firstChild){_63e.push(v.headerContentNode);}}this.normalizeRowNodeHeights(_63e);},normalizeRowNodeHeights:function(_63f){var h=0;var _640=[];if(this.grid.rowHeight){h=this.grid.rowHeight;}else{if(_63f.length<=1){return;}for(var i=0,n;(n=_63f[i]);i++){if(!dojo.hasClass(n,"dojoxGridNonNormalizedCell")){_640[i]=n.firstChild.offsetHeight;h=Math.max(h,_640[i]);}}h=(h>=0?h:0);if(dojo.isMoz&&h){h++;}}for(i=0;(n=_63f[i]);i++){if(_640[i]!=h){n.firstChild.style.height=h+"px";}}},resetHeaderNodeHeight:function(){for(var i=0,v,n;(v=this.views[i]);i++){n=v.headerContentNode.firstChild;if(n){n.style.height="";}}},renormalizeRow:function(_641){var _642=[];for(var i=0,v,n;(v=this.views[i])&&(n=v.getRowNode(_641));i++){n.firstChild.style.height="";_642.push(n);}this.normalizeRowNodeHeights(_642);},getViewWidth:function(_643){return this.views[_643].getWidth()||this.defaultWidth;},measureHeader:function(){this.resetHeaderNodeHeight();this.forEach(function(_644){_644.headerContentNode.style.height="";});var h=0;this.forEach(function(_645){h=Math.max(_645.headerNode.offsetHeight,h);});return h;},measureContent:function(){var h=0;this.forEach(function(_646){h=Math.max(_646.domNode.offsetHeight,h);});return h;},findClient:function(_647){var c=this.grid.elasticView||-1;if(c<0){for(var i=1,v;(v=this.views[i]);i++){if(v.viewWidth){for(i=1;(v=this.views[i]);i++){if(!v.viewWidth){c=i;break;}}break;}}}if(c<0){c=Math.floor(this.views.length/2);}return c;},arrange:function(l,w){var i,v,vw,len=this.views.length;var c=(w<=0?len:this.findClient());var _648=function(v,l){var ds=v.domNode.style;var hs=v.headerNode.style;if(!dojo._isBodyLtr()){ds.right=l+"px";if(dojo.isMoz){hs.right=l+v.getScrollbarWidth()+"px";hs.width=parseInt(hs.width,10)-v.getScrollbarWidth()+"px";}else{hs.right=l+"px";}}else{ds.left=l+"px";hs.left=l+"px";}ds.top=0+"px";hs.top=0;};for(i=0;(v=this.views[i])&&(i<c);i++){vw=this.getViewWidth(i);v.setSize(vw,0);_648(v,l);if(v.headerContentNode&&v.headerContentNode.firstChild){vw=v.getColumnsWidth()+v.getScrollbarWidth();}else{vw=v.domNode.offsetWidth;}l+=vw;}i++;var r=w;for(var j=len-1;(v=this.views[j])&&(i<=j);j--){vw=this.getViewWidth(j);v.setSize(vw,0);vw=v.domNode.offsetWidth;r-=vw;_648(v,r);}if(c<len){v=this.views[c];vw=Math.max(1,r-l);v.setSize(vw+"px",0);_648(v,l);}return l;},renderRow:function(_649,_64a,_64b){var _64c=[];for(var i=0,v,n,_64d;(v=this.views[i])&&(n=_64a[i]);i++){_64d=v.renderRow(_649);n.appendChild(_64d);_64c.push(_64d);}if(!_64b){this.normalizeRowNodeHeights(_64c);}},rowRemoved:function(_64e){this.onEach("rowRemoved",[_64e]);},updateRow:function(_64f,_650){for(var i=0,v;v=this.views[i];i++){v.updateRow(_64f);}if(!_650){this.renormalizeRow(_64f);}},updateRowStyles:function(_651){this.onEach("updateRowStyles",[_651]);},setScrollTop:function(_652){var top=_652;for(var i=0,v;v=this.views[i];i++){top=v.setScrollTop(_652);if(dojo.isIE&&v.headerNode&&v.scrollboxNode){v.headerNode.scrollLeft=v.scrollboxNode.scrollLeft;}}return top;},getFirstScrollingView:function(){for(var i=0,v;(v=this.views[i]);i++){if(v.hasHScrollbar()||v.hasVScrollbar()){return v;}}return null;}});}if(!dojo._hasResource["dojox.grid._RowManager"]){dojo._hasResource["dojox.grid._RowManager"]=true;dojo.provide("dojox.grid._RowManager");(function(){var _653=function(_654,_655){if(_654.style.cssText==undefined){_654.setAttribute("style",_655);}else{_654.style.cssText=_655;}};dojo.declare("dojox.grid._RowManager",null,{constructor:function(_656){this.grid=_656;},linesToEms:2,overRow:-2,prepareStylingRow:function(_657,_658){return {index:_657,node:_658,odd:Boolean(_657&1),selected:!!this.grid.selection.isSelected(_657),over:this.isOver(_657),customStyles:"",customClasses:"dojoxGridRow"};},styleRowNode:function(_659,_65a){var row=this.prepareStylingRow(_659,_65a);this.grid.onStyleRow(row);this.applyStyles(row);},applyStyles:function(_65b){var i=_65b;i.node.className=i.customClasses;var h=i.node.style.height;_653(i.node,i.customStyles+";"+(i.node._style||""));i.node.style.height=h;},updateStyles:function(_65c){this.grid.updateRowStyles(_65c);},setOverRow:function(_65d){var last=this.overRow;this.overRow=_65d;if((last!=this.overRow)&&(dojo.isString(last)||last>=0)){this.updateStyles(last);}this.updateStyles(this.overRow);},isOver:function(_65e){return (this.overRow==_65e&&!dojo.hasClass(this.grid.domNode,"dojoxGridColumnResizing"));}});})();}if(!dojo._hasResource["dojox.grid._FocusManager"]){dojo._hasResource["dojox.grid._FocusManager"]=true;dojo.provide("dojox.grid._FocusManager");dojo.declare("dojox.grid._FocusManager",null,{constructor:function(_65f){this.grid=_65f;this.cell=null;this.rowIndex=-1;this._connects=[];this._headerConnects=[];this.headerMenu=this.grid.headerMenu;this._connects.push(dojo.connect(this.grid.domNode,"onfocus",this,"doFocus"));this._connects.push(dojo.connect(this.grid.domNode,"onblur",this,"doBlur"));this._connects.push(dojo.connect(this.grid.domNode,"oncontextmenu",this,"doContextMenu"));this._connects.push(dojo.connect(this.grid.lastFocusNode,"onfocus",this,"doLastNodeFocus"));this._connects.push(dojo.connect(this.grid.lastFocusNode,"onblur",this,"doLastNodeBlur"));this._connects.push(dojo.connect(this.grid,"_onFetchComplete",this,"_delayedCellFocus"));this._connects.push(dojo.connect(this.grid,"postrender",this,"_delayedHeaderFocus"));},destroy:function(){dojo.forEach(this._connects,dojo.disconnect);dojo.forEach(this._headerConnects,dojo.disconnect);delete this.grid;delete this.cell;},_colHeadNode:null,_colHeadFocusIdx:null,_contextMenuBindNode:null,tabbingOut:false,focusClass:"dojoxGridCellFocus",focusView:null,initFocusView:function(){this.focusView=this.grid.views.getFirstScrollingView()||this.focusView||this.grid.views.views[0];this._initColumnHeaders();},isFocusCell:function(_660,_661){return (this.cell==_660)&&(this.rowIndex==_661);},isLastFocusCell:function(){if(this.cell){return (this.rowIndex==this.grid.rowCount-1)&&(this.cell.index==this.grid.layout.cellCount-1);}return false;},isFirstFocusCell:function(){if(this.cell){return (this.rowIndex===0)&&(this.cell.index===0);}return false;},isNoFocusCell:function(){return (this.rowIndex<0)||!this.cell;},isNavHeader:function(){return (!!this._colHeadNode);},getHeaderIndex:function(){if(this._colHeadNode){return dojo.indexOf(this._findHeaderCells(),this._colHeadNode);}else{return -1;}},_focusifyCellNode:function(_662){var n=this.cell&&this.cell.getNode(this.rowIndex);if(n){dojo.toggleClass(n,this.focusClass,_662);if(_662){var sl=this.scrollIntoView();try{if(!this.grid.edit.isEditing()){dojox.grid.util.fire(n,"focus");if(sl){this.cell.view.scrollboxNode.scrollLeft=sl;}}}catch(e){}}}},_delayedCellFocus:function(){if(this.isNavHeader()||!this.grid._focused){return;}var n=this.cell&&this.cell.getNode(this.rowIndex);if(n){try{if(!this.grid.edit.isEditing()){dojo.toggleClass(n,this.focusClass,true);this.blurHeader();dojox.grid.util.fire(n,"focus");}}catch(e){}}},_delayedHeaderFocus:function(){if(this.isNavHeader()){this.focusHeader();this.grid.domNode.focus();}},_initColumnHeaders:function(){dojo.forEach(this._headerConnects,dojo.disconnect);this._headerConnects=[];var _663=this._findHeaderCells();for(var i=0;i<_663.length;i++){this._headerConnects.push(dojo.connect(_663[i],"onfocus",this,"doColHeaderFocus"));this._headerConnects.push(dojo.connect(_663[i],"onblur",this,"doColHeaderBlur"));}},_findHeaderCells:function(){var _664=dojo.query("th",this.grid.viewsHeaderNode);var _665=[];for(var i=0;i<_664.length;i++){var _666=_664[i];var _667=dojo.hasAttr(_666,"tabIndex");var _668=dojo.attr(_666,"tabIndex");if(_667&&_668<0){_665.push(_666);}}return _665;},_setActiveColHeader:function(_669,_66a,_66b){dojo.attr(this.grid.domNode,"aria-activedescendant",_669.id);if(_66b!=null&&_66b>=0&&_66b!=_66a){dojo.toggleClass(this._findHeaderCells()[_66b],this.focusClass,false);}dojo.toggleClass(_669,this.focusClass,true);this._colHeadNode=_669;this._colHeadFocusIdx=_66a;this._scrollHeader(this._colHeadFocusIdx);},scrollIntoView:function(){var info=(this.cell?this._scrollInfo(this.cell):null);if(!info||!info.s){return null;}var rt=this.grid.scroller.findScrollTop(this.rowIndex);if(info.n&&info.sr){if(info.n.offsetLeft+info.n.offsetWidth>info.sr.l+info.sr.w){info.s.scrollLeft=info.n.offsetLeft+info.n.offsetWidth-info.sr.w;}else{if(info.n.offsetLeft<info.sr.l){info.s.scrollLeft=info.n.offsetLeft;}}}if(info.r&&info.sr){if(rt+info.r.offsetHeight>info.sr.t+info.sr.h){this.grid.setScrollTop(rt+info.r.offsetHeight-info.sr.h);}else{if(rt<info.sr.t){this.grid.setScrollTop(rt);}}}return info.s.scrollLeft;},_scrollInfo:function(cell,_66c){if(cell){var cl=cell,sbn=cl.view.scrollboxNode,sbnr={w:sbn.clientWidth,l:sbn.scrollLeft,t:sbn.scrollTop,h:sbn.clientHeight},rn=cl.view.getRowNode(this.rowIndex);return {c:cl,s:sbn,sr:sbnr,n:(_66c?_66c:cell.getNode(this.rowIndex)),r:rn};}return null;},_scrollHeader:function(_66d){var info=null;if(this._colHeadNode){var cell=this.grid.getCell(_66d);info=this._scrollInfo(cell,cell.getNode(0));}if(info&&info.s&&info.sr&&info.n){var _66e=info.sr.l+info.sr.w;if(info.n.offsetLeft+info.n.offsetWidth>_66e){info.s.scrollLeft=info.n.offsetLeft+info.n.offsetWidth-info.sr.w;}else{if(info.n.offsetLeft<info.sr.l){info.s.scrollLeft=info.n.offsetLeft;}else{if(dojo.isIE<=7&&cell&&cell.view.headerNode){cell.view.headerNode.scrollLeft=info.s.scrollLeft;}}}}},_isHeaderHidden:function(){var _66f=this.focusView;if(!_66f){for(var i=0,_670;(_670=this.grid.views.views[i]);i++){if(_670.headerNode){_66f=_670;break;}}}return (_66f&&dojo.getComputedStyle(_66f.headerNode).display=="none");},colSizeAdjust:function(e,_671,_672){var _673=this._findHeaderCells();var view=this.focusView;if(!view){for(var i=0,_674;(_674=this.grid.views.views[i]);i++){if(_674.header.tableMap.map){view=_674;break;}}}var _675=_673[_671];if(!view||(_671==_673.length-1&&_671===0)){return;}view.content.baseDecorateEvent(e);e.cellNode=_675;e.cellIndex=view.content.getCellNodeIndex(e.cellNode);e.cell=(e.cellIndex>=0?this.grid.getCell(e.cellIndex):null);if(view.header.canResize(e)){var _676={l:_672};var drag=view.header.colResizeSetup(e,false);view.header.doResizeColumn(drag,null,_676);view.update();}},styleRow:function(_677){return;},setFocusIndex:function(_678,_679){this.setFocusCell(this.grid.getCell(_679),_678);},setFocusCell:function(_67a,_67b){if(_67a&&!this.isFocusCell(_67a,_67b)){this.tabbingOut=false;if(this._colHeadNode){this.blurHeader();}this._colHeadNode=this._colHeadFocusIdx=null;this.focusGridView();this._focusifyCellNode(false);this.cell=_67a;this.rowIndex=_67b;this._focusifyCellNode(true);}if(dojo.isOpera){setTimeout(dojo.hitch(this.grid,"onCellFocus",this.cell,this.rowIndex),1);}else{this.grid.onCellFocus(this.cell,this.rowIndex);}},next:function(){if(this.cell){var row=this.rowIndex,col=this.cell.index+1,cc=this.grid.layout.cellCount-1,rc=this.grid.rowCount-1;if(col>cc){col=0;row++;}if(row>rc){col=cc;row=rc;}if(this.grid.edit.isEditing()){var _67c=this.grid.getCell(col);if(!this.isLastFocusCell()&&(!_67c.editable||this.grid.canEdit&&!this.grid.canEdit(_67c,row))){this.cell=_67c;this.rowIndex=row;this.next();return;}}this.setFocusIndex(row,col);}},previous:function(){if(this.cell){var row=(this.rowIndex||0),col=(this.cell.index||0)-1;if(col<0){col=this.grid.layout.cellCount-1;row--;}if(row<0){row=0;col=0;}if(this.grid.edit.isEditing()){var _67d=this.grid.getCell(col);if(!this.isFirstFocusCell()&&!_67d.editable){this.cell=_67d;this.rowIndex=row;this.previous();return;}}this.setFocusIndex(row,col);}},move:function(_67e,_67f){var _680=_67f<0?-1:1;if(this.isNavHeader()){var _681=this._findHeaderCells();var _682=currentIdx=dojo.indexOf(_681,this._colHeadNode);currentIdx+=_67f;while(currentIdx>=0&&currentIdx<_681.length&&_681[currentIdx].style.display=="none"){currentIdx+=_680;}if((currentIdx>=0)&&(currentIdx<_681.length)){this._setActiveColHeader(_681[currentIdx],currentIdx,_682);}}else{if(this.cell){var sc=this.grid.scroller,r=this.rowIndex,rc=this.grid.rowCount-1,row=Math.min(rc,Math.max(0,r+_67e));if(_67e){if(_67e>0){if(row>sc.getLastPageRow(sc.page)){this.grid.setScrollTop(this.grid.scrollTop+sc.findScrollTop(row)-sc.findScrollTop(r));}}else{if(_67e<0){if(row<=sc.getPageRow(sc.page)){this.grid.setScrollTop(this.grid.scrollTop-sc.findScrollTop(r)-sc.findScrollTop(row));}}}}var cc=this.grid.layout.cellCount-1,i=this.cell.index,col=Math.min(cc,Math.max(0,i+_67f));var cell=this.grid.getCell(col);while(col>=0&&col<cc&&cell&&cell.hidden===true){col+=_680;cell=this.grid.getCell(col);}if(!cell||cell.hidden===true){col=i;}var n=cell.getNode(row);if(!n&&_67e){if((row+_67e)>=0&&(row+_67e)<=rc){this.move(_67e>0?++_67e:--_67e,_67f);}return;}else{if((!n||dojo.style(n,"display")==="none")&&_67f){if((col+_67e)>=0&&(col+_67e)<=cc){this.move(_67e,_67f>0?++_67f:--_67f);}return;}}this.setFocusIndex(row,col);if(_67e){this.grid.updateRow(r);}}}},previousKey:function(e){if(this.grid.edit.isEditing()){dojo.stopEvent(e);this.previous();}else{if(!this.isNavHeader()&&!this._isHeaderHidden()){this.grid.domNode.focus();dojo.stopEvent(e);}else{this.tabOut(this.grid.domNode);if(this._colHeadFocusIdx!=null){dojo.toggleClass(this._findHeaderCells()[this._colHeadFocusIdx],this.focusClass,false);this._colHeadFocusIdx=null;}this._focusifyCellNode(false);}}},nextKey:function(e){var _683=(this.grid.rowCount===0);if(e.target===this.grid.domNode&&this._colHeadFocusIdx==null){this.focusHeader();dojo.stopEvent(e);}else{if(this.isNavHeader()){this.blurHeader();if(!this.findAndFocusGridCell()){this.tabOut(this.grid.lastFocusNode);}this._colHeadNode=this._colHeadFocusIdx=null;}else{if(this.grid.edit.isEditing()){dojo.stopEvent(e);this.next();}else{this.tabOut(this.grid.lastFocusNode);}}}},tabOut:function(_684){this.tabbingOut=true;_684.focus();},focusGridView:function(){dojox.grid.util.fire(this.focusView,"focus");},focusGrid:function(_685){this.focusGridView();this._focusifyCellNode(true);},findAndFocusGridCell:function(){var _686=true;var _687=(this.grid.rowCount===0);if(this.isNoFocusCell()&&!_687){var _688=0;var cell=this.grid.getCell(_688);if(cell.hidden){_688=this.isNavHeader()?this._colHeadFocusIdx:0;}this.setFocusIndex(0,_688);}else{if(this.cell&&!_687){if(this.focusView&&!this.focusView.rowNodes[this.rowIndex]){this.grid.scrollToRow(this.rowIndex);}this.focusGrid();}else{_686=false;}}this._colHeadNode=this._colHeadFocusIdx=null;return _686;},focusHeader:function(){var _689=this._findHeaderCells();var _68a=this._colHeadFocusIdx;if(this._isHeaderHidden()){this.findAndFocusGridCell();}else{if(!this._colHeadFocusIdx){if(this.isNoFocusCell()){this._colHeadFocusIdx=0;}else{this._colHeadFocusIdx=this.cell.index;}}}this._colHeadNode=_689[this._colHeadFocusIdx];while(this._colHeadNode&&this._colHeadFocusIdx>=0&&this._colHeadFocusIdx<_689.length&&this._colHeadNode.style.display=="none"){this._colHeadFocusIdx++;this._colHeadNode=_689[this._colHeadFocusIdx];}if(this._colHeadNode&&this._colHeadNode.style.display!="none"){if(this.headerMenu&&this._contextMenuBindNode!=this.grid.domNode){this.headerMenu.unBindDomNode(this.grid.viewsHeaderNode);this.headerMenu.bindDomNode(this.grid.domNode);this._contextMenuBindNode=this.grid.domNode;}this._setActiveColHeader(this._colHeadNode,this._colHeadFocusIdx,_68a);this._scrollHeader(this._colHeadFocusIdx);this._focusifyCellNode(false);}else{this.findAndFocusGridCell();}},blurHeader:function(){dojo.removeClass(this._colHeadNode,this.focusClass);dojo.removeAttr(this.grid.domNode,"aria-activedescendant");if(this.headerMenu&&this._contextMenuBindNode==this.grid.domNode){var _68b=this.grid.viewsHeaderNode;this.headerMenu.unBindDomNode(this.grid.domNode);this.headerMenu.bindDomNode(_68b);this._contextMenuBindNode=_68b;}},doFocus:function(e){if(e&&e.target!=e.currentTarget){dojo.stopEvent(e);return;}if(!this.tabbingOut){this.focusHeader();}this.tabbingOut=false;dojo.stopEvent(e);},doBlur:function(e){dojo.stopEvent(e);},doContextMenu:function(e){if(!this.headerMenu){dojo.stopEvent(e);}},doLastNodeFocus:function(e){if(this.tabbingOut){this._focusifyCellNode(false);}else{if(this.grid.rowCount>0){if(this.isNoFocusCell()){this.setFocusIndex(0,0);}this._focusifyCellNode(true);}else{this.focusHeader();}}this.tabbingOut=false;dojo.stopEvent(e);},doLastNodeBlur:function(e){dojo.stopEvent(e);},doColHeaderFocus:function(e){this._setActiveColHeader(e.target,dojo.attr(e.target,"idx"),this._colHeadFocusIdx);this._scrollHeader(this.getHeaderIndex());dojo.stopEvent(e);},doColHeaderBlur:function(e){dojo.toggleClass(e.target,this.focusClass,false);}});}if(!dojo._hasResource["dojox.grid._EditManager"]){dojo._hasResource["dojox.grid._EditManager"]=true;dojo.provide("dojox.grid._EditManager");dojo.declare("dojox.grid._EditManager",null,{constructor:function(_68c){this.grid=_68c;if(dojo.isIE){this.connections=[dojo.connect(document.body,"onfocus",dojo.hitch(this,"_boomerangFocus"))];}else{this.connections=[dojo.connect(this.grid,"onBlur",this,"apply")];}},info:{},destroy:function(){dojo.forEach(this.connections,dojo.disconnect);},cellFocus:function(_68d,_68e){if(this.grid.singleClickEdit||this.isEditRow(_68e)){this.setEditCell(_68d,_68e);}else{this.apply();}if(this.isEditing()||(_68d&&_68d.editable&&_68d.alwaysEditing)){this._focusEditor(_68d,_68e);}},rowClick:function(e){if(this.isEditing()&&!this.isEditRow(e.rowIndex)){this.apply();}},styleRow:function(_68f){if(_68f.index==this.info.rowIndex){_68f.customClasses+=" dojoxGridRowEditing";}},dispatchEvent:function(e){var c=e.cell,ed=(c&&c["editable"])?c:0;return ed&&ed.dispatchEvent(e.dispatch,e);},isEditing:function(){return this.info.rowIndex!==undefined;},isEditCell:function(_690,_691){return (this.info.rowIndex===_690)&&(this.info.cell.index==_691);},isEditRow:function(_692){return this.info.rowIndex===_692;},setEditCell:function(_693,_694){if(!this.isEditCell(_694,_693.index)&&this.grid.canEdit&&this.grid.canEdit(_693,_694)){this.start(_693,_694,this.isEditRow(_694)||_693.editable);}},_focusEditor:function(_695,_696){dojox.grid.util.fire(_695,"focus",[_696]);},focusEditor:function(){if(this.isEditing()){this._focusEditor(this.info.cell,this.info.rowIndex);}},_boomerangWindow:500,_shouldCatchBoomerang:function(){return this._catchBoomerang>new Date().getTime();},_boomerangFocus:function(){if(this._shouldCatchBoomerang()){this.grid.focus.focusGrid();this.focusEditor();this._catchBoomerang=0;}},_doCatchBoomerang:function(){if(dojo.isIE){this._catchBoomerang=new Date().getTime()+this._boomerangWindow;}},start:function(_697,_698,_699){this.grid.beginUpdate();this.editorApply();if(this.isEditing()&&!this.isEditRow(_698)){this.applyRowEdit();this.grid.updateRow(_698);}if(_699){this.info={cell:_697,rowIndex:_698};this.grid.doStartEdit(_697,_698);this.grid.updateRow(_698);}else{this.info={};}this.grid.endUpdate();this.grid.focus.focusGrid();this._focusEditor(_697,_698);this._doCatchBoomerang();},_editorDo:function(_69a){var c=this.info.cell;if(c&&c.editable){c[_69a](this.info.rowIndex);}},editorApply:function(){this._editorDo("apply");},editorCancel:function(){this._editorDo("cancel");},applyCellEdit:function(_69b,_69c,_69d){if(this.grid.canEdit(_69c,_69d)){this.grid.doApplyCellEdit(_69b,_69d,_69c.field);}},applyRowEdit:function(){this.grid.doApplyEdit(this.info.rowIndex,this.info.cell.field);},apply:function(){if(this.isEditing()){this.grid.beginUpdate();this.editorApply();this.applyRowEdit();this.info={};this.grid.endUpdate();this.grid.focus.focusGrid();this._doCatchBoomerang();}},cancel:function(){if(this.isEditing()){this.grid.beginUpdate();this.editorCancel();this.info={};this.grid.endUpdate();this.grid.focus.focusGrid();this._doCatchBoomerang();}},save:function(_69e,_69f){var c=this.info.cell;if(this.isEditRow(_69e)&&(!_69f||c.view==_69f)&&c.editable){c.save(c,this.info.rowIndex);}},restore:function(_6a0,_6a1){var c=this.info.cell;if(this.isEditRow(_6a1)&&c.view==_6a0&&c.editable){c.restore(c,this.info.rowIndex);}}});}if(!dojo._hasResource["dojox.grid.Selection"]){dojo._hasResource["dojox.grid.Selection"]=true;dojo.provide("dojox.grid.Selection");dojo.declare("dojox.grid.Selection",null,{constructor:function(_6a2){this.grid=_6a2;this.selected=[];this.setMode(_6a2.selectionMode);},mode:"extended",selected:null,updating:0,selectedIndex:-1,setMode:function(mode){if(this.selected.length){this.deselectAll();}if(mode!="extended"&&mode!="multiple"&&mode!="single"&&mode!="none"){this.mode="extended";}else{this.mode=mode;}},onCanSelect:function(_6a3){return this.grid.onCanSelect(_6a3);},onCanDeselect:function(_6a4){return this.grid.onCanDeselect(_6a4);},onSelected:function(_6a5){},onDeselected:function(_6a6){},onChanging:function(){},onChanged:function(){},isSelected:function(_6a7){if(this.mode=="none"){return false;}return this.selected[_6a7];},getFirstSelected:function(){if(!this.selected.length||this.mode=="none"){return -1;}for(var i=0,l=this.selected.length;i<l;i++){if(this.selected[i]){return i;}}return -1;},getNextSelected:function(_6a8){if(this.mode=="none"){return -1;}for(var i=_6a8+1,l=this.selected.length;i<l;i++){if(this.selected[i]){return i;}}return -1;},getSelected:function(){var _6a9=[];for(var i=0,l=this.selected.length;i<l;i++){if(this.selected[i]){_6a9.push(i);}}return _6a9;},getSelectedCount:function(){var c=0;for(var i=0;i<this.selected.length;i++){if(this.selected[i]){c++;}}return c;},_beginUpdate:function(){if(this.updating===0){this.onChanging();}this.updating++;},_endUpdate:function(){this.updating--;if(this.updating===0){this.onChanged();}},select:function(_6aa){if(this.mode=="none"){return;}if(this.mode!="multiple"){this.deselectAll(_6aa);this.addToSelection(_6aa);}else{this.toggleSelect(_6aa);}},addToSelection:function(_6ab){if(this.mode=="none"){return;}if(dojo.isArray(_6ab)){dojo.forEach(_6ab,this.addToSelection,this);return;}_6ab=Number(_6ab);if(this.selected[_6ab]){this.selectedIndex=_6ab;}else{if(this.onCanSelect(_6ab)!==false){this.selectedIndex=_6ab;var _6ac=this.grid.getRowNode(_6ab);if(_6ac){dojo.attr(_6ac,"aria-selected","true");}this._beginUpdate();this.selected[_6ab]=true;this.onSelected(_6ab);this._endUpdate();}}},deselect:function(_6ad){if(this.mode=="none"){return;}if(dojo.isArray(_6ad)){dojo.forEach(_6ad,this.deselect,this);return;}_6ad=Number(_6ad);if(this.selectedIndex==_6ad){this.selectedIndex=-1;}if(this.selected[_6ad]){if(this.onCanDeselect(_6ad)===false){return;}var _6ae=this.grid.getRowNode(_6ad);if(_6ae){dojo.attr(_6ae,"aria-selected","false");}this._beginUpdate();delete this.selected[_6ad];this.onDeselected(_6ad);this._endUpdate();}},setSelected:function(_6af,_6b0){this[(_6b0?"addToSelection":"deselect")](_6af);},toggleSelect:function(_6b1){if(dojo.isArray(_6b1)){dojo.forEach(_6b1,this.toggleSelect,this);return;}this.setSelected(_6b1,!this.selected[_6b1]);},_range:function(_6b2,inTo,func){var s=(_6b2>=0?_6b2:inTo),e=inTo;if(s>e){e=s;s=inTo;}for(var i=s;i<=e;i++){func(i);}},selectRange:function(_6b3,inTo){this._range(_6b3,inTo,dojo.hitch(this,"addToSelection"));},deselectRange:function(_6b4,inTo){this._range(_6b4,inTo,dojo.hitch(this,"deselect"));},insert:function(_6b5){this.selected.splice(_6b5,0,false);if(this.selectedIndex>=_6b5){this.selectedIndex++;}},remove:function(_6b6){this.selected.splice(_6b6,1);if(this.selectedIndex>=_6b6){this.selectedIndex--;}},deselectAll:function(_6b7){for(var i in this.selected){if((i!=_6b7)&&(this.selected[i]===true)){this.deselect(i);}}},clickSelect:function(_6b8,_6b9,_6ba){if(this.mode=="none"){return;}this._beginUpdate();if(this.mode!="extended"){this.select(_6b8);}else{var _6bb=this.selectedIndex;if(!_6b9){this.deselectAll(_6b8);}if(_6ba){this.selectRange(_6bb,_6b8);}else{if(_6b9){this.toggleSelect(_6b8);}else{this.addToSelection(_6b8);}}}this._endUpdate();},clickSelectEvent:function(e){this.clickSelect(e.rowIndex,dojo.isCopyKey(e),e.shiftKey);},clear:function(){this._beginUpdate();this.deselectAll();this._endUpdate();}});}if(!dojo._hasResource["dojox.grid._Events"]){dojo._hasResource["dojox.grid._Events"]=true;dojo.provide("dojox.grid._Events");dojo.declare("dojox.grid._Events",null,{cellOverClass:"dojoxGridCellOver",onKeyEvent:function(e){this.dispatchKeyEvent(e);},onContentEvent:function(e){this.dispatchContentEvent(e);},onHeaderEvent:function(e){this.dispatchHeaderEvent(e);},onStyleRow:function(_6bc){var i=_6bc;i.customClasses+=(i.odd?" dojoxGridRowOdd":"")+(i.selected?" dojoxGridRowSelected":"")+(i.over?" dojoxGridRowOver":"");this.focus.styleRow(_6bc);this.edit.styleRow(_6bc);},onKeyDown:function(e){if(e.altKey||e.metaKey){return;}var dk=dojo.keys;var _6bd;switch(e.keyCode){case dk.ESCAPE:this.edit.cancel();break;case dk.ENTER:if(!this.edit.isEditing()){_6bd=this.focus.getHeaderIndex();if(_6bd>=0){this.setSortIndex(_6bd);break;}else{this.selection.clickSelect(this.focus.rowIndex,dojo.isCopyKey(e),e.shiftKey);}dojo.stopEvent(e);}if(!e.shiftKey){var _6be=this.edit.isEditing();this.edit.apply();if(!_6be){this.edit.setEditCell(this.focus.cell,this.focus.rowIndex);}}if(!this.edit.isEditing()){var _6bf=this.focus.focusView||this.views.views[0];_6bf.content.decorateEvent(e);this.onRowClick(e);dojo.stopEvent(e);}break;case dk.SPACE:if(!this.edit.isEditing()){_6bd=this.focus.getHeaderIndex();if(_6bd>=0){this.setSortIndex(_6bd);break;}else{this.selection.clickSelect(this.focus.rowIndex,dojo.isCopyKey(e),e.shiftKey);}dojo.stopEvent(e);}break;case dk.TAB:this.focus[e.shiftKey?"previousKey":"nextKey"](e);break;case dk.LEFT_ARROW:case dk.RIGHT_ARROW:if(!this.edit.isEditing()){var _6c0=e.keyCode;dojo.stopEvent(e);_6bd=this.focus.getHeaderIndex();if(_6bd>=0&&(e.shiftKey&&e.ctrlKey)){this.focus.colSizeAdjust(e,_6bd,(_6c0==dk.LEFT_ARROW?-1:1)*5);}else{var _6c1=(_6c0==dk.LEFT_ARROW)?1:-1;if(dojo._isBodyLtr()){_6c1*=-1;}this.focus.move(0,_6c1);}}break;case dk.UP_ARROW:if(!this.edit.isEditing()&&this.focus.rowIndex!==0){dojo.stopEvent(e);this.focus.move(-1,0);}break;case dk.DOWN_ARROW:if(!this.edit.isEditing()&&this.focus.rowIndex+1!=this.rowCount){dojo.stopEvent(e);this.focus.move(1,0);}break;case dk.PAGE_UP:if(!this.edit.isEditing()&&this.focus.rowIndex!==0){dojo.stopEvent(e);if(this.focus.rowIndex!=this.scroller.firstVisibleRow+1){this.focus.move(this.scroller.firstVisibleRow-this.focus.rowIndex,0);}else{this.setScrollTop(this.scroller.findScrollTop(this.focus.rowIndex-1));this.focus.move(this.scroller.firstVisibleRow-this.scroller.lastVisibleRow+1,0);}}break;case dk.PAGE_DOWN:if(!this.edit.isEditing()&&this.focus.rowIndex+1!=this.rowCount){dojo.stopEvent(e);if(this.focus.rowIndex!=this.scroller.lastVisibleRow-1){this.focus.move(this.scroller.lastVisibleRow-this.focus.rowIndex-1,0);}else{this.setScrollTop(this.scroller.findScrollTop(this.focus.rowIndex+1));this.focus.move(this.scroller.lastVisibleRow-this.scroller.firstVisibleRow-1,0);}}break;default:break;}},onMouseOver:function(e){e.rowIndex==-1?this.onHeaderCellMouseOver(e):this.onCellMouseOver(e);},onMouseOut:function(e){e.rowIndex==-1?this.onHeaderCellMouseOut(e):this.onCellMouseOut(e);},onMouseDown:function(e){e.rowIndex==-1?this.onHeaderCellMouseDown(e):this.onCellMouseDown(e);},onMouseOverRow:function(e){if(!this.rows.isOver(e.rowIndex)){this.rows.setOverRow(e.rowIndex);e.rowIndex==-1?this.onHeaderMouseOver(e):this.onRowMouseOver(e);}},onMouseOutRow:function(e){if(this.rows.isOver(-1)){this.onHeaderMouseOut(e);}else{if(!this.rows.isOver(-2)){this.rows.setOverRow(-2);this.onRowMouseOut(e);}}},onMouseDownRow:function(e){if(e.rowIndex!=-1){this.onRowMouseDown(e);}},onCellMouseOver:function(e){if(e.cellNode){dojo.addClass(e.cellNode,this.cellOverClass);}},onCellMouseOut:function(e){if(e.cellNode){dojo.removeClass(e.cellNode,this.cellOverClass);}},onCellMouseDown:function(e){},onCellClick:function(e){this._click[0]=this._click[1];this._click[1]=e;if(!this.edit.isEditCell(e.rowIndex,e.cellIndex)){this.focus.setFocusCell(e.cell,e.rowIndex);}this.onRowClick(e);},onCellDblClick:function(e){if(this._click.length>1&&dojo.isIE){this.edit.setEditCell(this._click[1].cell,this._click[1].rowIndex);}else{if(this._click.length>1&&this._click[0].rowIndex!=this._click[1].rowIndex){this.edit.setEditCell(this._click[0].cell,this._click[0].rowIndex);}else{this.edit.setEditCell(e.cell,e.rowIndex);}}this.onRowDblClick(e);},onCellContextMenu:function(e){this.onRowContextMenu(e);},onCellFocus:function(_6c2,_6c3){this.edit.cellFocus(_6c2,_6c3);},onRowClick:function(e){this.edit.rowClick(e);this.selection.clickSelectEvent(e);},onRowDblClick:function(e){},onRowMouseOver:function(e){},onRowMouseOut:function(e){},onRowMouseDown:function(e){},onRowContextMenu:function(e){dojo.stopEvent(e);},onHeaderMouseOver:function(e){},onHeaderMouseOut:function(e){},onHeaderCellMouseOver:function(e){if(e.cellNode){dojo.addClass(e.cellNode,this.cellOverClass);}},onHeaderCellMouseOut:function(e){if(e.cellNode){dojo.removeClass(e.cellNode,this.cellOverClass);}},onHeaderCellMouseDown:function(e){},onHeaderClick:function(e){},onHeaderCellClick:function(e){this.setSortIndex(e.cell.index);this.onHeaderClick(e);},onHeaderDblClick:function(e){},onHeaderCellDblClick:function(e){this.onHeaderDblClick(e);},onHeaderCellContextMenu:function(e){this.onHeaderContextMenu(e);},onHeaderContextMenu:function(e){if(!this.headerMenu){dojo.stopEvent(e);}},onStartEdit:function(_6c4,_6c5){},onApplyCellEdit:function(_6c6,_6c7,_6c8){},onCancelEdit:function(_6c9){},onApplyEdit:function(_6ca){},onCanSelect:function(_6cb){return true;},onCanDeselect:function(_6cc){return true;},onSelected:function(_6cd){this.updateRowStyles(_6cd);},onDeselected:function(_6ce){this.updateRowStyles(_6ce);},onSelectionChanged:function(){}});}if(!dojo._hasResource["dojox.grid._Grid"]){dojo._hasResource["dojox.grid._Grid"]=true;dojo.provide("dojox.grid._Grid");(function(){if(!dojo.isCopyKey){dojo.isCopyKey=dojo.dnd.getCopyKeyState;}dojo.declare("dojox.grid._Grid",[dijit._Widget,dijit._Templated,dojox.grid._Events],{templateString:"<div hidefocus=\"hidefocus\" role=\"grid\" dojoAttachEvent=\"onmouseout:_mouseOut\">\r\n\t<div class=\"dojoxGridMasterHeader\" dojoAttachPoint=\"viewsHeaderNode\" role=\"presentation\"></div>\r\n\t<div class=\"dojoxGridMasterView\" dojoAttachPoint=\"viewsNode\" role=\"presentation\"></div>\r\n\t<div class=\"dojoxGridMasterMessages\" style=\"display: none;\" dojoAttachPoint=\"messagesNode\"></div>\r\n\t<span dojoAttachPoint=\"lastFocusNode\" tabindex=\"0\"></span>\r\n</div>\r\n",classTag:"dojoxGrid",rowCount:5,keepRows:75,rowsPerPage:25,autoWidth:false,initialWidth:"",autoHeight:"",rowHeight:0,autoRender:true,defaultHeight:"15em",height:"",structure:null,elasticView:-1,singleClickEdit:false,selectionMode:"extended",rowSelector:"",columnReordering:false,headerMenu:null,placeholderLabel:"GridColumns",selectable:false,_click:null,loadingMessage:"<span class='dojoxGridLoading'>${loadingState}</span>",errorMessage:"<span class='dojoxGridError'>${errorState}</span>",noDataMessage:"",escapeHTMLInData:true,formatterScope:null,editable:false,sortInfo:0,themeable:true,_placeholders:null,_layoutClass:dojox.grid._Layout,buildRendering:function(){this.inherited(arguments);if(!this.domNode.getAttribute("tabIndex")){this.domNode.tabIndex="0";}this.createScroller();this.createLayout();this.createViews();this.createManagers();this.createSelection();this.connect(this.selection,"onSelected","onSelected");this.connect(this.selection,"onDeselected","onDeselected");this.connect(this.selection,"onChanged","onSelectionChanged");dojox.html.metrics.initOnFontResize();this.connect(dojox.html.metrics,"onFontResize","textSizeChanged");dojox.grid.util.funnelEvents(this.domNode,this,"doKeyEvent",dojox.grid.util.keyEvents);if(this.selectionMode!="none"){dojo.attr(this.domNode,"aria-multiselectable",this.selectionMode=="single"?"false":"true");}dojo.addClass(this.domNode,this.classTag);if(!this.isLeftToRight()){dojo.addClass(this.domNode,this.classTag+"Rtl");}},postMixInProperties:function(){this.inherited(arguments);var _6cf=dojo.i18n.getLocalization("dijit","loading",this.lang);this.loadingMessage=dojo.string.substitute(this.loadingMessage,_6cf);this.errorMessage=dojo.string.substitute(this.errorMessage,_6cf);if(this.srcNodeRef&&this.srcNodeRef.style.height){this.height=this.srcNodeRef.style.height;}this._setAutoHeightAttr(this.autoHeight,true);this.lastScrollTop=this.scrollTop=0;},postCreate:function(){this._placeholders=[];this._setHeaderMenuAttr(this.headerMenu);this._setStructureAttr(this.structure);this._click=[];this.inherited(arguments);if(this.domNode&&this.autoWidth&&this.initialWidth){this.domNode.style.width=this.initialWidth;}if(this.domNode&&!this.editable){dojo.attr(this.domNode,"aria-readonly","true");}},destroy:function(){this.domNode.onReveal=null;this.domNode.onSizeChange=null;delete this._click;this.edit.destroy();delete this.edit;this.views.destroyViews();if(this.scroller){this.scroller.destroy();delete this.scroller;}if(this.focus){this.focus.destroy();delete this.focus;}if(this.headerMenu&&this._placeholders.length){dojo.forEach(this._placeholders,function(p){p.unReplace(true);});this.headerMenu.unBindDomNode(this.viewsHeaderNode);}this.inherited(arguments);},_setAutoHeightAttr:function(ah,_6d0){if(typeof ah=="string"){if(!ah||ah=="false"){ah=false;}else{if(ah=="true"){ah=true;}else{ah=window.parseInt(ah,10);}}}if(typeof ah=="number"){if(isNaN(ah)){ah=false;}if(ah<0){ah=true;}else{if(ah===0){ah=false;}}}this.autoHeight=ah;if(typeof ah=="boolean"){this._autoHeight=ah;}else{if(typeof ah=="number"){this._autoHeight=(ah>=this.get("rowCount"));}else{this._autoHeight=false;}}if(this._started&&!_6d0){this.render();}},_getRowCountAttr:function(){return this.updating&&this.invalidated&&this.invalidated.rowCount!=undefined?this.invalidated.rowCount:this.rowCount;},textSizeChanged:function(){this.render();},sizeChange:function(){this.update();},createManagers:function(){this.rows=new dojox.grid._RowManager(this);this.focus=new dojox.grid._FocusManager(this);this.edit=new dojox.grid._EditManager(this);},createSelection:function(){this.selection=new dojox.grid.Selection(this);},createScroller:function(){this.scroller=new dojox.grid._Scroller();this.scroller.grid=this;this.scroller.renderRow=dojo.hitch(this,"renderRow");this.scroller.removeRow=dojo.hitch(this,"rowRemoved");},createLayout:function(){this.layout=new this._layoutClass(this);this.connect(this.layout,"moveColumn","onMoveColumn");},onMoveColumn:function(){this.render();},onResizeColumn:function(_6d1){},createViews:function(){this.views=new dojox.grid._ViewManager(this);this.views.createView=dojo.hitch(this,"createView");},createView:function(_6d2,idx){var c=dojo.getObject(_6d2);var view=new c({grid:this,index:idx});this.viewsNode.appendChild(view.domNode);this.viewsHeaderNode.appendChild(view.headerNode);this.views.addView(view);dojo.attr(this.domNode,"align",dojo._isBodyLtr()?"left":"right");return view;},buildViews:function(){for(var i=0,vs;(vs=this.layout.structure[i]);i++){this.createView(vs.type||dojox._scopeName+".grid._View",i).setStructure(vs);}this.scroller.setContentNodes(this.views.getContentNodes());},_setStructureAttr:function(_6d3){var s=_6d3;if(s&&dojo.isString(s)){dojo.deprecated("dojox.grid._Grid.set('structure', 'objVar')","use dojox.grid._Grid.set('structure', objVar) instead","2.0");s=dojo.getObject(s);}this.structure=s;if(!s){if(this.layout.structure){s=this.layout.structure;}else{return;}}this.views.destroyViews();this.focus.focusView=null;if(s!==this.layout.structure){this.layout.setStructure(s);}this._structureChanged();},setStructure:function(_6d4){dojo.deprecated("dojox.grid._Grid.setStructure(obj)","use dojox.grid._Grid.set('structure', obj) instead.","2.0");this._setStructureAttr(_6d4);},getColumnTogglingItems:function(){return dojo.map(this.layout.cells,function(cell){if(!cell.menuItems){cell.menuItems=[];}var self=this;var item=new dijit.CheckedMenuItem({label:cell.name,checked:!cell.hidden,_gridCell:cell,onChange:function(_6d5){if(self.layout.setColumnVisibility(this._gridCell.index,_6d5)){var _6d6=this._gridCell.menuItems;if(_6d6.length>1){dojo.forEach(_6d6,function(item){if(item!==this){item.setAttribute("checked",_6d5);}},this);}_6d5=dojo.filter(self.layout.cells,function(c){if(c.menuItems.length>1){dojo.forEach(c.menuItems,"item.set('disabled', false);");}else{c.menuItems[0].set("disabled",false);}return !c.hidden;});if(_6d5.length==1){dojo.forEach(_6d5[0].menuItems,"item.set('disabled', true);");}}},destroy:function(){var _6d7=dojo.indexOf(this._gridCell.menuItems,this);this._gridCell.menuItems.splice(_6d7,1);delete this._gridCell;dijit.CheckedMenuItem.prototype.destroy.apply(this,arguments);}});cell.menuItems.push(item);return item;},this);},_setHeaderMenuAttr:function(menu){if(this._placeholders&&this._placeholders.length){dojo.forEach(this._placeholders,function(p){p.unReplace(true);});this._placeholders=[];}if(this.headerMenu){this.headerMenu.unBindDomNode(this.viewsHeaderNode);}this.headerMenu=menu;if(!menu){return;}this.headerMenu.bindDomNode(this.viewsHeaderNode);if(this.headerMenu.getPlaceholders){this._placeholders=this.headerMenu.getPlaceholders(this.placeholderLabel);}},setHeaderMenu:function(menu){dojo.deprecated("dojox.grid._Grid.setHeaderMenu(obj)","use dojox.grid._Grid.set('headerMenu', obj) instead.","2.0");this._setHeaderMenuAttr(menu);},setupHeaderMenu:function(){if(this._placeholders&&this._placeholders.length){dojo.forEach(this._placeholders,function(p){if(p._replaced){p.unReplace(true);}p.replace(this.getColumnTogglingItems());},this);}},_fetch:function(_6d8){this.setScrollTop(0);},getItem:function(_6d9){return null;},showMessage:function(_6da){if(_6da){this.messagesNode.innerHTML=_6da;this.messagesNode.style.display="";}else{this.messagesNode.innerHTML="";this.messagesNode.style.display="none";}},_structureChanged:function(){this.buildViews();if(this.autoRender&&this._started){this.render();}},hasLayout:function(){return this.layout.cells.length;},resize:function(_6db,_6dc){this._pendingChangeSize=_6db;this._pendingResultSize=_6dc;this.sizeChange();},_getPadBorder:function(){this._padBorder=this._padBorder||dojo._getPadBorderExtents(this.domNode);return this._padBorder;},_getHeaderHeight:function(){var vns=this.viewsHeaderNode.style,t=vns.display=="none"?0:this.views.measureHeader();vns.height=t+"px";this.views.normalizeHeaderNodeHeight();return t;},_resize:function(_6dd,_6de){_6dd=_6dd||this._pendingChangeSize;_6de=_6de||this._pendingResultSize;delete this._pendingChangeSize;delete this._pendingResultSize;if(!this.domNode){return;}var pn=this.domNode.parentNode;if(!pn||pn.nodeType!=1||!this.hasLayout()||pn.style.visibility=="hidden"||pn.style.display=="none"){return;}var _6df=this._getPadBorder();var hh=undefined;var h;if(this._autoHeight){this.domNode.style.height="auto";}else{if(typeof this.autoHeight=="number"){h=hh=this._getHeaderHeight();h+=(this.scroller.averageRowHeight*this.autoHeight);this.domNode.style.height=h+"px";}else{if(this.domNode.clientHeight<=_6df.h){if(pn==document.body){this.domNode.style.height=this.defaultHeight;}else{if(this.height){this.domNode.style.height=this.height;}else{this.fitTo="parent";}}}}}if(_6de){_6dd=_6de;}if(_6dd){dojo.marginBox(this.domNode,_6dd);this.height=this.domNode.style.height;delete this.fitTo;}else{if(this.fitTo=="parent"){h=this._parentContentBoxHeight=this._parentContentBoxHeight||dojo._getContentBox(pn).h;this.domNode.style.height=Math.max(0,h)+"px";}}var _6e0=dojo.some(this.views.views,function(v){return v.flexCells;});if(!this._autoHeight&&(h||dojo._getContentBox(this.domNode).h)===0){this.viewsHeaderNode.style.display="none";}else{this.viewsHeaderNode.style.display="block";if(!_6e0&&hh===undefined){hh=this._getHeaderHeight();}}if(_6e0){hh=undefined;}this.adaptWidth();this.adaptHeight(hh);this.postresize();},adaptWidth:function(){var _6e1=(!this.initialWidth&&this.autoWidth);var w=_6e1?0:this.domNode.clientWidth||(this.domNode.offsetWidth-this._getPadBorder().w),vw=this.views.arrange(1,w);this.views.onEach("adaptWidth");if(_6e1){this.domNode.style.width=vw+"px";}},adaptHeight:function(_6e2){var t=_6e2===undefined?this._getHeaderHeight():_6e2;var h=(this._autoHeight?-1:Math.max(this.domNode.clientHeight-t,0)||0);this.views.onEach("setSize",[0,h]);this.views.onEach("adaptHeight");if(!this._autoHeight){var _6e3=0,_6e4=0;var _6e5=dojo.filter(this.views.views,function(v){var has=v.hasHScrollbar();if(has){_6e3++;}else{_6e4++;}return (!has);});if(_6e3>0&&_6e4>0){dojo.forEach(_6e5,function(v){v.adaptHeight(true);});}}if(this.autoHeight===true||h!=-1||(typeof this.autoHeight=="number"&&this.autoHeight>=this.get("rowCount"))){this.scroller.windowHeight=h;}else{this.scroller.windowHeight=Math.max(this.domNode.clientHeight-t,0);}},startup:function(){if(this._started){return;}this.inherited(arguments);if(this.autoRender){this.render();}},render:function(){if(!this.domNode){return;}if(!this._started){return;}if(!this.hasLayout()){this.scroller.init(0,this.keepRows,this.rowsPerPage);return;}this.update=this.defaultUpdate;this._render();},_render:function(){this.scroller.init(this.get("rowCount"),this.keepRows,this.rowsPerPage);this.prerender();this.setScrollTop(0);this.postrender();},prerender:function(){this.keepRows=this._autoHeight?0:this.keepRows;this.scroller.setKeepInfo(this.keepRows);this.views.render();this._resize();},postrender:function(){this.postresize();this.focus.initFocusView();dojo.setSelectable(this.domNode,this.selectable);},postresize:function(){if(this._autoHeight){var size=Math.max(this.views.measureContent())+"px";this.viewsNode.style.height=size;}},renderRow:function(_6e6,_6e7){this.views.renderRow(_6e6,_6e7,this._skipRowRenormalize);},rowRemoved:function(_6e8){this.views.rowRemoved(_6e8);},invalidated:null,updating:false,beginUpdate:function(){this.invalidated=[];this.updating=true;},endUpdate:function(){this.updating=false;var i=this.invalidated,r;if(i.all){this.update();}else{if(i.rowCount!=undefined){this.updateRowCount(i.rowCount);}else{for(r in i){this.updateRow(Number(r));}}}this.invalidated=[];},defaultUpdate:function(){if(!this.domNode){return;}if(this.updating){this.invalidated.all=true;return;}this.lastScrollTop=this.scrollTop;this.prerender();this.scroller.invalidateNodes();this.setScrollTop(this.lastScrollTop);this.postrender();},update:function(){this.render();},updateRow:function(_6e9){_6e9=Number(_6e9);if(this.updating){this.invalidated[_6e9]=true;}else{this.views.updateRow(_6e9);this.scroller.rowHeightChanged(_6e9);}},updateRows:function(_6ea,_6eb){_6ea=Number(_6ea);_6eb=Number(_6eb);var i;if(this.updating){for(i=0;i<_6eb;i++){this.invalidated[i+_6ea]=true;}}else{for(i=0;i<_6eb;i++){this.views.updateRow(i+_6ea,this._skipRowRenormalize);}this.scroller.rowHeightChanged(_6ea);}},updateRowCount:function(_6ec){if(this.updating){this.invalidated.rowCount=_6ec;}else{this.rowCount=_6ec;this._setAutoHeightAttr(this.autoHeight,true);if(this.layout.cells.length){this.scroller.updateRowCount(_6ec);}this._resize();if(this.layout.cells.length){this.setScrollTop(this.scrollTop);}}},updateRowStyles:function(_6ed){this.views.updateRowStyles(_6ed);},getRowNode:function(_6ee){if(this.focus.focusView&&!(this.focus.focusView instanceof dojox.grid._RowSelector)){return this.focus.focusView.rowNodes[_6ee];}else{for(var i=0,_6ef;(_6ef=this.views.views[i]);i++){if(!(_6ef instanceof dojox.grid._RowSelector)){return _6ef.rowNodes[_6ee];}}}return null;},rowHeightChanged:function(_6f0){this.views.renormalizeRow(_6f0);this.scroller.rowHeightChanged(_6f0);},fastScroll:true,delayScroll:false,scrollRedrawThreshold:(dojo.isIE?100:50),scrollTo:function(_6f1){if(!this.fastScroll){this.setScrollTop(_6f1);return;}var _6f2=Math.abs(this.lastScrollTop-_6f1);this.lastScrollTop=_6f1;if(_6f2>this.scrollRedrawThreshold||this.delayScroll){this.delayScroll=true;this.scrollTop=_6f1;this.views.setScrollTop(_6f1);if(this._pendingScroll){window.clearTimeout(this._pendingScroll);}var _6f3=this;this._pendingScroll=window.setTimeout(function(){delete _6f3._pendingScroll;_6f3.finishScrollJob();},200);}else{this.setScrollTop(_6f1);}},finishScrollJob:function(){this.delayScroll=false;this.setScrollTop(this.scrollTop);},setScrollTop:function(_6f4){this.scroller.scroll(this.views.setScrollTop(_6f4));},scrollToRow:function(_6f5){this.setScrollTop(this.scroller.findScrollTop(_6f5)+1);},styleRowNode:function(_6f6,_6f7){if(_6f7){this.rows.styleRowNode(_6f6,_6f7);}},_mouseOut:function(e){this.rows.setOverRow(-2);},getCell:function(_6f8){return this.layout.cells[_6f8];},setCellWidth:function(_6f9,_6fa){this.getCell(_6f9).unitWidth=_6fa;},getCellName:function(_6fb){return "Cell "+_6fb.index;},canSort:function(_6fc){},sort:function(){},getSortAsc:function(_6fd){_6fd=_6fd==undefined?this.sortInfo:_6fd;return Boolean(_6fd>0);},getSortIndex:function(_6fe){_6fe=_6fe==undefined?this.sortInfo:_6fe;return Math.abs(_6fe)-1;},setSortIndex:function(_6ff,_700){var si=_6ff+1;if(_700!=undefined){si*=(_700?1:-1);}else{if(this.getSortIndex()==_6ff){si=-this.sortInfo;}}this.setSortInfo(si);},setSortInfo:function(_701){if(this.canSort(_701)){this.sortInfo=_701;this.sort();this.update();}},doKeyEvent:function(e){e.dispatch="do"+e.type;this.onKeyEvent(e);},_dispatch:function(m,e){if(m in this){return this[m](e);}return false;},dispatchKeyEvent:function(e){this._dispatch(e.dispatch,e);},dispatchContentEvent:function(e){this.edit.dispatchEvent(e)||e.sourceView.dispatchContentEvent(e)||this._dispatch(e.dispatch,e);},dispatchHeaderEvent:function(e){e.sourceView.dispatchHeaderEvent(e)||this._dispatch("doheader"+e.type,e);},dokeydown:function(e){this.onKeyDown(e);},doclick:function(e){if(e.cellNode){this.onCellClick(e);}else{this.onRowClick(e);}},dodblclick:function(e){if(e.cellNode){this.onCellDblClick(e);}else{this.onRowDblClick(e);}},docontextmenu:function(e){if(e.cellNode){this.onCellContextMenu(e);}else{this.onRowContextMenu(e);}},doheaderclick:function(e){if(e.cellNode){this.onHeaderCellClick(e);}else{this.onHeaderClick(e);}},doheaderdblclick:function(e){if(e.cellNode){this.onHeaderCellDblClick(e);}else{this.onHeaderDblClick(e);}},doheadercontextmenu:function(e){if(e.cellNode){this.onHeaderCellContextMenu(e);}else{this.onHeaderContextMenu(e);}},doStartEdit:function(_702,_703){this.onStartEdit(_702,_703);},doApplyCellEdit:function(_704,_705,_706){this.onApplyCellEdit(_704,_705,_706);},doCancelEdit:function(_707){this.onCancelEdit(_707);},doApplyEdit:function(_708){this.onApplyEdit(_708);},addRow:function(){this.updateRowCount(this.get("rowCount")+1);},removeSelectedRows:function(){if(this.allItemsSelected){this.updateRowCount(0);}else{this.updateRowCount(Math.max(0,this.get("rowCount")-this.selection.getSelected().length));}this.selection.clear();}});dojox.grid._Grid.markupFactory=function(_709,node,ctor,_70a){var d=dojo;var _70b=function(n){var w=d.attr(n,"width")||"auto";if((w!="auto")&&(w.slice(-2)!="em")&&(w.slice(-1)!="%")){w=parseInt(w,10)+"px";}return w;};if(!_709.structure&&node.nodeName.toLowerCase()=="table"){_709.structure=d.query("> colgroup",node).map(function(cg){var sv=d.attr(cg,"span");var v={noscroll:(d.attr(cg,"noscroll")=="true")?true:false,__span:(!!sv?parseInt(sv,10):1),cells:[]};if(d.hasAttr(cg,"width")){v.width=_70b(cg);}return v;});if(!_709.structure.length){_709.structure.push({__span:Infinity,cells:[]});}d.query("thead > tr",node).forEach(function(tr,_70c){var _70d=0;var _70e=0;var _70f;var _710=null;d.query("> th",tr).map(function(th){if(!_710){_70f=0;_710=_709.structure[0];}else{if(_70d>=(_70f+_710.__span)){_70e++;_70f+=_710.__span;var _711=_710;_710=_709.structure[_70e];}}var cell={name:d.trim(d.attr(th,"name")||th.innerHTML),colSpan:parseInt(d.attr(th,"colspan")||1,10),type:d.trim(d.attr(th,"cellType")||""),id:d.trim(d.attr(th,"id")||"")};_70d+=cell.colSpan;var _712=d.attr(th,"rowspan");if(_712){cell.rowSpan=_712;}if(d.hasAttr(th,"width")){cell.width=_70b(th);}if(d.hasAttr(th,"relWidth")){cell.relWidth=window.parseInt(dojo.attr(th,"relWidth"),10);}if(d.hasAttr(th,"hidden")){cell.hidden=(d.attr(th,"hidden")=="true"||d.attr(th,"hidden")===true);}if(_70a){_70a(th,cell);}cell.type=cell.type?dojo.getObject(cell.type):dojox.grid.cells.Cell;if(cell.type&&cell.type.markupFactory){cell.type.markupFactory(th,cell);}if(!_710.cells[_70c]){_710.cells[_70c]=[];}_710.cells[_70c].push(cell);});});}return new ctor(_709,node);};})();}if(!dojo._hasResource["dojox.grid.DataSelection"]){dojo._hasResource["dojox.grid.DataSelection"]=true;dojo.provide("dojox.grid.DataSelection");dojo.declare("dojox.grid.DataSelection",dojox.grid.Selection,{getFirstSelected:function(){var idx=dojox.grid.Selection.prototype.getFirstSelected.call(this);if(idx==-1){return null;}return this.grid.getItem(idx);},getNextSelected:function(_713){var _714=this.grid.getItemIndex(_713);var idx=dojox.grid.Selection.prototype.getNextSelected.call(this,_714);if(idx==-1){return null;}return this.grid.getItem(idx);},getSelected:function(){var _715=[];for(var i=0,l=this.selected.length;i<l;i++){if(this.selected[i]){_715.push(this.grid.getItem(i));}}return _715;},addToSelection:function(_716){if(this.mode=="none"){return;}var idx=null;if(typeof _716=="number"||typeof _716=="string"){idx=_716;}else{idx=this.grid.getItemIndex(_716);}dojox.grid.Selection.prototype.addToSelection.call(this,idx);},deselect:function(_717){if(this.mode=="none"){return;}var idx=null;if(typeof _717=="number"||typeof _717=="string"){idx=_717;}else{idx=this.grid.getItemIndex(_717);}dojox.grid.Selection.prototype.deselect.call(this,idx);},deselectAll:function(_718){var idx=null;if(_718||typeof _718=="number"){if(typeof _718=="number"||typeof _718=="string"){idx=_718;}else{idx=this.grid.getItemIndex(_718);}dojox.grid.Selection.prototype.deselectAll.call(this,idx);}else{this.inherited(arguments);}}});}if(!dojo._hasResource["dojox.grid.DataGrid"]){dojo._hasResource["dojox.grid.DataGrid"]=true;dojo.provide("dojox.grid.DataGrid");dojo.declare("dojox.grid.DataGrid",dojox.grid._Grid,{store:null,query:null,queryOptions:null,fetchText:"...",sortFields:null,updateDelay:1,items:null,_store_connects:null,_by_idty:null,_by_idx:null,_cache:null,_pages:null,_pending_requests:null,_bop:-1,_eop:-1,_requests:0,rowCount:0,_isLoaded:false,_isLoading:false,postCreate:function(){this._pages=[];this._store_connects=[];this._by_idty={};this._by_idx=[];this._cache=[];this._pending_requests={};this._setStore(this.store);this.inherited(arguments);},createSelection:function(){this.selection=new dojox.grid.DataSelection(this);},get:function(_719,_71a){if(_71a&&this.field=="_item"&&!this.fields){return _71a;}else{if(_71a&&this.fields){var ret=[];var s=this.grid.store;dojo.forEach(this.fields,function(f){ret=ret.concat(s.getValues(_71a,f));});return ret;}else{if(!_71a&&typeof _719==="string"){return this.inherited(arguments);}}}return (!_71a?this.defaultValue:(!this.field?this.value:(this.field=="_item"?_71a:this.grid.store.getValue(_71a,this.field))));},_checkUpdateStatus:function(){if(this.updateDelay>0){var _71b=false;if(this._endUpdateDelay){clearTimeout(this._endUpdateDelay);delete this._endUpdateDelay;_71b=true;}if(!this.updating){this.beginUpdate();_71b=true;}if(_71b){var _71c=this;this._endUpdateDelay=setTimeout(function(){delete _71c._endUpdateDelay;_71c.endUpdate();},this.updateDelay);}}},_onSet:function(item,_71d,_71e,_71f){this._checkUpdateStatus();var idx=this.getItemIndex(item);if(idx>-1){this.updateRow(idx);}},_createItem:function(item,_720){var idty=this._hasIdentity?this.store.getIdentity(item):dojo.toJson(this.query)+":idx:"+_720+":sort:"+dojo.toJson(this.getSortProps());var o=this._by_idty[idty]={idty:idty,item:item};return o;},_addItem:function(item,_721,_722){this._by_idx[_721]=this._createItem(item,_721);if(!_722){this.updateRow(_721);}},_onNew:function(item,_723){this._checkUpdateStatus();var _724=this.get("rowCount");this._addingItem=true;this.updateRowCount(_724+1);this._addingItem=false;this._addItem(item,_724);this.showMessage();},_onDelete:function(item){this._checkUpdateStatus();var idx=this._getItemIndex(item,true);if(idx>=0){this._pages=[];this._bop=-1;this._eop=-1;var o=this._by_idx[idx];this._by_idx.splice(idx,1);delete this._by_idty[o.idty];this.updateRowCount(this.get("rowCount")-1);if(this.get("rowCount")===0){this.showMessage(this.noDataMessage);}}},_onRevert:function(){this._refresh();},setStore:function(_725,_726,_727){this._setQuery(_726,_727);this._setStore(_725);this._refresh(true);},setQuery:function(_728,_729){this._setQuery(_728,_729);this._refresh(true);},setItems:function(_72a){this.items=_72a;this._setStore(this.store);this._refresh(true);},_setQuery:function(_72b,_72c){this.query=_72b;this.queryOptions=_72c||this.queryOptions;},_setStore:function(_72d){if(this.store&&this._store_connects){dojo.forEach(this._store_connects,this.disconnect,this);}this.store=_72d;if(this.store){var f=this.store.getFeatures();var h=[];this._canEdit=!!f["dojo.data.api.Write"]&&!!f["dojo.data.api.Identity"];this._hasIdentity=!!f["dojo.data.api.Identity"];if(!!f["dojo.data.api.Notification"]&&!this.items){h.push(this.connect(this.store,"onSet","_onSet"));h.push(this.connect(this.store,"onNew","_onNew"));h.push(this.connect(this.store,"onDelete","_onDelete"));}if(this._canEdit){h.push(this.connect(this.store,"revert","_onRevert"));}this._store_connects=h;}},_onFetchBegin:function(size,req){if(!this.scroller){return;}if(this.rowCount!=size){if(req.isRender){this.scroller.init(size,this.keepRows,this.rowsPerPage);this.rowCount=size;this._setAutoHeightAttr(this.autoHeight,true);this._skipRowRenormalize=true;this.prerender();this._skipRowRenormalize=false;}else{this.updateRowCount(size);}}if(!size){this.views.render();this._resize();this.showMessage(this.noDataMessage);this.focus.initFocusView();}else{this.showMessage();}},_onFetchComplete:function(_72e,req){if(!this.scroller){return;}if(_72e&&_72e.length>0){dojo.forEach(_72e,function(item,idx){this._addItem(item,req.start+idx,true);},this);this.updateRows(req.start,_72e.length);if(req.isRender){this.setScrollTop(0);this.postrender();}else{if(this._lastScrollTop){this.setScrollTop(this._lastScrollTop);}}}delete this._lastScrollTop;if(!this._isLoaded){this._isLoading=false;this._isLoaded=true;}this._pending_requests[req.start]=false;},_onFetchError:function(err,req){console.log(err);delete this._lastScrollTop;if(!this._isLoaded){this._isLoading=false;this._isLoaded=true;this.showMessage(this.errorMessage);}this._pending_requests[req.start]=false;this.onFetchError(err,req);},onFetchError:function(err,req){},_fetch:function(_72f,_730){_72f=_72f||0;if(this.store&&!this._pending_requests[_72f]){if(!this._isLoaded&&!this._isLoading){this._isLoading=true;this.showMessage(this.loadingMessage);}this._pending_requests[_72f]=true;try{if(this.items){var _731=this.items;var _732=this.store;this.rowsPerPage=_731.length;var req={start:_72f,count:this.rowsPerPage,isRender:_730};this._onFetchBegin(_731.length,req);var _733=0;dojo.forEach(_731,function(i){if(!_732.isItemLoaded(i)){_733++;}});if(_733===0){this._onFetchComplete(_731,req);}else{var _734=function(item){_733--;if(_733===0){this._onFetchComplete(_731,req);}};dojo.forEach(_731,function(i){if(!_732.isItemLoaded(i)){_732.loadItem({item:i,onItem:_734,scope:this});}},this);}}else{this.store.fetch({start:_72f,count:this.rowsPerPage,query:this.query,sort:this.getSortProps(),queryOptions:this.queryOptions,isRender:_730,onBegin:dojo.hitch(this,"_onFetchBegin"),onComplete:dojo.hitch(this,"_onFetchComplete"),onError:dojo.hitch(this,"_onFetchError")});}}catch(e){this._onFetchError(e,{start:_72f,count:this.rowsPerPage});}}},_clearData:function(){this.updateRowCount(0);this._by_idty={};this._by_idx=[];this._pages=[];this._bop=this._eop=-1;this._isLoaded=false;this._isLoading=false;},getItem:function(idx){var data=this._by_idx[idx];if(!data||(data&&!data.item)){this._preparePage(idx);return null;}return data.item;},getItemIndex:function(item){return this._getItemIndex(item,false);},_getItemIndex:function(item,_735){if(!_735&&!this.store.isItem(item)){return -1;}var idty=this._hasIdentity?this.store.getIdentity(item):null;for(var i=0,l=this._by_idx.length;i<l;i++){var d=this._by_idx[i];if(d&&((idty&&d.idty==idty)||(d.item===item))){return i;}}return -1;},filter:function(_736,_737){this.query=_736;if(_737){this._clearData();}this._fetch();},_getItemAttr:function(idx,attr){var item=this.getItem(idx);return (!item?this.fetchText:this.store.getValue(item,attr));},_render:function(){if(this.domNode.parentNode){this.scroller.init(this.get("rowCount"),this.keepRows,this.rowsPerPage);this.prerender();this._fetch(0,true);}},_requestsPending:function(_738){return this._pending_requests[_738];},_rowToPage:function(_739){return (this.rowsPerPage?Math.floor(_739/this.rowsPerPage):_739);},_pageToRow:function(_73a){return (this.rowsPerPage?this.rowsPerPage*_73a:_73a);},_preparePage:function(_73b){if((_73b<this._bop||_73b>=this._eop)&&!this._addingItem){var _73c=this._rowToPage(_73b);this._needPage(_73c);this._bop=_73c*this.rowsPerPage;this._eop=this._bop+(this.rowsPerPage||this.get("rowCount"));}},_needPage:function(_73d){if(!this._pages[_73d]){this._pages[_73d]=true;this._requestPage(_73d);}},_requestPage:function(_73e){var row=this._pageToRow(_73e);var _73f=Math.min(this.rowsPerPage,this.get("rowCount")-row);if(_73f>0){this._requests++;if(!this._requestsPending(row)){setTimeout(dojo.hitch(this,"_fetch",row,false),1);}}},getCellName:function(_740){return _740.field;},_refresh:function(_741){this._clearData();this._fetch(0,_741);},sort:function(){this.edit.apply();this._lastScrollTop=this.scrollTop;this._refresh();},canSort:function(){return (!this._isLoading);},getSortProps:function(){var c=this.getCell(this.getSortIndex());if(!c){if(this.sortFields){return this.sortFields;}return null;}else{var desc=c["sortDesc"];var si=!(this.sortInfo>0);if(typeof desc=="undefined"){desc=si;}else{desc=si?!desc:desc;}return [{attribute:c.field,descending:desc}];}},styleRowState:function(_742){if(this.store&&this.store.getState){var _743=this.store.getState(_742.index),c="";for(var i=0,ss=["inflight","error","inserting"],s;s=ss[i];i++){if(_743[s]){c=" dojoxGridRow-"+s;break;}}_742.customClasses+=c;}},onStyleRow:function(_744){this.styleRowState(_744);this.inherited(arguments);},canEdit:function(_745,_746){return this._canEdit;},_copyAttr:function(idx,attr){var row={};var _747={};var src=this.getItem(idx);return this.store.getValue(src,attr);},doStartEdit:function(_748,_749){if(!this._cache[_749]){this._cache[_749]=this._copyAttr(_749,_748.field);}this.onStartEdit(_748,_749);},doApplyCellEdit:function(_74a,_74b,_74c){this.store.fetchItemByIdentity({identity:this._by_idx[_74b].idty,onItem:dojo.hitch(this,function(item){var _74d=this.store.getValue(item,_74c);if(typeof _74d=="number"){_74a=isNaN(_74a)?_74a:parseFloat(_74a);}else{if(typeof _74d=="boolean"){_74a=_74a=="true"?true:_74a=="false"?false:_74a;}else{if(_74d instanceof Date){var _74e=new Date(_74a);_74a=isNaN(_74e.getTime())?_74a:_74e;}}}this.store.setValue(item,_74c,_74a);this.onApplyCellEdit(_74a,_74b,_74c);})});},doCancelEdit:function(_74f){var _750=this._cache[_74f];if(_750){this.updateRow(_74f);delete this._cache[_74f];}this.onCancelEdit.apply(this,arguments);},doApplyEdit:function(_751,_752){var _753=this._cache[_751];this.onApplyEdit(_751);},removeSelectedRows:function(){if(this._canEdit){this.edit.apply();var fx=dojo.hitch(this,function(_754){if(_754.length){dojo.forEach(_754,this.store.deleteItem,this.store);this.selection.clear();}});if(this.allItemsSelected){this.store.fetch({query:this.query,queryOptions:this.queryOptions,onComplete:fx});}else{fx(this.selection.getSelected());}}}});dojox.grid.DataGrid.cell_markupFactory=function(_755,node,_756){var _757=dojo.trim(dojo.attr(node,"field")||"");if(_757){_756.field=_757;}_756.field=_756.field||_756.name;var _758=dojo.trim(dojo.attr(node,"fields")||"");if(_758){_756.fields=_758.split(",");}if(_755){_755(node,_756);}};dojox.grid.DataGrid.markupFactory=function(_759,node,ctor,_75a){return dojox.grid._Grid.markupFactory(_759,node,ctor,dojo.partial(dojox.grid.DataGrid.cell_markupFactory,_75a));};}if(!dojo._hasResource["esri.dijit.editing.TemplatePicker"]){dojo._hasResource["esri.dijit.editing.TemplatePicker"]=true;dojo.provide("esri.dijit.editing.TemplatePicker");(function(){var css=[dojo.moduleUrl("esri.dijit.editing","css/TemplatePicker.css"),dojo.moduleUrl("dojox","grid/resources/Grid.css")];var head=document.getElementsByTagName("head").item(0),link;for(var i=0,il=css.length;i<il;i++){link=document.createElement("link");link.type="text/css";link.rel="stylesheet";link.href=css[i].toString();head.appendChild(link);}}());dojo.declare("esri.dijit.editing.TemplatePicker",[dijit._Widget,dijit._Templated],{widgetsInTemplate:true,templateString:"<div class=\"templatePicker\">\r\n\r\n  <table dojoType=\"dojox.grid.DataGrid\" noDataMessage=\"${emptyMessage}\" selectionMode=\"none\" autoHeight=\"${_rows}\" autoWidth=\"${_autoWidth}\"\r\n         query=\"{ query: '*' }\" dojoAttachPoint=\"grid\" class=\"grid\">\r\n  </table>\r\n  \r\n</div>\r\n",basePath:dojo.moduleUrl("esri.dijit.editing"),featureLayers:null,items:null,grouping:true,showTooltip:false,maxLabelLength:0,rows:4,columns:3,surfaceWidth:30,surfaceHeight:30,emptyMessage:"",_uniqueId:{id:0},_assumedCellWidth:90,_initialAutoWidth:300,_initialAutoHeight:200,_ieTimer:150,constructor:function(_75b,_75c){_75b=_75b||{};if(!_75b.items&&!_75b.featureLayers){console.error("TemplatePicker: please provide 'featureLayers' or 'items' parameter in the constructor");}this._dojo14x=(dojo.version.minor>=4);this._itemWidgets={};this.emptyMessage=_75b.emptyMessage||dojo.getObject("bundle.widgets.templatePicker.creationDisabled",false,esri)||"";},postMixInProperties:function(){this.inherited(arguments);this._preprocess();},startup:function(){this.inherited(arguments);if(this.rows==="auto"&&this.columns==="auto"){var box=dojo.contentBox(this.domNode);if(!box.w){this.domNode.style.width=this._initialAutoWidth+"px";}if(!box.h){this.domNode.style.height=this._initialAutoHeight+"px";}box=dojo.contentBox(this.domNode);this._columns=Math.floor(box.w/this._assumedCellWidth)||1;}this._applyGridPatches();this._setGridLayout();dojo.connect(this.grid,"onRowClick",this,this._rowClicked);this._setGridData();this._toggleTooltip();if(dojo.isIE<9){this._repaintItems=dojo.hitch(this,this._repaintItems);setTimeout(this._repaintItems,this._ieTimer);}},destroy:function(){this.showTooltip=false;this._toggleTooltip();this.featureLayers=this.items=this.grid=this._flItems=this._itItems=this._groupRowIndices=this._selectedCell=this._selectedInfo=this._selectedItem=null;this.inherited(arguments);},getSelected:function(){return this._selectedCell?this._selectedItem:null;},clearSelection:function(){var _75d=this._selectedCell,info=this._selectedInfo;if(_75d){this._rowClicked({cellNode:_75d,rowIndex:info.selRow,cellIndex:info.selCol});}},update:function(_75e){var _75f=(this.rows==="auto"&&this.columns==="auto"&&_75e)?true:false;var grid=this.grid;if(_75f){var _760=this.domNode,box=dojo.contentBox(_760),id=_760.id;this._columns=Math.floor((box.w-grid.views.views[0].getScrollbarWidth())/dojo.coords(dojo.query("#"+id+".templatePicker div.item")[0].parentNode).w);this._columns=this._columns||1;}var _761=this._rows;this._preprocess();var _762=this._rows;this._setGridLayout();this._setGridData();if(_762!==_761){grid.set("autoHeight",this._rows,false);}if(_75f){grid._resize({w:box.w,h:box.h});grid.viewsHeaderNode.style.display="none";}else{grid.update();}this._toggleTooltip();var self=this,_763=this.getSelected();if(_763){grid.store.fetch({onComplete:function(its){var _764=self._locate(_763,self._selectedInfo,its);var _765=_764&&grid.views.views[0].getCellNode(_764[0],_764[1]);if(_765){self._rowClicked({cellNode:_765,rowIndex:_764[0],cellIndex:_764[1]},true);}}});}if(dojo.isIE<9){setTimeout(this._repaintItems,this._ieTimer);}var _766=this.featureLayers,_767=this.items;if((!_766||!_766.length)&&(!_767||!_767.length)&&grid&&this.emptyMessage){grid.showMessage(this.emptyMessage);}},onSelectionChange:function(){},_preprocess:function(){if(this.items){this.grouping=false;}this._autoWidth=false;if(this.rows==="auto"||this.columns==="auto"){this._autoWidth=true;}var _768;if(this.featureLayers){_768=this._flItems=this._getItemsFromLayers(this.featureLayers);}else{_768=this._itItems=this._getItemsFromItems(this.items);}if(this.rows==="auto"&&this.columns==="auto"){if(!this._started){this._rows=false;this._columns=null;this._autoWidth=false;}return;}var len=0;this._rows=this.rows;this._columns=this.columns;if(this.rows==="auto"){if(this.featureLayers){if(this.grouping){len=_768.length;dojo.forEach(_768,function(_769){len+=Math.ceil(_769.length/this.columns);},this);}else{dojo.forEach(_768,function(_76a){len+=_76a.length;},this);len=Math.ceil(len/this.columns);}}else{len=Math.ceil(_768.length/this.columns);}this._rows=len;}else{if(this.columns==="auto"){if(this.featureLayers){if(this.grouping){len=3;}else{dojo.forEach(_768,function(_76b){len+=_76b.length;},this);len=Math.ceil(len/this.rows);}}else{len=Math.ceil(_768.length/this.rows);}this._columns=len;}}},_applyGridPatches:function(){var grid=this.grid;var _76c=grid.adaptWidth;grid.adaptWidth=function(){var _76d=this.views.views;for(var i=0,view;view=_76d[i];i++){dojo.style(view.headerNode,"display","block");}_76c.apply(this,arguments);for(var i=0,view;view=_76d[i];i++){dojo.style(view.headerNode,"display","none");}};if(this._dojo14x){if(this.rows!=="auto"&&this.columns!=="auto"){var _76e=dojo.connect(grid,"_onFetchComplete",this,function(){dojo.disconnect(_76e);this.grid.set("autoHeight",this._rows);});}dojo.connect(grid,"_onDelete",this,this._destroyItems);dojo.connect(grid,"_clearData",this,this._destroyItems);dojo.connect(grid,"destroy",this,this._destroyItems);var _76f=grid.focus;if(_76f&&_76f.findAndFocusGridCell){_76f.findAndFocusGridCell=function(){return false;};}}},_setGridLayout:function(){var _770=function(_771){return function(_772,_773){return this._cellGet(_771,_772,_773);};};var _774=dojo.hitch(this,this._cellFormatter);var _775=[],cols=this._columns;for(var i=0;i<cols;i++){_775.push({field:"cell"+i,get:dojo.hitch(this,_770(i)),formatter:_774});}var _776={cells:[_775]};if(this.grouping){var _777={field:"groupName",colSpan:cols,get:dojo.hitch(this,this._cellGetGroup),formatter:dojo.hitch(this,this._cellGroupFormatter)};_776.cells.push([_777]);}var grid=this.grid;grid.set("structure",_776);},_setGridData:function(){var _778=[];if(this.grouping){this._groupRowIndices=[];var _779,_77a,cols=this._columns;dojo.forEach(this._flItems,function(_77b,idx){_778.push({});var _77c=(idx===0)?0:(_779+_77a+1);this._groupRowIndices.push(_77c);_779=_77c;_77a=Math.ceil(_77b.length/cols);_778=_778.concat(this._getStoreItems(_77b));},this);}else{if(this.featureLayers){dojo.forEach(this._flItems,function(_77d){_778=_778.concat(_77d);});_778=this._getStoreItems(_778);}else{_778=this._getStoreItems(this._itItems);}}var _77e=new dojo.data.ItemFileReadStore({data:{items:_778}});this.grid.setStore(_77e);},_toggleTooltip:function(){if(this.showTooltip){if(this.tooltip){return;}this.tooltip=dojo.create("div",{"class":"tooltip"},this.domNode);this.tooltip.style.display="none";this.tooltip.style.position="fixed";var grid=this.grid;this._mouseOverConnect=dojo.connect(grid,"onCellMouseOver",this,this._cellMouseOver);this._mouseOutConnect=dojo.connect(grid,"onCellMouseOut",this,this._cellMouseOut);}else{if(this.tooltip){dojo.disconnect(this._mouseOverConnect);dojo.disconnect(this._mouseOutConnect);dojo.destroy(this.tooltip);this.tooltip=null;}}},_rowClicked:function(evt,_77f){var _780=evt.cellNode,row=evt.rowIndex,col=evt.cellIndex;var cell=this._getCellInfo(_780,row,col);if(!cell){return;}if(this._selectedCell){dojo.removeClass(this._selectedCell,"selectedItem");}if(_780!==this._selectedCell){dojo.addClass(_780,"selectedItem");this._selectedCell=_780;var _781=this.grid.store;this._selectedItem={featureLayer:_781.getValue(cell,"layer"),type:_781.getValue(cell,"type"),template:_781.getValue(cell,"template"),symbolInfo:_781.getValue(cell,"symbolInfo"),item:this._getItem(cell)};this._selectedInfo={selRow:row,selCol:col,index1:_781.getValue(cell,"index1"),index2:_781.getValue(cell,"index2"),index:_781.getValue(cell,"index")};}else{this._selectedCell=this._selectedInfo=this._selectedItem=null;}if(!_77f){this.onSelectionChange();}},_locate:function(_782,info,_783){var _784=this.grid.store,cols=new Array(this._columns);var _785,_786=info.index1,_787=info.index2,_788=info.index,item=_782.item;dojo.some(_783,function(_789,_78a){return dojo.some(cols,function(_78b,_78c){var cell=_784.getValue(_789,"cell"+_78c);if(cell&&(item?(_788===_784.getValue(cell,"index")):(_786===_784.getValue(cell,"index1")&&_787===_784.getValue(cell,"index2")))){_785=[_78a,_78c];return true;}else{return false;}});});return _785;},_getCellInfo:function(_78d,row,col){if(!_78d){return;}var grid=this.grid;var item=grid.getItem(row);var cell=grid.store.getValue(item,"cell"+col);return cell;},_getItem:function(cell){var _78e=this.items;if(_78e){return _78e[this.grid.store.getValue(cell,"index")];}},_cellMouseOver:function(evt){var _78f=this.tooltip;var _790=evt.cellNode,row=evt.rowIndex,col=evt.cellIndex;var cell=this._getCellInfo(_790,row,col);if(_78f&&cell){var _791=this.grid.store;var _792=_791.getValue(cell,"template");var type=_791.getValue(cell,"type");var _793=_791.getValue(cell,"symbolInfo");var _794=_791.getValue(cell,"layer");var item=this._getItem(cell);var _795=(item&&(item.label+(item.description?(": "+item.description):"")))||(_792&&(_792.name+(_792.description?(": "+_792.description):"")))||(type&&type.name)||(_793&&(_793.label+(_793.description?(": "+_793.description):"")))||((_794&&_794.name+": ")+"Default");_78f.style.display="none";_78f.innerHTML=_795;var _796=dojo.coords(_790.firstChild);dojo.style(_78f,{left:(_796.x)+"px",top:(_796.y+_796.h+5)+"px"});_78f.style.display="";}},_cellMouseOut:function(){var _797=this.tooltip;if(_797){_797.style.display="none";}},_destroyItems:function(){var _798=this._itemWidgets;for(var w in _798){if(!_798[w]){continue;}_798[w].destroy();delete _798[w];}},_repaintItems:function(){var _799=this._itemWidgets;for(var w in _799){var _79a=_799[w];if(_79a){_79a._repaint(_79a._surface);}}},_getStoreItems:function(_79b){var uid=this._uniqueId;_79b=dojo.map(_79b,function(item){return dojo.mixin({"surfaceId":"tpick-surface-"+(uid.id++)},item);});var len=_79b.length,_79c=0,obj={},k=0,prop,_79d=[],flag=true,cols=this._columns;while(_79c<len){flag=true;prop="cell"+k;obj[prop]=_79b[_79c];_79c++;k++;if(k%cols===0){flag=false;_79d.push(obj);obj={};k=0;}}if(flag){_79d.push(obj);}return _79d;},_getItemsFromLayers:function(_79e){var _79f=[];dojo.forEach(_79e,function(_7a0,_7a1){_79f.push(this._getItemsFromLayer(_7a0,_7a1));},this);return _79f;},_getItemsFromLayer:function(_7a2,_7a3){var _7a4=[];var _7a5=[];_7a5=_7a5.concat(_7a2.templates);dojo.forEach(_7a2.types,function(_7a6){var _7a7=_7a6.templates;dojo.forEach(_7a7,function(_7a8){_7a8._type_=_7a6;});_7a5=_7a5.concat(_7a7);});_7a5=dojo.filter(_7a5,esri._isDefined);var _7a9=_7a2.renderer;if(_7a9){if(_7a5.length>0){dojo.forEach(_7a5,function(_7aa){var _7ab=_7aa.prototype;if(_7ab){var _7ac=_7a9.getSymbol(_7ab);if(_7ac){_7a4.push({label:this._trimLabel(_7aa.name),symbol:_7ac,layer:_7a2,type:_7aa._type_,template:_7aa,index1:_7a3,index2:_7a4.length});}}delete _7aa._type_;},this);}else{var _7ad=_7a9.declaredClass.replace("esri.renderer.",""),_7ae=[];if(_7ad==="TemporalRenderer"){_7a9=_7a9.observationRenderer;if(_7a9){_7ad=_7a9.declaredClass.replace("esri.renderer.","");}}switch(_7ad){case "SimpleRenderer":_7ae=[{symbol:_7a9.symbol,label:_7a9.label,description:_7a9.description}];break;case "UniqueValueRenderer":case "ClassBreaksRenderer":_7ae=_7a9.infos;break;}_7a4=dojo.map(_7ae,function(info,idx){return {label:this._trimLabel(info.label),description:info.description,symbolInfo:dojo.mixin({constructor:function(){}},info),symbol:info.symbol,layer:_7a2,index1:_7a3,index2:idx};},this);}}return _7a4;},_getItemsFromItems:function(_7af){return dojo.map(_7af,function(item,idx){var item=dojo.mixin({index:idx},item);item.label=this._trimLabel(item.label);return item;},this);},_trimLabel:function(_7b0){var max=this.maxLabelLength;if(max&&_7b0){if(_7b0.length>max){_7b0=_7b0.substr(0,max)+"...";}}return _7b0||"";},_cellGet:function(_7b1,_7b2,_7b3){if(!_7b3){return "";}return this.grid.store.getValue(_7b3,"cell"+_7b1);},_cellFormatter:function(_7b4){if(_7b4){var _7b5=this._itemWidgets,_7b6=this.grid.store;var sid=_7b6.getValue(_7b4,"surfaceId");var w=_7b5[sid];if(!w){w=(_7b5[sid]=new esri.dijit.editing.TemplatePickerItem({id:sid,label:_7b6.getValue(_7b4,"label"),symbol:_7b6.getValue(_7b4,"symbol"),surfaceWidth:this.surfaceWidth,surfaceHeight:this.surfaceHeight,template:_7b6.getValue(_7b4,"template")}));}return w||"";}else{return "";}},_cellGetGroup:function(_7b7,_7b8){if(!this._groupRowIndices){return "";}var _7b9=dojo.indexOf(this._groupRowIndices,_7b7);if(!_7b8||_7b9===-1){return "";}return (this.featureLayers[_7b9]&&this.featureLayers[_7b9].name)||"";},_cellGroupFormatter:function(_7ba){if(_7ba){return "<div class='groupLabel'>"+_7ba+"</div>";}else{return "";}}});dojo.declare("esri.dijit.editing.TemplatePickerItem",[dijit._Widget,dijit._Templated],{templateString:"<div class='item' style='text-align: center;'>"+"<div class='itemSymbol' dojoAttachPoint='_surfaceNode'></div>"+"<div class='itemLabel'>${label}</div>"+"</div>",startup:function(){if(this._started){return;}this.inherited(arguments);this._surface=this._draw(this._surfaceNode,this.symbol,this.surfaceWidth,this.surfaceHeight,this.template);},_draw:function(node,_7bb,_7bc,_7bd,_7be){var _7bf=dojox.gfx.createSurface(node,_7bc,_7bd);if(dojo.isIE<9){var _7c0=_7bf.getEventSource();dojo.style(_7c0,"position","relative");dojo.style(_7c0.parentNode,"position","relative");}var _7c1=this._getDrawingToolShape(_7bb,_7be)||esri.symbol.getShapeDescriptors(_7bb);var _7c2;try{_7c2=_7bf.createShape(_7c1.defaultShape).setFill(_7c1.fill).setStroke(_7c1.stroke);}catch(e){_7bf.clear();_7bf.destroy();return;}var dim=_7bf.getDimensions();var _7c3={dx:dim.width/2,dy:dim.height/2};var bbox=_7c2.getBoundingBox(),_7c4=bbox.width,_7c5=bbox.height;if(_7c4>_7bc||_7c5>_7bd){var _7c6=_7c4>_7c5?_7c4:_7c5;var _7c7=_7bc<_7bd?_7bc:_7bd;var _7c8=(_7c7-5)/_7c6;dojo.mixin(_7c3,{xx:_7c8,yy:_7c8});}_7c2.applyTransform(_7c3);return _7bf;},_getDrawingToolShape:function(_7c9,_7ca){var _7cb,_7cc=_7ca?_7ca.drawingTool||null:null;switch(_7cc){case "esriFeatureEditToolArrow":_7cb={type:"path",path:"M 10,1 L 3,8 L 3,5 L -15,5 L -15,-2 L 3,-2 L 3,-5 L 10,1 E"};break;case "esriFeatureEditToolLeftArrow":_7cb={type:"path",path:"M -15,1 L -8,8 L -8,5 L 10,5 L 10,-2 L -8,-2 L -8,-5 L -15,1 E"};break;case "esriFeatureEditToolRightArrow":_7cb={type:"path",path:"M 10,1 L 3,8 L 3,5 L -15,5 L -15,-2 L 3,-2 L 3,-5 L 10,1 E"};break;case "esriFeatureEditToolUpArrow":_7cb={type:"path",path:"M 1,-10 L 8,-3 L 5,-3 L 5,15 L -2,15 L -2,-3 L -5,-3 L 1,-10 E"};break;case "esriFeatureEditToolDownArrow":_7cb={type:"path",path:"M 1,15 L 8,8 L 5,8 L 5,-10 L -2,-10 L -2,8 L -5,8 L 1,15 E"};break;case "esriFeatureEditToolTriangle":_7cb={type:"path",path:"M -10,14 L 2,-10 L 14,14 L -10,14 E"};break;case "esriFeatureEditToolRectangle":_7cb={type:"path",path:"M -10,-10 L 10,-10 L 10,10 L -10,10 L -10,-10 E"};break;case "esriFeatureEditToolCircle":_7cb={type:"circle",cx:0,cy:0,r:10};break;case "esriFeatureEditToolEllipse":_7cb={type:"ellipse",cx:0,cy:0,rx:10,ry:5};break;case "esriFeatureEditToolFreehand":if(_7c9.type==="simplelinesymbol"||_7c9.type==="cartographiclinesymbol"){_7cb={type:"path",path:"m -11, -7c-1.5,-3.75 7.25,-9.25 12.5,-7c5.25,2.25 6.75,9.75 3.75,12.75c-3,3 -3.25,2.5 -9.75,5.25c-6.5,2.75 -7.25,14.25 2,15.25c9.25,1 11.75,-4 13.25,-6.75c1.5,-2.75 3.5,-11.75 12,-6.5"};}else{_7cb={type:"path",path:"M 10,-13 c3.1,0.16667 4.42564,2.09743 2.76923,3.69231c-2.61025,2.87179 -5.61025,5.6718 -6.14358,6.20513c-0.66667,0.93333 -0.46667,1.2 -0.53333,1.93333c-0.00001,0.86666 0.6,1.66667 1.13334,2c1.03077,0.38462 2.8,0.93333 3.38974,1.70769c0.47693,0.42564 0.87693,0.75897 1.41026,1.75897c0.13333,1.06667 -0.46667,2.86667 -1.8,3.8c-0.73333,0.73333 -3.86667,2.66666 -4.86667,3.13333c-0.93333,0.8 -7.4,3.2 -7.6,3.06667c-1.06667,0.46667 -4.73333,1.13334 -5.2,1.26667c-1.6,0.33334 -4.6,0.4 -6.25128,0.05128c-1.41539,-0.18462 -2.34872,-2.31796 -1.41539,-4.45129c0.93333,-1.73333 1.86667,-3.13333 2.64615,-3.85641c1.28718,-1.47692 2.57437,-2.68204 3.88718,-3.54359c0.88718,-1.13845 1.8,-1.33333 2.26666,-2.45641c0.33334,-0.74359 0.37949,-1.7641 0.06667,-2.87692c-0.66666,-1.46666 -1.66666,-1.86666 -2.98975,-2.2c-1.27692,-0.26666 -2.12307,-0.64102 -3.27692,-1.46666c-0.66667,-1.00001 -1.01538,-3.01539 0.73333,-4.06667c1.73333,-1.2 3.6,-1.93333 4.93333,-2.2c1.33333,-0.46667 4.84104,-1.09743 5.84103,-1.23076c1.60001,-0.46667 6.02564,-0.50257 7.29231,-0.56924z"};}break;default:return null;}return {defaultShape:_7cb,fill:_7c9.getFill(),stroke:_7c9.getStroke()};},_repaint:function(_7cd){if(!_7cd){this._surface=this._draw(this._surfaceNode,this.symbol,this.surfaceWidth,this.surfaceHeight,this.template);return;}if(_7cd.getStroke&&_7cd.setStroke){_7cd.setStroke(_7cd.getStroke());}if(_7cd.getFill&&_7cd.setFill){_7cd.setFill(_7cd.getFill());}if(_7cd.children&&dojo.isArray(_7cd.children)){dojo.forEach(_7cd.children,this._repaint,this);}},destroy:function(){if(this._surface){this._surface.destroy();delete this._surface;}this.inherited(arguments);}});}if(!dojo._hasResource["esri.dijit.editing.TemplatePicker-all"]){dojo._hasResource["esri.dijit.editing.TemplatePicker-all"]=true;dojo.provide("esri.dijit.editing.TemplatePicker-all");}dojo.i18n._preloadLocalizations("esri.dijit.editing.nls.TemplatePicker-all",["ROOT","ar","ca","cs","da","de","de-de","el","en","en-gb","en-us","es","es-es","fi","fi-fi","fr","fr-fr","he","he-il","hu","it","it-it","ja","ja-jp","ko","ko-kr","nb","nl","nl-nl","pl","pt","pt-br","pt-pt","ru","sk","sl","sv","th","tr","xx","zh","zh-cn","zh-tw"]);
