/*
 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
 */

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","esri.tasks.locator"],["require","esri.tasks._task"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["esri.tasks.locator"]){_4._hasResource["esri.tasks.locator"]=true;_4.provide("esri.tasks.locator");_4.require("esri.tasks._task");_4.declare("esri.tasks.Locator",esri.tasks._Task,{constructor:function(_7){this._geocodeHandler=_4.hitch(this,this._geocodeHandler);this._reverseGeocodeHandler=_4.hitch(this,this._reverseGeocodeHandler);},outSpatialReference:null,setOutSpatialReference:function(sr){this.outSpatialReference=sr;},_geocodeHandler:function(_8,io,_9,_a,_b){try{var _c=_8.candidates,_d,_e=[],i,il=_c.length,sr=_8.spatialReference;for(i=0;i<il;i++){_d=_c[i];_e[i]=new esri.tasks.AddressCandidate(_d);var _f=_e[i].location;if(sr&&_f&&!_f.spatialReference){_f.setSpatialReference(new esri.SpatialReference(sr));}}this._successHandler([_e],"onAddressToLocationsComplete",_9,_b);}catch(err){this._errorHandler(err,_a,_b);}},addressToLocations:function(_10,_11,_12,_13,_14){if(_10.address){_13=_12;_12=_11;_11=_10.outFields;_14=_10.searchExtent;_10=_10.address;}var _15=this.outSpatialReference;var _16=this._encode(_4.mixin({},this._url.query,_10,{f:"json",outSR:_15&&_4.toJson(_15.toJson()),outFields:(_11&&_11.join(","))||null,searchExtent:_14&&_4.toJson(_14.toJson())})),_17=this._geocodeHandler,_18=this._errorHandler;var dfd=new _4.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/findAddressCandidates",content:_16,callbackParamName:"callback",load:function(r,i){_17(r,i,_12,_13,dfd);},error:function(r){_18(r,_13,dfd);}});return dfd;},_reverseGeocodeHandler:function(_19,io,_1a,_1b,dfd){try{var _1c=new esri.tasks.AddressCandidate({address:_19.address,location:_19.location,score:100});this._successHandler([_1c],"onLocationToAddressComplete",_1a,dfd);}catch(err){this._errorHandler(err,_1b,dfd);}},locationToAddress:function(_1d,_1e,_1f,_20){if(_1d&&this.normalization){_1d=_1d.normalize();}var _21=this.outSpatialReference;var _22=this._encode(_4.mixin({},this._url.query,{outSR:_21&&_4.toJson(_21.toJson()),location:_1d&&_4.toJson(_1d.toJson()),distance:_1e,f:"json"})),_23=this._reverseGeocodeHandler,_24=this._errorHandler;var dfd=new _4.Deferred(esri._dfdCanceller);dfd._pendingDfd=esri.request({url:this._url.path+"/reverseGeocode",content:_22,callbackParamName:"callback",load:function(r,i){_23(r,i,_1f,_20,dfd);},error:function(r){_24(r,_20,dfd);}});return dfd;},onAddressToLocationsComplete:function(){},onLocationToAddressComplete:function(){}});_4.declare("esri.tasks.AddressCandidate",null,{constructor:function(_25){_4.mixin(this,_25);this.location=new esri.geometry.Point(this.location);}});}}};});