/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */

if(!dojo._hasResource["esri.tasks.find"]){dojo._hasResource["esri.tasks.find"]=true;dojo.provide("esri.tasks.find");dojo.require("esri.tasks._task");dojo.declare("esri.tasks.FindTask",esri.tasks._Task,{constructor:function(_1,_2){this._url.path+="/find";this._handler=dojo.hitch(this,this._handler);this.gdbVersion=_2&&_2.gdbVersion;},_handler:function(_3,io,_4,_5,_6){try{var _7=[],_8=esri.tasks.FindResult;dojo.forEach(_3.results,function(_9,i){_7[i]=new _8(_9);});this._successHandler([_7],"onComplete",_4,_6);}catch(err){this._errorHandler(err,_5,_6);}},execute:function(_a,_b,_c){var _d=this._encode(dojo.mixin({},this._url.query,{f:"json"},_a.toJson())),_e=this._handler,_f=this._errorHandler;if(this.gdbVersion){_d.gdbVersion=this.gdbVersion;}var dfd=new dojo.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path,content:_d,callbackParamName:"callback",load:function(r,i){_e(r,i,_b,_c,dfd);},error:function(r){_f(r,_c,dfd);}});return dfd;},onComplete:function(){}});dojo.declare("esri.tasks.FindParameters",null,{searchText:null,contains:true,searchFields:null,outSpatialReference:null,layerIds:null,returnGeometry:false,layerDefinitions:null,dynamicLayerInfos:null,toJson:function(){var _10={searchText:this.searchText,contains:this.contains,returnGeometry:this.returnGeometry,maxAllowableOffset:this.maxAllowableOffset},_11=this.layerIds,_12=this.searchFields,_13=this.outSpatialReference;if(_11){_10.layers=_11.join(",");}if(_12){_10.searchFields=_12.join(",");}if(_13){_10.sr=_13.wkid||dojo.toJson(_13.toJson());}_10.layerDefs=esri._serializeLayerDefinitions(this.layerDefinitions);if(this.dynamicLayerInfos&&this.dynamicLayerInfos.length>0){var _14,_15=[];dojo.forEach(this.dynamicLayerInfos,function(_16){if(!_16.subLayerIds){var _17=_16.id;if(this.layerIds&&dojo.indexOf(this.layerIds,_17)!==-1){var _18={id:_17};_18.source=_16.source&&_16.source.toJson();var _19;if(this.layerDefinitions&&this.layerDefinitions[_17]){_19=this.layerDefinitions[_17];}if(_19){_18.definitionExpression=_19;}_15.push(_18);}}},this);_14=dojo.toJson(_15);if(_14==="[]"){_14="[{}]";}_10.dynamicLayers=_14;}return _10;}});dojo.declare("esri.tasks.FindResult",null,{constructor:function(_1a){dojo.mixin(this,_1a);this.feature=new esri.Graphic(_1a.geometry?esri.geometry.fromJson(_1a.geometry):null,null,_1a.attributes);delete this.geometry;delete this.attributes;}});}