Garfield.CO.US.Globals={IE:navigator.appVersion.indexOf("MSIE")>-1,IE6:navigator.appVersion.indexOf("MSIE 6.0")>-1,MAP:null,ActiveMapPoint:null,Searches:[],Identifys:[]};
Garfield.CO.US.Enums={EsriTaskType:{Find:"Find",Query:"Query",Identify:"Identify",GeometryService:"GeometryService"},SearchType:{Area:"Area",Parcel:"Parcel",Address:"Address",GasWell:"GasWell",GasWellPermit:"GasWellPermit",ParcelBuffer:"ParcelBuffer",GasWellBuffer:"GasWellBuffer",AdHoc:"AdHoc",CustomSearch:"CustomSearch"},IdentifyType:{Parcel:"Parcel",GasWell:"GasWell",AdHoc:"AdHoc"},ParcelDetailType:{Property:"Property",Owner:"Owner",Assessor:"Assessor"}};
Garfield.CO.US.EsriObjects=(function(){var _c=Garfield.CO.US.Config,_e=Garfield.CO.US.Enums,_g=Garfield.CO.US.Globals,_findTask=null,_getFindTask=function(url){return new esri.tasks.FindTask(url);
},_findParameters=null,_getFindParameters=function(){return new esri.tasks.FindParameters();
},_identifyTask=null,_getIdentifyTask=function(url){return new esri.tasks.IdentifyTask(url);
},_identifyParameters=null,_getIdentifyParameters=function(){return new esri.tasks.IdentifyParameters();
},_queryTask=null,_getQueryTask=function(url){return new esri.tasks.QueryTask(url);
},_queryParameters=null,_getQueryParameters=function(){return new esri.tasks.Query();
},_geometryService=null,_getGeometryService=function(url){return new esri.tasks.GeometryService(url);
},_extend=function(){esri.Graphic.prototype.SearchIndex=null;esri.Graphic.prototype.SetSearchIndex=function(index){this.SearchIndex=index;
return this;};esri.Graphic.prototype.SearchType=null;esri.Graphic.prototype.SetSearchType=function(type){this.SearchType=type;
return this;};esri.Graphic.prototype.Name=null;esri.Graphic.prototype.SetName=function(name){this.Name=name;
return this;};esri.Graphic.prototype.Attributes=null;esri.Graphic.prototype.SetAttributes=function(attributes){this.Attributes=attributes;
return this;};esri.Graphic.prototype.Remove=function(){_g.MAP.graphics.remove(this);
};esri.layers.GraphicsLayer.prototype.Find=function(name){for(var graphic in this.graphics){if(typeof this.graphics[graphic]!=="undefined"){if(this.graphics[graphic].Name===name){return this.graphics[graphic];
}}}return null;};esri.layers.GraphicsLayer.prototype.Match=function(name){var matches=[];
var re=new RegExp(name);for(var graphic in this.graphics){if(this.graphics[graphic].Name.search(re)>-1){matches.push(this.graphics[graphic]);
}}return matches;};esri.layers.GraphicsLayer.prototype.Remove=function(){var graphics=[];
for(var item in this.graphics){var graphic=this.graphics[item];if(typeof graphic!=="undefined"&&graphic.Name){if(graphic.Name.indexOf("Selected")>0){continue;
}else{if(graphic.Name!=_c.Symbology.BufferGraphicName){graphics.push(graphic);}}}}for(var item in graphics){graphics[item].Remove();
}};esri.layers.LayerInfo.prototype.IsVisible=null;esri.layers.LayerInfo.prototype.SetIsVisible=function(isVisible){this.IsVisible=isVisible;
};esri.layers.LayerInfo.prototype.Scale={};esri.layers.LayerInfo.prototype.SetScale=function(min,max){this.Scale={Min:min,Max:max};
};};esri.tasks.FindTask.prototype.SetUrl=function(newUrl){newUrl+="/find";this._url.path=newUrl;
this.url=newUrl;};esri.tasks.IdentifyTask.prototype.SetUrl=function(newUrl){newUrl+="/identify";
this._url.path=newUrl;this.url=newUrl;};esri.tasks.QueryTask.prototype.SetUrl=function(newUrl){newUrl+="/query";
this._url.path=newUrl;this.url=newUrl;};dojo.addOnLoad(_extend);return new function(){this.GetTaskObject=function(type,url){var URL=url||_c.Map.Url;
switch(type){case _e.EsriTaskType.Find:if(_findTask===null){_findTask=new _getFindTask(URL);
_findTask.constructor=null;}_findTask.url=URL;_findTask.SetUrl(URL);return _findTask;
case _e.EsriTaskType.Identify:if(_identifyTask===null){_identifyTask=new _getIdentifyTask(URL);
_identifyTask.constructor=null;}_identifyTask.url=URL;_identifyTask.SetUrl(URL);return _identifyTask;
case _e.EsriTaskType.Query:if(_queryTask===null){_queryTask=new _getQueryTask(URL);
_queryTask.constructor=null;}_queryTask.url=URL;_queryTask.SetUrl(URL);return _queryTask;
case _e.EsriTaskType.GeometryService:if(_geometryService===null){_geometryService=new _getGeometryService(URL.split("services/")[0]+"services/Geometry/GeometryServer");
_geometryService.constructor=null;}return _geometryService;}};this.GetTaskParametersObject=function(type){switch(type){case _e.EsriTaskType.Find:if(_findParameters===null){_findParameters=new _getFindParameters();
_findParameters.constructor=null;}return _findParameters;case _e.EsriTaskType.Identify:if(_identifyParameters===null){_identifyParameters=new _getIdentifyParameters();
_identifyParameters.constructor=null;}return _identifyParameters;case _e.EsriTaskType.Query:if(_queryParameters===null){_queryParameters=new _getQueryParameters();
_queryParameters.constructor=null;}return _queryParameters;}};};})();Garfield.CO.US.Utils=(function(){var _c=Garfield.CO.US.Config,_g=Garfield.CO.US.Globals,_getNextSibling=function(node){return node.nextSibling.nodeType==3?node.nextSibling.nextSibling:node.nextSibling;
},_isUndefined=function(obj){return typeof (obj)==="undefined";},_toggleNodeDisplay=function(nodeId){var hide={"display":"none"},show={"display":"block"},node=dojo.byId(nodeId);
if(node){if(dojo.style(node,"display")!="none"){dojo.style(node,hide);}else{dojo.style(node,show);
}}node=null;},_getLineLength=function(points){var textFormat="",distance=0;for(var i=0;
i<points.length-1;i++){var point1=points[i];var point2=points[i+1];var dx=point1.x-point2.x;
var dy=point1.y-point2.y;dx=Math.pow(dx,2);dy=Math.pow(dy,2);distance=distance+Math.sqrt(dx+dy);
}return distance;},_getPolygonCentroid=function(points){var sumY=0,sumX=0,partialSum=0,sum=0,area=0,n=points.length;
for(var i=0;i<n-1;i++){partialSum=(points[i][0]*points[i+1][1])-(points[i+1][0]*points[i][1]);
sum+=partialSum;sumX+=(points[i][0]+points[i+1][0])*partialSum;sumY+=(points[i][1]+points[i+1][1])*partialSum;
}area=0.5*sum;if(n>0){return new esri.geometry.Point(sumX/6/area,sumY/6/area,_g.MAP.spatialReference);
}else{return null;}},_regularExpressions={Digit:/^\d*$/,Suffix:/(^st(r?(e{2}t)?)$)|(^av(e?(nue)?)$)|(^l((ane)|(n))$)|(^dr(v|(ive))?$)|(^w(a)?y$)|(^c(our|r)?t$)|(^tr(ail|l)?$)|(^r(oa)?d$)|(^c(r|ir|ircle$))|(^b(lvd|oulevard)$)\.?/i,Direction:/(^n(o)?(rth)?\.?$)|(^s(o)?(uth)?\.?$)|(^e(ast)?\.?$)|(^w(est)?\.?$)\.?/i,Unit:/^(unit|#|suite|ste)(\W+)?.{1,7}$/ig,CountyRoad:/county(\s+\d*)?/i},_removeDuplicates=function(array){var newArray=new Array();
label:for(var i=0;i<array.length;i++){for(var j=0;j<newArray.length;j++){if(newArray[j]==array[i]){continue label;
}}newArray[newArray.length]=array[i];}return newArray;},_getJsonObjectLength=function(jsonObject){var i=0;
for(item in jsonObject){i++;}return i;},_resetScrollTop=function(domNode){domNode.scrollTop=0;
},_getEventSource=function(e){return document.all?e.srcElement:e.currentTarget;};
return{GetNextSibling:function(node){return _getNextSibling(node);},IsUndefined:function(obj){return _isUndefined(obj);
},GetLineLength:function(points){return _getLineLength(points);},ToggleNodeDisplay:function(nodeId){return _toggleNodeDisplay(nodeId);
},RegularExpressions:_regularExpressions,GetPolygonCentroid:function(points){return _getPolygonCentroid(points);
},RemoveDuplicates:function(array){return _removeDuplicates(array);},GetJsonObjectLength:function(jsonObject){return _getJsonObjectLength(jsonObject);
},ResetScrollTop:function(domNode){_resetScrollTop(domNode);},GetEventSource:function(e){return _getEventSource(e);
}};})();String.prototype.isNull=function(){if(this.length==0||this.toString().toLowerCase()=="null"){return true;
}return false;};String.prototype.fromCamelCase=function(){return this.replace(/([A-Z][a-z])/g," $1").replace(/\s{2,}/g," ").replace(/\s/,"");
};String.prototype.toCamelCase=function(){var parts=this.split(/\s/),s="";for(var i=0;
i<parts.length;i++){var part=parts[i];part=part.charAt(0).toUpperCase()+part.substring(1,part.length);
s+=part;}return s;};String.prototype.toCamelCaseUpper=function(){var s=this.toCamelCase();
s=this.charAt(0).toUpperCase()+s.substring(1,s.length);return s;};String.prototype.toCamelCaseLower=function(){var s=this.toCamelCase();
s=this.charAt(0).toLowerCase()+s.substring(1,s.length);return s;};String.prototype.pluralize=function(){return this.concat(this.charAt(this.length-1).toLowerCase()!=="s"?"(s)":"");
};String.format=null;String.format=function(string,args){for(var item in args){var regex=new RegExp("\\{"+item+"\\}","g");
string=string.replace(new RegExp("\\{"+item+"\\}","g"),args[item]);}return string;
};String.prototype.getBufferParentType=function(){return this.replace("Buffer","");
};Garfield.CO.US.UI=new function(){var _g=Garfield.CO.US.Globals;var _c=Garfield.CO.US.Config;
var _u=Garfield.CO.US.Utils;var _handleLayout=function(){var header=dojo.byId("header");
var subHeader=dojo.byId("subHeader");var helpContainer=dojo.byId("mapHelp");var viewport=dijit.getViewport();
var availHeight=(viewport.h-(parseInt(header.offsetHeight)+parseInt(subHeader.offsetHeight)));
var baseTop=dojo.byId("mxdMap").offsetTop;var helpTop=(viewport.h-parseInt(dojo.getComputedStyle(helpContainer).height))/2;
var helpLeft=(dojo.byId("wrapper").offsetWidth-parseInt(dojo.getComputedStyle(helpContainer).width))/2;
dojo.style("mxdMap",{"height":availHeight+"px","width":"100%"});if(dojo.byId("primarySidebar")){dojo.style("primarySidebar",{"top":(baseTop+1)+"px","height":(viewport.h-(baseTop-1))+"px"});
dojo.style("primarySidebarShadow",{"top":baseTop+"px"});}dojo.style("toolbar",{"top":baseTop+"px"});
dojo.style(helpContainer,{"top":helpTop+"px","left":helpLeft+"px"});if(_c.UI.HasLegend){var legendContainer=dojo.byId("tertiarySidebar");
dojo.style(legendContainer,{"top":(baseTop+1)+"px"});dojo.style("tertiarySidebarShadow",{"top":baseTop+"px"});
}_handleToolLayout();if(_g.MAP){_g.MAP.resize();}header=null,subHeader=null,helpContainer=null;
};var _setExternalLinks=function(){var links=dojo.query("#header ul")[0];for(var item in _c.ExternalLinks){var link=_c.ExternalLinks[item];
links.innerHTML+='<li><a href="'+_c.ExternalLinks[item]+'" target="_blank">'+item.replace(/\_/g,"&nbsp;").replace(/\$/g,"&amp;")+"</a></li>";
}links=dojo.query("#header li");links[links.length-1].style.border="0";links=null;
};var _styleSidebars=function(){dojo.forEach(dojo.query("DIV[id$=Sidebar]"),function(item){dojo.style(item,{"opacity":_c.UI.SidebarOpacity});
});if(_c.UI.HasInfoPane){_toggleSidebar({target:dojo.query(".sidebarTab")[1]});}};
var _handleToolLayout=function(){var compass=dojo.byId("compass");var toolbar=dojo.byId("toolbar");
var h=compass?compass.offsetHeight:0;var w=compass?compass.offsetWidth:0;var l=((toolbar.offsetWidth-w)/2);
var t=((toolbar.offsetHeight-h)/2);var r=l+w;t=_g.IE6?toolbar.offsetTop+t:t;if(compass){dojo.style(compass,{"top":t+"px",left:l+"px"});
}var ele=dojo.byId("tools");l=l-ele.offsetWidth;dojo.style(ele,{"left":l+"px"});ele=dojo.byId("view");
dojo.style(ele,{"left":r+"px"});dojo.style(dojo.byId("layerLists"),{"top":(toolbar.offsetTop+toolbar.offsetHeight-8)+"px"});
compass=null,toolbar=null,ele=null;};var _attachEvents=function(){dojo.forEach(dojo.query(".sidebarTab"),function(item){dojo.connect(item,"onclick",_toggleSidebar);
});dojo.forEach(dojo.query("#primarySidebar *"),function(item){dojo.connect(item,"onmouseover",function(e){_fadeIn(e,"primarySidebar");
});dojo.connect(item,"onmouseout",function(e){_fadeOut(e,"primarySidebar");});});
dojo.forEach(dojo.query("#tertiarySidebar *"),function(item){dojo.connect(item,"onmouseover",function(e){_fadeIn(e,"tertiarySidebar");
});dojo.connect(item,"onmouseout",function(e){_fadeOut(e,"tertiarySidebar");});});
if(_c.UI.HasInfoPane){dojo.forEach(dojo.query("#secondarySidebar *"),function(item){dojo.connect(item,"onmouseover",function(e){_fadeIn(e,"secondarySidebar");
});dojo.connect(item,"onmouseout",function(e){_fadeOut(e,"secondarySidebar");});});
}dojo.connect(dojo.query("#mapHelp a")[0],"onclick",function(){Garfield.CO.US.Utils.ToggleNodeDisplay("mapHelp");
});};var _fadeIn=function(e,containerNodeId){var containerNode=dojo.byId(containerNodeId);
if(dojo.isDescendant(e.relatedTarget,containerNode)&&e.relatedTarget!=containerNode){return ;
}var opacity=dojo.style(containerNode,"opacity");if(!isNaN(opacity)){opacity=parseFloat(opacity);
}if(opacity<1){dojo.anim(containerNode,{opacity:1},_c.UI.OpacityFadeTime);}e=null,containerNode=null;
};var _fadeOut=function(e,containerNodeId){var containerNode=dojo.byId(containerNodeId);
if(dojo.isDescendant(e.relatedTarget,containerNode)&&e.relatedTarget!=containerNode){return ;
}var opacity=dojo.style(containerNode,"opacity");if(!isNaN(opacity)){opacity=parseFloat(opacity);
}if(opacity>_c.UI.SidebarOpacity){dojo.anim(containerNode,{opacity:_c.UI.SidebarOpacity},_c.UI.OpacityFadeTime);
}e=null,containerNode=null;};var _toggleSidebar=function(e,eventTriggerNode){var ele=e;
if(e&&e.target){ele=e.target.parentNode;}else{if(eventTriggerNode){e=new Object();
e.target=eventTriggerNode;ele=e.target.parentNode;}}var shadow=_u.GetNextSibling(ele);
var shadow2=null;if(shadow&&shadow.id.indexOf("Shadow")<0){shadow=null;}else{shadow2=_u.GetNextSibling(shadow);
if(shadow2&&shadow.id.indexOf("Shadow")<0){shadow=null;}}var eleProperties={};var elePos=0;
var shadowProperties={},shadow2Properties={};var shadowPos=0;if(ele.id.indexOf("tertiary")>-1){elePos=ele.offsetWidth-e.target.offsetWidth;
elePos=parseInt(ele.style.right)<0||eventTriggerNode?0:elePos*-1;eleProperties.right=elePos;
if(shadow){shadowPos=elePos<0?shadowPos:(ele.offsetWidth-e.target.offsetWidth);shadowProperties.right=shadowPos;
}if(shadow2){shadow2Properties.right=elePos;}}else{if(ele.offsetHeight>ele.offsetWidth){elePos=ele.offsetWidth-e.target.offsetWidth;
elePos=parseInt(ele.style.left)<0||eventTriggerNode?0:elePos*-1;eleProperties.left=elePos;
if(shadow){shadowPos=elePos==0?ele.offsetWidth-e.target.offsetWidth:shadowPos;shadowProperties.left=shadowPos;
}}else{if(ele.offsetWidth>ele.offsetHeight){elePos=ele.offsetHeight-e.target.offsetHeight;
elePos=parseInt(ele.style.bottom)<0||eventTriggerNode?0:elePos*-1;eleProperties.bottom=elePos;
if(shadow){shadowPos=elePos==0?ele.offsetHeight-e.target.offsetHeight:shadowPos;shadowProperties.bottom=shadowPos;
}}}}var anims=[];anims.push(dojo.anim(ele,eleProperties,_c.UI.SidebarCollapseTime));
if(shadow){anims.push(dojo.anim(shadow,shadowProperties,_c.UI.SidebarCollapseTime));
}if(shadow2){anims.push(dojo.anim(shadow2,shadow2Properties,_c.UI.SidebarCollapseTime));
}dojo.fx.combine(anims).play();if(elePos==0){dojo.removeClass(e.target,"sidebarTabClosed");
}else{dojo.addClass(e.target,"sidebarTabClosed");}ele=null,shadow=null,eleProperties=null,shadowProperties=null,anims=null,e=null;
};var _buildTogglableLayersLists=function(layersLists){var ele;for(var layersList in layersLists){if(layersLists[layersList].length>1||layersLists!="Aerial"){html="";
var query="IMG[id*='"+layersList.toLowerCase()+"']";var parentEle=dojo.query(query)[0];
if(parentEle){var list=layersLists[layersList];var id=layersList.toLowerCase()+"List";
html+="<div ";html+='class="layerList" id="'+id+'"';html+='style="left:';html+=(dojo.byId("view").offsetLeft+parentEle.offsetLeft)+'px"';
html+="><ul>";var layerNames="";if(layersList==="Aerial"){for(var item in list){layerNames+="'"+list[item].Name+"',";
}layerNames="["+layerNames.substring(0,layerNames.length-1)+"]";}for(var item in list){var name=list[item].Name;
html+="<li>";html+='<a href="#"';html+='onclick="';if(layersList==="Aerial"){html+="Garfield.CO.US.Mapping.ToggleLayers(['Aerial'], '"+name+"');";
}else{html+="Garfield.CO.US.Mapping.ToggleLayers(['"+name+"'], null);";}html+="Garfield.CO.US.Mapping.ToggleLayerList('"+layersList.toLowerCase()+"List');";
html+="Garfield.CO.US.UI.SetSelectedLayer(this, '"+layersList.toLowerCase()+"');\">";
html+=name;html+="</a>";html+="</li>";}html+="</ul></div>";dojo.byId("layerLists").innerHTML+=html;
}}}ele=null;};var _setSelectedLayer=function(node,layerList){var layerListName=layerList+"List";
var query="#"+layerListName+" a";var list=dojo.query(query);console.log(list);if(layerListName.toLowerCase().indexOf("aerial")>-1){for(var i=0;
i<list.length;i++){var listNode=list[i];if(listNode.innerHTML==node.innerHTML){node.className=node.className!="selected"?"selected":"";
continue;}listNode.className="";listNode=null;}}else{node.className=node.className!="selected"?"selected":"";
}list=dojo.query(query);console.log(list);var target=dojo.byId(layerList);var active=layerList.toLowerCase();
if(dojo.some(list,function(item){return item.className=="selected";})){active+="Active";
}target.src=target.src.substring(target.src.lastIndexOf("/"),0)+"/"+active+".gif";
list=null;target=null;};var _initialize=function(){window.onresize=function(){_handleLayout();
};_handleLayout();_styleSidebars();_attachEvents();dojo.query("#subHeader h2")[0].innerHTML=_c.Site.Title;
for(var item in _c.Help){dojo.byId("otherMapHelp").innerHTML+="<li>"+_c.Help[item]+"</li>";
}var userAgent=navigator.userAgent;if(userAgent.indexOf("Safari")>-1&&userAgent.indexOf("Chrome")==-1){dojo.byId("txtSearch").style.width="251px";
}_setExternalLinks();};dojo.addOnLoad(_initialize);return{BuildLabelList:function(layersLists){_buildTogglableLayersLists(layersLists);
},ToggleSidebar:function(eventTriggerNode){_toggleSidebar(null,eventTriggerNode);
},SetSelectedLayer:function(node,layerList){_setSelectedLayer(node,layerList);}};
};Garfield.CO.US.Mapping=(function(){var _g=Garfield.CO.US.Globals,_c=Garfield.CO.US.Config,_u=Garfield.CO.US.Utils,_ui=Garfield.CO.US.UI,_e=Garfield.CO.US.Enums,_eo=Garfield.CO.US.EsriObjects,_isMeasuring=false,_measureLinePoints=[],_measureLineSymbol=null,_togglableLayers={Aerial:[],Labels:[],Layers:[]},_layersLoaded=0,_toggleLayersEventHandle=null,_initialize=function(){_initCompass();
_initMap();_initInfoBox();_initToolbar();_initMeasure();document.title="Garfield County : "+_c.Site.Title;
},_pan=function(e){var ele=e.target;eval("_g.MAP."+ele.id+"()");e=null;},_isAdHoc=function(){return !(_u.IsUndefined(_c.Map.IsAdHoc)||_c.Map.IsAdHoc===false);
},_defaultExtent,_initMap=function(){_defaultExtent=new esri.geometry.Extent({xmin:_c.Map.Xmin,ymin:_c.Map.Ymin,xmax:_c.Map.Xmax,ymax:_c.Map.Ymax,spatialReference:new esri.SpatialReference({wkid:_c.Map.SpatialReferenceId})});
_g.MAP=new esri.Map("mxdMap",{extent:_defaultExtent});dojo.connect(_g.MAP,"onLoad",function(){dojo.connect(_g.MAP.graphics,"onClick",_onClick);
esri.config.defaults.io.proxyUrl="/proxy.ashx";esri.config.defaults.io.alwaysUseProxy=false;
if(_c.UI.HasLegend){_getLegendLayerScales();}});_addMapServiceLayer({id:_c.Map.Id,url:_c.Map.Url,onLoad:function(){_g.MAP.hideZoomSlider();
for(var item in _c.Navigation){var setting=_c.Navigation[item];if(!setting){_g.MAP["disable".concat(item)]();
}}_setTogglableLayerNames();dojo.forEach(_getLayerInfos(),function(layerInfo){layerInfo.SetIsVisible(layerInfo.defaultVisibility);
});}});dojo.connect(_g.MAP,"onClick",_onClick);dojo.connect(_g.MAP,"onMouseMove",_onMouseMove);
dojo.connect(_g.MAP,"onDblClick",_onDoubleClick);dojo.connect(_g.MAP,"onZoomStart",function(){if(dojo.style("infoBox","display")!="none"){_toggleInfoBox();
}});dojo.connect(_g.MAP,"onPanStart",function(){if(dojo.style("infoBox","display")!="none"){_toggleInfoBox();
}});dojo.connect(_g.MAP,"onLoad",_showLoading);dojo.connect(_g.MAP,"onZoomStart",_showLoading);
dojo.connect(_g.MAP,"onPanStart",_showLoading);if(_c.UI.HasLegend){dojo.connect(_g.MAP,"onExtentChange",_setLegend);
}esri.config.defaults.map.panDuration=_c.Map.PanDuration;esri.config.defaults.map.panRate=_c.Map.PanRate;
dojo.byId("mxdMap").oncontextmenu=function(e){return false;};dojo.connect(_g.MAP,"onMouseDown",_onMouseDown);
},_showLoading=function(){var node=dojo.byId("mapLoading");if(node){esri.show(node);
}},_hideLoading=function(){var node=dojo.byId("mapLoading");_layersLoaded++;if(_layersLoaded===_g.MAP.layerIds.length){if(node){esri.hide(dojo.byId("mapLoading"));
}_layersLoaded=0;}},_hideLoadingNode=function(){esri.hide(dojo.byId("mapLoading"));
},_addMapServiceLayer=function(args){args.onLoad=_u.IsUndefined(args.onLoad)?false:args.onLoad;
args.extent=_u.IsUndefined(args.extent)?null:args.extent;var layer=new esri.layers.ArcGISDynamicMapServiceLayer(args.url,{id:args.id,extent:_g.MAP});
_g.MAP.addLayer(layer);if(args.onLoad){dojo.connect(layer,"onLoad",function(){args.onLoad();
});}if(args.hide){layer.hide();}dojo.connect(layer,"onUpdate",_hideLoading);layer=null;
},_toggleLayers=function(layerNames,name){_showLoading();var layerInfos=_getLayerInfos();
var baseLayer=_getBaseLayer();var visibleLayers=baseLayer.visibleLayers;var newVisibleLayers=[];
for(var visibleLayer in visibleLayers){newVisibleLayers.push(visibleLayers[visibleLayer]);
}if(name&&layerNames[0]==="Aerial"){var aerialLayer=_getLayerByNameOrId("Aerial");
for(var aerialSubLayerId in aerialLayer.subLayerIds){var aerialSubLayer=_getLayerByNameOrId(aerialLayer.subLayerIds[aerialSubLayerId]);
var aerialIndex=dojo.indexOf(newVisibleLayers,aerialSubLayer.id);if(aerialSubLayer.name==name){if(aerialIndex>-1){newVisibleLayers.splice(aerialIndex,1);
aerialSubLayer.SetIsVisible(false);}else{newVisibleLayers.push(aerialSubLayer.id);
aerialSubLayer.SetIsVisible(true);}}else{if(aerialIndex>-1){newVisibleLayers.splice(aerialIndex,1);
aerialSubLayer.SetIsVisible(false);}}}}else{for(var layerName in layerNames){for(var layerInfo in layerInfos){var layer=layerInfos[layerInfo];
var subLayerIds=layer.subLayerIds;if(layer.name==layerNames[layerName]){var index=dojo.indexOf(newVisibleLayers,layer.id);
if(index>-1){newVisibleLayers.splice(index,1);layer.SetIsVisible(false);}else{newVisibleLayers.push(layer.id);
layer.SetIsVisible(true);}if(subLayerIds){for(var id in subLayerIds){var subLayer=_getLayerByNameOrId(subLayerIds[id]);
var subIndex=dojo.indexOf(newVisibleLayers,subLayer.id);if(subIndex>-1){if(layer.isVisible){newVisibleLayers.push(subLayer.id);
subLayer.SetIsVisible(true);}else{newVisibleLayers.splice(subIndex,1);subLayer.SetIsVisible(false);
}}}}}}}}newVisibleLayers=_u.RemoveDuplicates(newVisibleLayers).sort();baseLayer.setVisibleLayers(newVisibleLayers);
},_getLayerInfos=function(){return _getBaseLayer().layerInfos;},_getBaseLayer=function(){return _g.MAP.getLayer(_c.Map.Id);
},_getReport=function(searchType,targetNode){if(targetNode&&targetNode.nodeName==="IMG"){dojo.byId("reportTitle").value="";
}var form=document.forms[0];form.action="/Root/Report.aspx";var buffer=_g.MAP.graphics.Find(_c.Symbology.BufferGraphicName);
var data=[];if(buffer){buffer=buffer.geometry.getExtent().toJson();var bufferBox={};
var points=[];var sr=_g.MAP.spatialReference;points.push(_g.MAP.toScreen(new esri.geometry.Point(buffer.xmin,buffer.ymin,sr)));
points.push(_g.MAP.toScreen(new esri.geometry.Point(buffer.xmax,buffer.ymax,sr)));
bufferBox.UpperRightX=points[1].x;bufferBox.UpperRightY=points[1].y;bufferBox.LowerLeftX=points[0].x;
bufferBox.LowerLeftY=points[0].y;dojo.byId("bufferBox").value=dojo.toJson(bufferBox);
}else{dojo.byId("bufferBox").value="";}dojo.forEach(_g.MAP.graphics.graphics,function(item){if(item.Name&&item.Name!=_c.Symbology.BufferGraphicName){var searchResult=Garfield.CO.US.Search.GetSearchResults()[item.SearchIndex];
var centerPoint=_g.MAP.toScreen(item.geometry);data.push({Index:searchResult.Index,SearchType:item.SearchType,Attributes:searchResult.Attributes,X:centerPoint.x,Y:centerPoint.y});
}});if(dojo.query("div.searchResult a").length>0){dojo.byId("reportType").value=searchType?searchType:null;
var bufferFocus=Garfield.CO.US.Search.GetSearchResults()[0];if(bufferFocus.Index==-1&&bufferFocus.Attributes){centerPoint=_g.MAP.toScreen(_g.MAP.graphics.Find(bufferFocus.Name).geometry);
data.push({Index:-1,SearchType:bufferFocus.SearchType,Attributes:null,X:centerPoint.x,Y:centerPoint.y});
}}data=dojo.toJson(data);dojo.byId("reportData").value=data;_getMapImage(function(href){dojo.byId("mapImageHref").value=href;
form.submit();});},_getBufferReport=function(){var title=dojo.query("#primarySidebarTitle a");
if(title.length>0){var className=title[0].className;dojo.byId("reportTitle").value=dojo.byId("primarySidebarTitle").innerHTML.replace(/\<\/a\>/i,"").replace(/\<a.*\>/i,"");
_getReport(dojo.query("div.searchResult a")[0].className.toCamelCaseUpper(),null);
if(pageTracker){pageTracker._trackEvent("Reporting","Buffer Report",title);}}},_getMapImage=function(callback){var parameters=new esri.layers.ImageParameters();
parameters.dpi=72;parameters.format="png";parameters.bbox=_g.MAP.extent;_getBaseLayer().exportMapImage(parameters,function(result){var href=result.href.replace(_c.Site.ServerName,_c.Site.Domain);
callback(href);});parameters=null;},_getLayerByNameOrId=function(value){var isId=typeof (value)=="number";
var layerInfos=_getLayerInfos();for(var layerInfo in layerInfos){var layer=layerInfos[layerInfo];
if(!isId){if(layer.name==value){return layer;}}else{if(layer.id==value){return layer;
}}}return null;},_setTogglableLayerNames=function(layerName){var layerInfos=_getLayerInfos();
for(var layerInfo in layerInfos){var layer=layerInfos[layerInfo];for(var toggableLayer in _togglableLayers){if(toggableLayer==layer.name){for(var subLayerId in layer.subLayerIds){var subLayerName=_getLayerName(layer.subLayerIds[subLayerId]);
_togglableLayers[toggableLayer].push({Name:subLayerName,Id:layer.subLayerIds[subLayerId],Visible:false});
}}}}layerInfos=null;},_getLayerName=function(id){var layerInfos=_getLayerInfos();
for(var layerInfo in layerInfos){var layer=layerInfos[layerInfo];if(layer.id==id){return layer.name;
}}},_getLayerId=function(layerName){var layerInfos=_getLayerInfos();for(var layerInfo in layerInfos){if(layerInfos[layerInfo].name.toLowerCase()==layerName.toLowerCase()){return layerInfos[layerInfo].id;
}}return -1;},_initCompass=function(){dojo.forEach(dojo.query("AREA:not(#closeInfoBox)"),function(item){dojo.connect(item,"onclick",_pan);
});},_initInfoBox=function(){dojo.connect(dojo.byId("closeInfoBox"),"onclick",_toggleInfoBox);
dojo.byId("infoBoxActionZoom").onclick=function(e){_toggleInfoBox(e);_zoom(_g.ActiveMapPoint,1*_c.Map.ZoomFactor);
};dojo.byId("infoBoxActionCenter").onclick=function(){_toggleInfoBox();_center(_g.ActiveMapPoint);
};},_initToolbar=function(){_g.MAP.Toolbar=new esri.toolbars.Navigation(_g.MAP);_connectToolbarEvents();
if(dojo.query("img[id^=history]").length>0){dojo.connect(_g.MAP.Toolbar,"onExtentHistoryChange",_toggleHistory);
}},_connectToolbarEvents=function(){dojo.forEach(dojo.query("#toolbar IMG:not(#compass)"),function(item){dojo.connect(item,"onclick",_onToolbarClick);
});},_initMeasure=function(){var color=new dojo.Color([_c.Symbology.MeasureLineColorRed,_c.Symbology.MeasureLineColorGreen,_c.Symbology.MeasureLineColorBlue]);
_measureLineSymbol=new esri.symbol.SimpleLineSymbol(_c.Symbology.MeasureLineStyle,color,_c.Symbology.MeasureLineWidth);
color=null;},_toggleMeasureTool=function(){_isMeasuring=!_isMeasuring;var activeCursor={"cursor":"crosshair"};
var defaultCursor={"cursor":"default"};if(!_isMeasuring){_g.MAP.graphics.Find(_c.Symbology.MeasureLineGraphicName).Remove();
_measureLinePoints=[];_g.MAP.enableDoubleClickZoom();dojo.style("cursorInfo",{"display":"none"});
dojo.style("mxdMap_container",defaultCursor);}else{dojo.style("mxdMap_container",activeCursor);
_g.MAP.disableDoubleClickZoom();}_toggleToolbarButton({id:"measure",idSuffix:"Active"});
activeCursor=null;defaultCursor=null;},_startMeasure=function(mapPoint){_measureLinePoints=_measureLinePoints.length>0?_measureLinePoints:[];
_measureLinePoints[0]=new esri.geometry.Point(mapPoint.x,mapPoint.y,_g.MAP.spatialReference);
},_onClick=function(e){_g.ActiveMapPoint=e.mapPoint;if(_isMeasuring){if(_measureLinePoints.length>0){_measureLinePoints[_measureLinePoints.length]=new esri.geometry.Point(e.mapPoint.x,e.mapPoint.y,_g.MAP.spatialReference);
}else{_startMeasure(e.mapPoint);}}else{if(!e.graphic){_doIdentify(e);}else{Garfield.CO.US.Search.OnClick(e);
}}},_onMouseMove=function(e){if(_isMeasuring&&_measureLinePoints.length>0){var mapPoint=e.mapPoint;
var g=_g.MAP.graphics.Find(_c.Symbology.MeasureLineGraphicName);if(g){g.Remove();
}var points=[];for(var item in _measureLinePoints){points.push(_measureLinePoints[item]);
}points.push(new esri.geometry.Point(mapPoint.x,mapPoint.y,_g.MAP.spatialReference));
var line=new esri.geometry.Polyline(_g.MAP.spatialReference);line.addPath(points);
var graphic=new esri.Graphic(line,_measureLineSymbol).SetName(_c.Symbology.MeasureLineGraphicName);
_g.MAP.graphics.add(graphic);dojo.style("cursorInfo",{"top":e.screenPoint.y+_c.UI.CursorInfoOffsetY+"px","left":_getCursorInfoLeft(e.screenPoint.x)+"px","display":"block"});
dojo.byId("cursorInfo").innerHTML=_getFormattedLineLength(_u.GetLineLength(points));
mapPoint=null;points=null;line=null;graphic=null;}},_getFormattedLineLength=function(length){var textFormat="";
if(_c.Map.MetricFormat){if(length>1000){textFormat=(Math.round(length/10)/100)+" km";
}else{textFormat=(Math.round(length*100)/100)+" m";}}else{length=(length/1000)/1.609344;
if(length<1){textFormat=(Math.round(length*528000)/100)+" ft.";}else{textFormat=(Math.round(length*100)/100)+" mi.";
}}return textFormat;},_onDoubleClick=function(e){if(_isMeasuring){_toggleMeasureTool();
}else{if(e.ctrlKey){_zoom(null,1/_c.Map.ZoomFactor);}else{_zoom(null,1*_c.Map.ZoomFactor);
}}},_onMouseDown=function(e){var which=_g.IE?e.button:e.which;var rightClick=_g.IE?2:3;
if(which==rightClick){_doIdentify(e);_g.ActiveMapPoint=e.mapPoint;}},_getCursorInfoLeft=function(currentX){var cursorInfo=dojo.byId("cursorInfo");
var width=cursorInfo.offsetWidth;var offset=_c.UI.CursorInfoOffsetX;var right=currentX+width+offset;
var left=currentX+offset;if(right>_g.MAP.width-10){left=currentX-offset-width;}cursorInfo=null;
width=null;offset=null;right=null;return left;},_toggleHistory=function(){var hide={"display":"none"};
var show={"display":"inline"};if(_g.MAP.Toolbar.isFirstExtent()){dojo.style("historyBack",hide);
dojo.style("historyBackDisabled",show);}else{dojo.style("historyBack",show);dojo.style("historyBackDisabled",hide);
}if(_g.MAP.Toolbar.isLastExtent()){dojo.style("historyForward",hide);dojo.style("historyForwardDisabled",show);
}else{dojo.style("historyForward",show);dojo.style("historyForwardDisabled",hide);
}hide=null;show=null;},_toggleAerialView=function(){_toggleLayers(["Street","Aerial"]);
_toggleToolbarButton({id:"aerial",idSuffix:"Active"});},_toggleToolbarButton=function(args){args.id=_u.IsUndefined(args.id)?false:args.id;
args.idSuffix=_u.IsUndefined(args.idSuffix)?false:args.idSuffix;if(!args.id||!args.idSuffix){return ;
}var display="inline";var hide={"display":"none"};var show={"display":display};if(dojo.style(args.id,"display")==display){dojo.style(args.id,hide);
dojo.style(args.id+args.idSuffix,show);}else{dojo.style(args.id,show);dojo.style(args.id+args.idSuffix,hide);
}},_zoom=function(mapPoint,factor){if(mapPoint){_g.MAP.centerAndZoom(mapPoint,factor);
}else{_g.MAP.setExtent(_g.MAP.extent.expand(factor));}},_center=function(mapPoint){_g.MAP.centerAt(mapPoint);
},_onToolbarClick=function(e){if((_isMeasuring&&e.target.id.indexOf("measure")>-1)||!_isMeasuring){switch(e.target.id){case"historyBack":_g.MAP.Toolbar.zoomToPrevExtent();
break;case"historyForward":_g.MAP.Toolbar.zoomToNextExtent();break;case"zoomIn":_zoom(null,1*_c.Map.ZoomFactor);
break;case"zoomOut":_zoom(null,1/_c.Map.ZoomFactor);break;case"reset":_g.MAP.setExtent(_defaultExtent);
break;case"measure":_toggleMeasureTool();break;case"measureActive":_toggleMeasureTool();
break;case"aerial":_toggleLayerList(e.target);break;case"labels":_toggleLayerList(e.target);
break;case"layers":_toggleLayerList(e.target);break;case"print":_getReport(null,e.target);
break;case"help":_u.ToggleNodeDisplay("mapHelp");}}},_toggleInfoBox=function(){_u.ToggleNodeDisplay("infoBox");
},_toggleLayerList=function(target){if(!_toggleLayersEventHandle){_ui.BuildLabelList(_togglableLayers);
var query='IMG[id*="mxdMap_'+_c.Map.Id+'"]';_toggleLayersEventHandle=dojo.connect(dojo.query("IMG[id*='mxdMap_defaultMap']")[0],"onload",_hideLoadingNode);
}var listName=target.id+"List";var layerNames=_togglableLayers[listName.split("List")[0].toCamelCaseUpper()];
var lists=dojo.query("div.layerList");for(var i=0;i<lists.length;i++){var node=lists[i];
if(node.id===listName){if(target.id=="aerial"&&layerNames.length<2){node.style.display="none";
}else{node.style.display=node.style.display!=="block"?"block":"none";continue;}}node.style.display="none";
node=null;}lists=null;if(target.nodeName==="IMG"){if(layerNames.length<2&&listName.toLowerCase().indexOf("aerial")>-1){layerNames=[layerNames[0].Name];
_toggleLayers(layerNames);var active="aerial";var target=dojo.byId("aerial");if(target.src.toLowerCase().indexOf("active")<0){active+="Active";
}target.src=target.src.substring(target.src.lastIndexOf("/"),0)+"/"+active+".gif";
target=null;}}},_setInfoBoxPosition=function(screenPoint){var infoBox=dojo.byId("infoBox");
var pointer=dojo.byId("infoBoxPointer");var infoBoxWidth=dojo.style(infoBox,"width");
var infoBoxHeight=dojo.style(infoBox,"height");var pointerWidth=dojo.style(pointer,"width");
var pointerHeight=dojo.style(pointer,"height");var pointerOffset=pointerHeight/2;
var x=screenPoint.x;var y=screenPoint.y;var infoBoxLeft=x;var infoBoxTop=y;var pointerTop=pointerOffset;
var infoBoxStyle={};var pointerStyle={};if((x+infoBoxWidth)>(_g.MAP.width-10)){pointer.className="right";
infoBoxLeft=(x-infoBoxWidth-pointerWidth);}else{pointer.className="left";}if(y<infoBoxHeight){infoBoxTop=37;
pointerTop=y-infoBoxTop-pointerOffset;pointerTop=pointerTop<2?2:pointerTop;}else{if(y+infoBoxHeight>_g.MAP.height){infoBoxTop=_g.MAP.height-infoBoxHeight;
pointerTop=y-infoBoxTop-pointerOffset;}else{infoBoxTop=(y-(infoBoxHeight/2));pointerTop=y-infoBoxTop-pointerOffset;
}}infoBoxStyle.left=infoBoxLeft+"px";infoBoxStyle.top=infoBoxTop+"px";pointerStyle.top=pointerTop+"px";
dojo.style(pointer,pointerStyle);dojo.style(infoBox,infoBoxStyle);infoBox=null;pointer=null;
infoBoxWidth=null;infoBoxHeight=null;pointerWidth=null;pointerHeight=null;pointerOffset=null;
x=null;y=null;infoBoxLeft=null;infoBoxTop=null;pointerTop=null;infoBoxStyle=null;
pointerStyle=null;},_setBestView=function(points,factor){factor=factor||0.0009;var xArray=[],yArray=[];
for(var point in points){xArray.push(points[point].x);}for(var point in points){yArray.push(points[point].y);
}var xMin=Math.min.apply(Math,xArray);var xMax=Math.max.apply(Math,xArray);var yMin=Math.min.apply(Math,yArray);
var yMax=Math.max.apply(Math,yArray);xMin=(xMin-(Math.abs(xMin*factor)));xMax=(xMax+(Math.abs(xMax*factor)));
yMin=(yMin-(Math.abs(yMin*factor)));yMax=(yMax+(Math.abs(yMax*factor)));var extent=new esri.geometry.Extent({xmin:xMin,ymin:yMin,xmax:xMax,ymax:yMax,spatialReference:_g.MAP.spatialReference});
try{_g.MAP.setExtent(extent);}catch(Error){console.dir(Error);}},_getIdentifys=function(){var identifys=[],data=_isAdHoc()?_c.Identifys.Identifys:_c.Identifys;
if(!_u.IsUndefined(data)){for(var identify in data){identifys.push(data[identify]===true?identify:data[identify]);
}}return identifys;},_getMultiIdentifyContent=function(){var ids=_getIdentifys(),isAdHoc=_isAdHoc()&&!_u.IsUndefined(_c.Buffers),min=isAdHoc?0:1;
if(ids.length>min){var html="<ul>";for(var key in ids){var value=isAdHoc?ids[key].Layer:ids[key];
html=html.concat('<li><a href="#" onclick="Garfield.CO.US.Mapping.DoIdentify(event,\'').concat(value).concat('\')" class="').concat(value.toCamelCaseLower()).concat('">Identify ').concat(value.fromCamelCase()).concat(value.charAt(value.length-1).toLowerCase()!=="s"?"(s)":"").concat("</a></li>");
}html=html.concat("</ul>");return html;}else{return null;}},_doIdentify=function(e,type){var which=_g.IE?e.button:e.which;
var rightClick=_g.IE?2:3;var rightClicked=rightClick==which;var content=rightClicked?_getMultiIdentifyContent():null;
var isAdHoc=_isAdHoc();type=type||null;var isAnchorClick=_u.GetEventSource(e).nodeName==="A";
var inputClicked=_u.GetEventSource(e).nodeName==="INPUT";var isInfoboxIdentify=isAnchorClick;
type=(isInfoboxIdentify&&isAdHoc)||isAdHoc?_e.IdentifyType.AdHoc:type;var mapPoint=_u.IsUndefined(e.mapPoint)?_g.ActiveMapPoint:e.mapPoint;
if(!content){type=isInfoboxIdentify&&isAdHoc?_e.IdentifyType.AdHoc:type;dojo.byId("infoBox").className="";
_setInfoBoxPosition(_g.MAP.toScreen(mapPoint));if((rightClicked||isInfoboxIdentify||inputClicked)){_toggleInfoBoxContent();
}else{if(_c.UI.HasInfoPane){_u.ToggleNodeDisplay("secondarySidebarContent");_u.ToggleNodeDisplay("secondarySidebarLoading");
}}if(rightClicked||_c.UI.HasInfoPane||type){isInfoboxIdentify=(!rightClicked&&_c.UI.HasInfoPane&&!isAnchorClick)?false:true;
if(!type){try{type=isAdHoc?_e.IdentifyType.AdHoc:_getIdentifys()[0];}catch(Error){throw new Error("No Garfield.CO.US.Enums.IdentifyType defined.");
}}if(!inputClicked){_setInfoboxBufferAction(type);}Garfield.CO.US.Search.ExecuteIdentify({mapPoint:mapPoint,type:type,isAdHoc:isAdHoc,event:e,callback:function(result){_onDoIdentify(result,type,(isInfoboxIdentify||rightClicked),inputClicked);
}});}if(rightClicked){if(!_u.IsUndefined(e.screenPoint)){_setInfoBoxPosition(e.screenPoint);
}if(dojo.style("infoBox","display")=="none"){_toggleInfoBox();}}}else{if((content&&rightClicked)){dojo.byId("infoBox").className="multiIdentify";
_setInfoBoxPosition(e.screenPoint);_setInfoboxContent(null,null,content);if(!_infoBoxContentIsVisible()){_toggleInfoBoxContent();
}if(dojo.style("infoBox","display")=="none"){_toggleInfoBox();}}}},_onDoIdentify=function(result,type,rightClicked,inputClicked){switch(true){case inputClicked:var graphics=[];
for(var item in result){graphics.push(new esri.Graphic(result[item].feature.geometry,null,null));
}Garfield.CO.US.Search.DoBufferSearch(graphics,dojo.byId("bufferDistance").value);
_toggleInfoBox();break;case rightClicked:_setInfoboxContent(result,type);break;default:if(Garfield.CO.US.InfoPane.HandleResult){Garfield.CO.US.InfoPane.HandleResult(result);
}break;}},_getInfoboxBufferActions=function(){var html="";var isAdHoc=_isAdHoc();
var config=isAdHoc?_c.Buffers.Buffers[0]:_c.Search;if(!isAdHoc){for(var item in config){var bufferSearchType=config[item].BufferSearchType;
if(!_u.IsUndefined(bufferSearchType)){html+=_getInfoboxBufferAction(bufferSearchType);
}}}else{var layerName=config.BufferLayerName;html=html.concat("Find <span>").concat(layerName.pluralize()).concat(" within:<br/>").concat('<input id="bufferDistance"').concat(' type="text"').concat(' style="width:25px;font-size:1em;font-weight:bold"').concat(' value="').concat(config.BufferDistance).concat('"/>&nbsp;feet.&nbsp;').concat('&nbsp;<input type="image"').concat(' src="/Images/buffer-find.png"').concat(' style="vertical-align:bottom;cursor:pointer"').concat(" onclick=\"Garfield.CO.US.Mapping.DoIdentify(event, 'AdHoc');return false;\"").concat(' value="Find"/><span>');
}return html;},_getInfoboxBufferAction=function(type){var html="";if(_isAdHoc()){html=_getInfoboxBufferActions();
}else{var unit=_c.Map.MetricFormat?"km":"mile";if(type){var bufferType=eval("_c.Search."+type+".BufferSearchType");
html+="Find ";html+='<span id="bufferAction'+bufferType.toCamelCaseUpper()+'">';html+=bufferType.fromCamelCase().toLowerCase()+"s within<br/></span>";
for(var key in _c.Search.BufferDistances){var unitDisplay=unit;var value=_c.Search.BufferDistances[key];
if(eval(value)>1&&!_c.Map.MetricFormat){unitDisplay+="s";}html+='<a href="#" class="'+bufferType.toCamelCaseLower()+'" + onclick="Garfield.CO.US.Search.DoBufferSearch(new esri.Graphic().setGeometry(Garfield.CO.US.Globals.ActiveMapPoint).SetSearchType(\''+type+"'), this.innerHTML)\">";
html+=value+" "+unitDisplay;html+="</a> | ";}html=html.replace(/\|\s$/,"");}}return html;
},_setInfoboxBufferAction=function(type){try{dojo.byId("infoBox").className="";dojo.byId("infoBoxBuffer").innerHTML=_getInfoboxBufferAction(type);
}catch(Error){}},_getLayerWMSSymbology=function(layerName){var layerId=_getLayerId(layerName);
if(layerId>-1){var wmsId=((_getLayerInfos().length-layerId)-1);var src=_c.Map.Url.replace(/\/rest\/services/i,"output").replace(/\/mapserver/i,"_mapserver/wms/");
src+="default"+wmsId+".png";return{WmsId:wmsId,ImageSrc:src,LayerName:layerName};
}return null;},_getLegendLayers=function(){return _c.Map.LegendLayers.split(/~{3}/);
},_getLayerJson=function(layerName,callbackName){var id=_getLayerId(layerName);if(id>-1){var jsonp=document.createElement("SCRIPT");
jsonp.setAttribute("src",_c.Map.Url+"/"+id+"/?f=json&callback="+callbackName);document.getElementsByTagName("HEAD")[0].appendChild(jsonp);
jsonp=null;}},_setLayerScale=function(layerJson){var layer=_getLayerByNameOrId(layerJson.id);
if(layer){layer.SetScale(layerJson.minScale,layerJson.maxScale);}_setLegend();},_getLegendLayerScales=function(){var legendLayers=_getLegendLayers();
console.dir(legendLayers);if(legendLayers.length>0){for(var legendLayer in legendLayers){_getLayerJson(legendLayers[legendLayer].split("~")[0],"Garfield.CO.US.Mapping.SetLayerScale");
}}},_setLegend=function(){var legendLayers=_getLegendLayers();if(legendLayers.length>0){var html='<table cellpadding="3">';
var scale=_getCurrentScale();var i=0;for(var legendLayer in legendLayers){var layerInfo=legendLayers[legendLayer].split("~");
var layerName=layerInfo[0];var layerDescription=layerInfo.length>1?layerInfo[1]:"";
var layer=_getLayerByNameOrId(layerName);if((layer.Scale.Max<scale&&layer.Scale.Min>scale)||(layer.Scale.Max==0&&layer.Scale.Min==0)){console.log(layerName);
var symbology=_getLayerWMSSymbology(layerName);if(symbology){html+='<tr valign="middle">';
html+='<td style="width:10px;background:url('+symbology.ImageSrc+') -20px center no-repeat">&nbsp;</td>';
html+='<td style="font-weight:bold;font-size:.8em"';html+='title="'+layerDescription+'">';
html+=layerName;html+="</td>";html+="</tr>";i++;}}}if(i==0){html+="<tr><td>No legend information to display.</td></tr>";
}html+="</table>";dojo.byId("tertiarySidebarContent").innerHTML=html;dojo.byId("tertiarySidebarShadow").style.height=dojo.byId("tertiarySidebar").offsetHeight+"px";
dojo.style("tertiarySidebarShadowBottom",{"top":((dojo.byId("mxdMap").offsetTop+dojo.byId("tertiarySidebar").offsetHeight))+"px"});
}},_getCurrentScale=function(){var map=_g.MAP;var maxX=map.extent.xmax;var minX=map.extent.xmin;
var maxY=map.extent.ymax;var minY=map.extent.ymin;var dpi=96;var imageWidth=map.width;
var imageHeight=map.height;var centerX=maxX-(maxX-minX)/2;var centerY=maxY-(maxY-minY)/2;
var dpm=dpi/2.54*100;var width=(imageWidth/2)/dpm;var scale=(maxX-centerX)/width;
return scale;},_setInfoboxContent=function(identifyResult,type,content){var bufferContent=dojo.byId("infoBoxBuffer"),isAdHoc=type===_e.IdentifyType.AdHoc,getAdHocConfig=function(){for(var item in _c.Identifys.Identifys){var configItem=_c.Identifys.Identifys[item];
if(configItem.Layer===identifyResult[0].layerName){return configItem;}}},getAttributeNames=function(config){if(isAdHoc){return{Title:{Attribute:config.Title,Alias:config.Title},Description:{Attribute:config.Description,Alias:config.Description}};
}else{return{Title:{Attribute:config.Title.Field,Alias:config.Title.Alias},Description:{Attribute:config.Description.Field,Alias:config.Description.Alias}};
}};if(identifyResult&&type&&!content){dojo.byId("infoBoxContent").innerHTML="";var html="<div>";
var cssClass="";var i=0;if(identifyResult.length==0){html+='<ul id="noParcelInfo"><li>'+_c.Text.NothingIdentified+"</li></ul>";
}else{var attributes=getAttributeNames(isAdHoc?getAdHocConfig():_c.Search[type]);
for(var item in identifyResult){var value=identifyResult[item].feature.attributes[attributes.Title.Attribute];
cssClass=i%2!=0?' class="separator"':"";html+="<ul"+cssClass+">";html+="<li>";html+="<span>"+attributes.Title.Alias+"</span>:<br />";
html+=value.isNull()?_c.Text.NullData:value;html+="</li>";value=identifyResult[item].feature.attributes[attributes.Description.Attribute];
html+="<li>";html+="<span>"+attributes.Description.Alias+"</span>:<br />";html+=value.isNull()?_c.Text.NullData:value;
html+="</li>";html+="</ul>";i++;}}if(bufferContent){bufferContent.innerHTML=_getInfoboxBufferAction(type);
}html+="</div>";dojo.byId("infoBoxContent").innerHTML=html;_toggleInfoBoxContent();
}else{dojo.byId("infoBoxContent").innerHTML=content;if(bufferContent){bufferContent.innerHTML=_getInfoboxBufferActions();
}}},_toggleInfoBoxContent=function(){_u.ToggleNodeDisplay("infoBoxLoading");_u.ToggleNodeDisplay("infoBoxContent");
_u.ResetScrollTop(dojo.query("#infoBoxMiddle div.content")[0]);},_infoBoxContentIsVisible=function(){return dojo.style("infoBoxContent","display")!="none";
};dojo.addOnLoad(_initialize);return{GetLayerId:function(layerName){return _getLayerId(layerName);
},Zoom:function(mapPoint,factor){_zoom(mapPoint,factor);},Center:function(mapPoint){_center(mapPoint);
},ToggleInfoBox:function(){_toggleInfoBox();},ToggleInfoBoxContent:function(){_toggleInfoBoxContent();
},SetInfoBoxPosition:function(screenPoint){_setInfoBoxPosition(screenPoint);},ToggleLayerList:function(listName){_toggleLayerList(listName);
},ToggleLayers:function(layerName,name){_toggleLayers(layerName,name);},DoIdentify:function(e,type){_doIdentify(e,type);
},SetBestView:function(points,factor){_setBestView(points,factor);},SetInfoboxBufferAction:function(type){_setInfoboxBufferAction(type);
},InfoboxContentIsVisible:function(){return _infoBoxContentIsVisible();},GetLayerWMSSymbology:function(layerName){return _getLayerWMSSymbology(layerName);
},SetLayerScale:function(layerJson){_setLayerScale(layerJson);},GetFormattedLineLength:function(length){return _getFormattedLineLength(length);
},GetMapImage:function(callback){_getMapImage(callback);},GetReport:function(type,targetNode){_getReport(type,targetNode);
},GetBufferReport:function(){_getBufferReport();},IsAdHoc:function(){return _isAdHoc();
}};})();Garfield.CO.US.Search=(function(){_c=Garfield.CO.US.Config,_g=Garfield.CO.US.Globals,_u=Garfield.CO.US.Utils,_e=Garfield.CO.US.Enums,_m=Garfield.CO.US.Mapping,_eo=Garfield.CO.US.EsriObjects,_searchResults=[],_searches=[],_identifys=[],_activeBufferSize=0,_activePushpin=null,_queryDelimiter=_c.Map.DataSourceIsSDE?"%":"*",_searchTypeIsDefined=function(type){var isDefined=false;
for(var searchType in _e.SearchType){if(_e.SearchType[searchType]==type){isDefined=true;
break;}}return isDefined;},_identifyTypeIsDefined=function(type){var isDefined=false;
for(var identifyType in _e.IdentifyType){if(_e.IdentifyType[identifyType]==type){isDefined=true;
break;}}return isDefined;},_getRestUrl=function(layerName){return _c.Map.Url+"/"+_m.GetLayerId(layerName);
},_base=function(args){var __esriTaskType=_u.IsUndefined(args.esriTaskType)?null:args.esriTaskType;
if(!__esriTaskType){throw new Error("No Garfield.CO.US.Enums.EsriTaskType defined.");
}var __url=_u.IsUndefined(args.url)?null:args.url,__taskObject=null,__parametersObject=null,__results=null,__layerIds=[],__setTaskObject=function(){if(__esriTaskType){__taskObject=_eo.GetTaskObject(__esriTaskType,__url);
}},__setParametersObject=function(){if(__esriTaskType){__parametersObject=_eo.GetTaskParametersObject(__esriTaskType);
}},__setTaskObjectUrl=function(url){__taskObject.SetUrl(url);},__getType=function(){return this._type;
},__doSearch=function(callback){__results=null;if(__taskObject&&__parametersObject){__taskObject.execute(__parametersObject,function(result){__results=result;
callback(__results);},function(error){console.dir(error);});}},__execute=function(callback){};
__setTaskObject();__setParametersObject(__esriTaskType);this._getType=__getType;this._setTaskObjectUrl=__setTaskObjectUrl;
this._execute=__execute;this._doSearch=__doSearch;this._parametersObject=__parametersObject;
this._results=__results;this._taskObject=__taskObject;},_find=function(type){if(_searchTypeIsDefined(type)){this._type=type;
}else{throw new Error("No Garfield.CO.US.Enums.SearchType defined.");}},_query=function(type){if(_searchTypeIsDefined(type)){this._type=type;
}else{throw new Error("No Garfield.CO.US.Enums.SearchType defined.");}},_identify=function(type){if(_identifyTypeIsDefined(type)){this._type=type;
}else{throw new Error("No Garfield.CO.US.Enums.IdentifyType defined.");}},_parcelSearch=function(){var __getSearchFields=function(){var searchFields=[];
searchFields.push(_c.Search.Parcel.SearchFields.StreetName);if(_u.RegularExpressions.Digit.test(_getSearchText())){searchFields.push(_c.Search.Parcel.SearchFields.ParcelNumber);
}else{searchFields.push(_c.Search.Parcel.SearchFields.OwnerName);}return searchFields;
};this._execute=function(callback){this._parametersObject.returnGeometry=true;this._results=null;
this._parametersObject.layerIds=[_m.GetLayerId(_c.Search.Parcel.LayerName)];this._parametersObject.searchFields=__getSearchFields();
this._parametersObject.searchText=_getSearchText();this._doSearch(callback);};this._buffer=new _query(_e.SearchType.GasWellBuffer);
this._buffer._execute=function(geometry,callback){this._setTaskObjectUrl(_getRestUrl(_c.Search.GasWell.LayerName));
this._parametersObject.outFields=[];this._parametersObject.returnGeometry=true;for(var item in _c.Search.GasWell.OutFields){this._parametersObject.outFields.push(_c.Search.GasWell.OutFields[item]);
}this._parametersObject.geometry=geometry;this._parametersObject.where=null;this._results=null;
this._doSearch(callback);};},_adHocSearch=function(){this._buffer=new _query(_e.SearchType.AdHoc);
this._buffer._execute=function(geometry,callback){var config=_c.Buffers.Buffers[0];
this._setTaskObjectUrl(_getRestUrl(config.BufferLayerName));this._parametersObject.outFields=[];
this._parametersObject.returnGeometry=true;for(var item in config){if(item.indexOf("AttributeName")>-1){this._parametersObject.outFields.push(config[item]);
}}this._parametersObject.geometry=geometry;this._parametersObject.where=null;this._results=null;
this._doSearch(callback);};},_areaSearch=function(){this._execute=function(callback){this._parametersObject.outFields=[];
for(var item in _c.Search.Area.OutFields){this._parametersObject.outFields.push(_c.Search.Area.OutFields[item]);
}this._parametersObject.returnGeometry=true;this._parametersObject.geometry=null;
this._setTaskObjectUrl(_getRestUrl(_c.Search.Area.LayerName));this._parametersObject.where=_c.Search.Area.SearchFields.Name+" LIKE '"+_queryDelimiter+_getSearchText()+_queryDelimiter+"'";
this._results=null;this._doSearch(callback);};},_customSearch=function(){this._execute=function(callback){var node=_getSearchTypeNode();
this._parametersObject.outFields=[];this._parametersObject.outFields.push("*");if(_c.CustomSearches.CustomSearches!=null){for(var i=0;
i<_c.CustomSearches.CustomSearches.length;i++){if(node.customSearchId==_c.CustomSearches.CustomSearches[i].Id){this._setTaskObjectUrl(_getRestUrl(_c.CustomSearches.CustomSearches[i].Layer));
this._parametersObject.where=_c.CustomSearches.CustomSearches[i].Field+" LIKE '"+_queryDelimiter+_getSearchText()+_queryDelimiter+"'";
}}this._parametersObject.returnGeometry=true;this._parametersObject.geometry=null;
this._results=null;this._doSearch(callback);}};},_addressSearch=function(){var __getWhere=function(){var address=_parseAddress(_getSearchText()),fields=_c.Search.Address.SearchFields,where="";
if(address.Number){do{address.Number="0"+address.Number;}while(address.Number.length<6);
where+=fields.Number+" LIKE '"+address.Number+_queryDelimiter+"'";}if(address.Direction){where+=where.length>0?" AND ":"";
where+=fields.Direction+" LIKE '"+address.Direction.substring(0,1)+_queryDelimiter+"'";
}if(address.Street){where+=where.length>0?" AND ":"";where+=fields.Street+" LIKE '"+_queryDelimiter+address.Street.replace(/^\s/,"")+_queryDelimiter+"'";
}if(address.Suffix){where+=where.length>0?" AND ":"";where+=fields.Suffix+" LIKE '"+address.Suffix.substring(0,1)+_queryDelimiter+"'";
}if(address.Unit){where+=where.length>0?" AND ":"";where+=fields.Unit+" LIKE '"+_queryDelimiter+address.Unit.replace(/([a-z]+|\#)\s*/i,"")+_queryDelimiter+"'";
}return where;};this._execute=function(callback){this._parametersObject.outFields=[];
this._parametersObject.returnGeometry=true;for(var item in _c.Search.Address.OutFields){this._parametersObject.outFields.push(_c.Search.Address.OutFields[item]);
}this._setTaskObjectUrl(_getRestUrl(_c.Search.Address.LayerName));this._parametersObject.where=__getWhere();
this._results=null;this._doSearch(callback);};},_parcelIdentify=function(){this._execute=function(mapPoint,event,callback){this._parametersObject.layerIds=[_m.GetLayerId(_c.Search.Parcel.LayerName)];
this._parametersObject.tolerance=2;this._parametersObject.returnGeometry=true;this._parametersObject.mapExtent=_g.MAP.extent;
this._parametersObject.spatialReference=_g.MAP.spatialReference;this._parametersObject.layerOption=esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
this._parametersObject.geometry=mapPoint;this._doSearch(callback);};},_gasWellIdentify=function(){this._execute=function(mapPoint,event,callback){this._parametersObject.layerIds=[_m.GetLayerId(_c.Search.GasWell.LayerName)];
this._parametersObject.tolerance=6;this._parametersObject.returnGeometry=true;this._parametersObject.mapExtent=_g.MAP.extent;
this._parametersObject.spatialReference=_g.MAP.spatialReference;this._parametersObject.layerOption=esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
this._parametersObject.geometry=mapPoint;this._doSearch(callback);};},_adHocIdentify=function(){this._execute=function(mapPoint,event,callback){var which=_g.IE?event.button:event.which,rightClick=_g.IE?2:3,rightClicked=rightClick==which,__isInfoboxClick=_u.GetEventSource(event).nodeName==="A",__isInputClick=_u.GetEventSource(event).nodeName==="INPUT",__getLayers=function(){var layers=[];
switch(true){case __isInfoboxClick:layers.push(_m.GetLayerId(_u.GetEventSource(event).innerHTML.split("Identify ")[1].replace("(s)","")));
break;case __isInputClick:layers.push(_m.GetLayerId("Public Lands"));break;case rightClicked:layers.push(_m.GetLayerId(_c.Identifys.Identifys[0].Layer));
break;default:var groups=_c.InformationPaneGroups.InformationPaneGroups;for(var item in groups){var layerId=_m.GetLayerId(groups[item].LayerName);
if(dojo.indexOf(layers,layerId)===-1){layers.push(layerId);}}break;}return layers;
};this._parametersObject.layerIds=__getLayers();this._parametersObject.tolerance=2;
this._parametersObject.returnGeometry=true;this._parametersObject.mapExtent=_g.MAP.extent;
this._parametersObject.spatialReference=_g.MAP.spatialReference;this._parametersObject.layerOption=esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
this._parametersObject.geometry=mapPoint;this._doSearch(callback);};},_gasWellSearch=function(){var __getSearchFields=function(){var searchFields=[];
for(var field in _c.Search.GasWell.SearchFields){searchFields.push(_c.Search.GasWell.SearchFields[field]);
}return searchFields;};this._execute=function(callback){this._results=null;this._parametersObject.layerIds=[_m.GetLayerId(_c.Search.GasWell.LayerName)];
this._parametersObject.returnGeometry=true;this._parametersObject.searchFields=__getSearchFields();
this._parametersObject.searchText=_getSearchText();this._doSearch(callback);};this._buffer=new _query(_e.SearchType.ParcelBuffer);
this._buffer._execute=function(geometry,callback){this._setTaskObjectUrl(_getRestUrl(_c.Search.Parcel.LayerName));
this._parametersObject.outFields=[];this._parametersObject.returnGeometry=true;for(var item in _c.Search.Parcel.OutFields){this._parametersObject.outFields.push(_c.Search.Parcel.OutFields[item]);
}for(var item in _c.Search.Address.OutFields){this._parametersObject.outFields.push(_c.Search.Address.OutFields[item]);
}this._parametersObject.geometry=geometry;this._parametersObject.where=null;this._results=null;
this._doSearch(callback);};this._isPermit=new _query(_e.SearchType.GasWellPermit);
this._isPermit._execute=function(apiNumber,callback){this._setTaskObjectUrl(_getRestUrl(_c.Search.GasWellPermit.LayerName));
this._parametersObject.outFields=[];this._parametersObject.returnGeometry=false;this._parametersObject.where=_c.Search.GasWellPermit.SearchFields.APINumber+" = '"+apiNumber+"'";
this._results=null;this._doSearch(callback);};},_toggleSearch=function(e){if(e==null){for(var item in _c.Searches){if(_c.Searches[item]){_getSearchBox().value=eval("_c.Search."+item+".TipText");
return ;}}if(_c.CustomSearches.CustomSearches!=null){for(var i=0;i<_c.CustomSearches.CustomSearches.length;
i++){if(_c.CustomSearches.CustomSearches[i]){_getSearchBox().value=_c.CustomSearches.CustomSearches[i].Hint;
return ;}}}}var node=_u.IsUndefined(e)?_getSearchTypeNode():e.target,type=node.innerHTML,textBox=_getSearchBox();
dojo.forEach(dojo.query("#search LI A"),function(item){item.className=item==node?"selected":"";
});if((_searchBoxContainsDefaultText()||_searchBoxIsEmpty())&&node.customSearchId==null){textBox.value=eval("_c.Search."+type.toCamelCaseUpper()+".TipText");
textBox.className="";}else{if(_c.CustomSearches.CustomSearches!=null){for(var i=0;
i<_c.CustomSearches.CustomSearches.length;i++){if(_c.CustomSearches.CustomSearches[i].Id==node.customSearchId){textBox.value=_c.CustomSearches.CustomSearches[i].Hint;
}}}}node=null;type=null;textBox=null;},_attachEvents=function(){if(dojo.byId("search")){dojo.forEach(dojo.query("#search LI A"),function(item){dojo.connect(item,"onclick",_toggleSearch);
});dojo.connect(_getSearchBox(),"onfocus",_clearSearchBox);dojo.connect(dojo.byId("btnSearch"),"onclick",_doSearch);
dojo.connect(dojo.byId("txtSearch"),"onblur",_resetSearchBox);dojo.connect(dojo.byId("txtSearch"),"onkeypress",_doSearch);
document.forms[0].onsubmit=function(e){return false;};}},_getSearchBox=function(){return dojo.byId("txtSearch");
},_getSearchText=function(){return _getSearchBox().value;},_getSearchType=function(){var node=_getSearchTypeNode();
if(node.customSearchId){return"CustomSearch";}else{return node.innerHTML.toCamelCaseUpper();
}},_getSearchTypeNode=function(){return dojo.query("#search LI A.selected")[0];},_clearSearchBox=function(e){var textBox=_getSearchBox();
if(_searchBoxContainsDefaultText()){textBox.value="";textBox.className="active";}textBox=null;
},_resetSearchBox=function(){if(_searchBoxIsEmpty()){_getSearchBox().className="";
_toggleSearch();}},_searchBoxIsEmpty=function(){var isEmpty=new RegExp(/^\s+$/),value=_getSearchText();
if(value.length==0||isEmpty.test(value)){return true;}return false;},_searchBoxContainsDefaultText=function(){for(var item in _c.Search){var tipText=_c.Search[item].TipText;
if(!_u.IsUndefined(tipText)){if(_getSearchText()==tipText){return true;}}}if(_c.CustomSearches.CustomSearches!=null){for(var i=0;
i<_c.CustomSearches.CustomSearches.length;i++){var hint=_c.CustomSearches.CustomSearches[i].Hint;
if(!_u.IsUndefined(name)){if(_getSearchText()==hint){return true;}}}}return false;
},_onClick=function(e){var graphic=e.graphic,symbol=graphic.symbol;switch(symbol.type){case"picturemarkersymbol":dojo.stopEvent(e);
_activePushpin=graphic;_showSearchResultDetail(graphic);break;case"simplefillsymbol":_activePushpin=null;
_m.DoIdentify(e);break;}_g.ActiveMapPoint=graphic.geometry;},_parseAddress=function(address){var input=address,addressParts={Address:null,Unit:null},addressSplit=input.split(/\,\s+/),regExps=_u.RegularExpressions,address={Number:null,Direction:null,Street:null,Suffix:null,Unit:null};
addressParts.Address=addressSplit[0].split(/\s+/);addressParts.Unit=!_u.IsUndefined(addressSplit[1])?addressSplit[1]:null;
if(!address.Street){address.Street="";for(var i=0,l=addressParts.Address.length;i<l;
i++){var part=addressParts.Address[i];if(i==0&&regExps.Digit.test(part)&&!regExps.Unit.test(part)){address.Number=part;
continue;}else{if(!address.Direction&&regExps.Direction.test(part)){address.Direction=part;
continue;}else{if(!address.Suffix&&regExps.Suffix.test(part)){address.Suffix=part;
continue;}else{if(i==l-1&&regExps.Unit.test(part)){address.Unit=part;continue;}else{address.Street+=" "+part;
continue;}}}}}if(!address.Unit){address.Unit=addressParts.Unit;}}if(regExps.CountyRoad.test(address.Street)){var re=/\d+/;
if(address.Street.match(re)){address.Street=address.Street.replace(/county\s+\d+/i,address.Street.match(re)[0]+" county");
}re=null;}address.Street=address.Street.replace(" ","");return address;},_getSearchContentContainer=function(){return dojo.byId("primarySidebarContent");
},_doSearch=function(e){var which=_g.IE?e.keyCode:e.which;if(e.type=="keypress"){if(which!=13||_searchBoxContainsDefaultText()||_searchBoxIsEmpty()){return ;
}}_executeSearch({type:_getSearchType(),callback:_onDoSearch});_setSidebarTitle(null);
_toggleSearchResultContent();if(dojo.style("infoBox","display")!="none"){_m.ToggleInfoBox();
}which=null;},_setSidebarTitle=function(searchResult){var titleContainer=dojo.byId("primarySidebarTitle");
if(!searchResult||!searchResult.Attributes||searchResult.SearchType===_e.SearchType.AdHoc||(_m.IsAdHoc()&&searchResult.SearchType!==_e.SearchType.AdHoc)){titleContainer.innerHTML="Search Results";
titleContainer.className="";titleContainer.style.backgroundImage="none";}else{var config=eval("_c.Search."+searchResult.SearchType);
var title=config.BufferSearchType.fromCamelCase()+"s ";title+="within "+_activeBufferSize+" of ";
var address="";if(!_u.IsUndefined(config.Description.ShowAddress)&&config.Description.ShowAddress){address=_getAddress(searchResult);
}if(!address.isNull()){title+=_getSearchResultAnchor(searchResult,address);}else{title+=config.Description.Alias+" ";
title+=_getSearchResultAnchor(searchResult,searchResult.Attributes[config.Description.Field]);
}titleContainer.innerHTML=title;var imageType=_g.IE6?".gif":".png";titleContainer.className="searchResult";
titleContainer.style.backgroundImage="url(/Images/Pushpins/"+searchResult.SearchType+"/selected"+imageType+")";
}titleContainer=null;},_getSearchResultAnchor=function(searchResult,text){var html='<a class="';
html+=searchResult.SearchType.toCamelCaseLower();html+='" href="#" title="Center the map here."';
html+=' onclick="Garfield.CO.US.Search.SearchResultOnClick('+(searchResult.SearchIndex).toString()+')">';
html+=text;html+="</a>";return html;},_onDoSearch=function(result,type,graphic){type=type||_getSearchType();
type=type.getBufferParentType();graphic=graphic||null;var results=result.features?result.features:result,graphicCenter=null;
_searchResults=[];if(graphic){graphic.SetSearchIndex(0);graphicCenter=graphic.geometry.type==="point"?graphic.geometry:graphic.geometry.getExtent().getCenter();
_searchResults.push(new _searchResult({index:-1,centerPoint:graphicCenter,geometry:graphic.geometry,attributes:graphic.Attributes,searchIndex:0,searchType:graphic.SearchType,name:graphic.Name}));
if(_searchResults[0].Index==-1){_setSidebarTitle(_searchResults[0]);}}else{_setSidebarTitle(null);
}if(results.length<1){_getSearchContentContainer().innerHTML=_c.NoSearchResultsText;
dojo.byId("primarySidebarActions").innerHTML="";}else{var index=1;_getSearchContentContainer().innerHTML="";
var maxResults=eval("_c.Search."+type+".MaxResults");maxResults=_u.IsUndefined(maxResults)?_c.Search.MaxResults:maxResults;
for(var i=0,l=results.length;i<l;i++){if(i>maxResults-1){break;}if(index>_c.Search.ResultsPerPage){index=1;
}var currentResult=results[i].feature?results[i].feature:results[i],center=currentResult.geometry.type==="point"?currentResult.geometry:currentResult.geometry.getExtent().getCenter();
if(graphic&&graphicCenter){currentResult.attributes[_c.Search.CustomAttributes.BufferDistance]=_m.GetFormattedLineLength(_u.GetLineLength([graphicCenter,center]));
}var searchResult=new _searchResult({index:index,centerPoint:center,geometry:currentResult.geometry,attributes:currentResult.attributes,searchIndex:_searchResults.length,searchType:type,name:type+(index)});
_searchResults.push(searchResult);index++;}_setSearchResultsPage(1,0);}_toggleSearchResultContent();
Garfield.CO.US.UI.ToggleSidebar(dojo.query(".sidebarTab")[0]);},_getSearchResultsPaging=function(pageNumber){var html="",searchClass="";
console.dir(_activePushpin);if(_g.MAP.graphics.Find(_c.Symbology.BufferGraphicName)&&_activePushpin){searchClass=_activePushpin.SearchType===_e.SearchType.AdHoc?_e.SearchType.AdHoc.toCamelCaseLower():eval("_c.Search."+_activePushpin.SearchType+".BufferSearchType").toCamelCaseLower();
}else{searchClass=_getSearchType().toCamelCaseLower();}if(_searchResults.length>_c.Search.ResultsPerPage){var mod=_searchResults.length%_c.Search.ResultsPerPage;
var pages=Math.floor(_searchResults.length/_c.Search.ResultsPerPage);pages=mod>0?pages+1:pages;
var searchResultsIndex=0;html='<br/>Page:<ul class="pages">';for(var i=0;i<pages;
i++){var page=i+1;var className=page==pageNumber?"selected":"";searchResultsIndex=i*_c.Search.ResultsPerPage;
if(dojo.some(_searchResults,function(item){return item.Index===-1;})){searchResultsIndex=searchResultsIndex+1;
}html+="<li";if(page==pageNumber){html+=' id="selectedPage"';}html+=">";if(page!=pageNumber){html+='<a class="'+className+" "+searchClass+'" href="#"';
html+=' onclick="Garfield.CO.US.Search.GetSearchResultsPage(';html+=page+", "+searchResultsIndex;
html+=')">';}html+=page;if(page!=pageNumber){html+="</a>";}html+="</li>";}html+="</ul>";
}return html;},_hasSelectedPushpin=function(){for(var item in _g.MAP.graphics.graphics){if(_g.MAP.graphics.graphics[item].Name.indexOf("Selected")>0){return true;
}}return false;},_setSearchResultsPage=function(pageNumber,index){if(dojo.some(_searchResults,function(item){return item.Index===-1;
})&&pageNumber===1){index=index+1;}var length=index+_c.Search.ResultsPerPage,i=index,searchResult=null,pushpinIndex=1,points=[],graphics=[];
_getSearchContentContainer().innerHTML="";try{_g.MAP.graphics.Remove();do{searchResult=_searchResults[i];
if(searchResult.Index!=-1){if(searchResult.CenterPoint){if(searchResult.SearchType===_e.SearchType.Area){var line=null,fill=null,area=null,symbology=_c.FeatureSymbology.Area,hasOutline=symbology.Line.Visible,hasFill=symbology.Fill.Visible;
if(hasOutline){line=new esri.symbol.SimpleLineSymbol().setStyle(esri.symbol.SimpleLineSymbol.STYLE_SOLID).setWidth(3).setColor(new dojo.Color([symbology.Line.Color.R,symbology.Line.Color.G,symbology.Line.Color.G,0.5]));
}if(hasFill){fill=new esri.symbol.SimpleFillSymbol().setStyle(esri.symbol.SimpleFillSymbol.STYLE_SOLID).setOutline(line).setColor(new dojo.Color([symbology.Fill.Color.R,symbology.Fill.Color.G,symbology.Fill.Color.B,0.5]));
}if(line&&!fill){area=new esri.Graphic().setGeometry(searchResult.Geometry).setSymbol(line);
_g.MAP.graphics.add(area);}if(fill){area=new esri.Graphic().setGeometry(searchResult.Geometry).setSymbol(fill);
_g.MAP.graphics.add(area);}}points.push(searchResult.CenterPoint);var pushpinSource=_getPushpinSource(searchResult.Index,searchResult.SearchType.getBufferParentType().toCamelCaseUpper()),symbol=new esri.symbol.PictureMarkerSymbol().setHeight(38).setWidth(31).setUrl(pushpinSource),graphic=new esri.Graphic().setGeometry(searchResult.CenterPoint).setSymbol(symbol).SetSearchIndex(searchResult.SearchIndex).SetSearchType(searchResult.SearchType).SetName(searchResult.SearchType.getBufferParentType()+pushpinIndex).SetAttributes(searchResult.Attributes);
_g.MAP.graphics.add(graphic);pushpinSource=null;symbol=null;graphic=null;}_getSearchContentContainer().innerHTML+=_createSearchResult(searchResult);
pushpinIndex++;}i++;}while(i<length&&i<_searchResults.length);}catch(Error){console.log(Error);
}var buffer=_g.MAP.graphics.Find(_c.Symbology.BufferGraphicName);if(points.length>0){if(points.length==1){if(searchResult.SearchType===_e.SearchType.GasWell){_m.Center(searchResult.Geometry);
}else{_g.MAP.setExtent(searchResult.Geometry.getExtent());}}else{var factor=eval("_c.Search."+searchResult.SearchType);
factor=(_u.IsUndefined(factor)||_u.IsUndefined(factor.BestViewFactor))?_c.Search.BestViewFactor:factor.BestViewFactor;
_m.SetBestView(points,factor);factor=null;}}_getSearchContentContainer().innerHTML+=_getSearchResultsPaging(pageNumber);
_setPrimarySidebarActions();_u.ResetScrollTop(_getSearchContentContainer());},_setPrimarySidebarActions=function(){var html='<div id="primarySidebarActions">',title=dojo.query("#primarySidebarTitle a");
html+="Page "+_getCurrentPageNumber()+" of "+_getPageCount();if(title.length>0){var className=title[0].className;
html+="&nbsp;&nbsp;&#124;&nbsp;&nbsp;";html+='<a href="#" class="'+className+'" onclick="Garfield.CO.US.Mapping.GetBufferReport();">print this page</a>';
}dojo.byId("primarySidebarActions").innerHTML=html;title=null;},_getPushpinSource=function(index,searchType){var pushpinDirectory=_c.Search.DefaultPushpinDirectory,directory,imageType=_g.IE6?".gif":".png";
try{directory=eval("_c.Search."+searchType+".PushpinDirectory");}catch(error){}if(!_u.IsUndefined(directory)&&!directory.isNull()){pushpinDirectory=directory;
}return pushpinDirectory+"/"+index+imageType;},_toggleSearchResultContent=function(){_u.ToggleNodeDisplay("primarySidebarContent");
_u.ToggleNodeDisplay("primarySidebarLoading");},_searchResult=function(args){this.Index=_u.IsUndefined(args.index)?null:args.index;
this.SearchIndex=_u.IsUndefined(args.searchIndex)?null:args.searchIndex;this.CenterPoint=_u.IsUndefined(args.centerPoint)?null:args.centerPoint;
this.Geometry=_u.IsUndefined(args.geometry)?null:args.geometry;this.Attributes=_u.IsUndefined(args.attributes)?null:args.attributes;
this.SearchType=_u.IsUndefined(args.searchType)?_getSearchType():args.searchType;
this.Name=_u.IsUndefined(args.name)?null:args.name;},_createSearchResult=function(searchResult){var hasCenterPoint=searchResult.CenterPoint!=null,titleClass=hasCenterPoint?"title":"",searchResultClass="searchResult",title="",description="",bufferDistance=!_u.IsUndefined(searchResult.Attributes[_c.Search.CustomAttributes.BufferDistance])?searchResult.Attributes[_c.Search.CustomAttributes.BufferDistance]:null,type=searchResult.SearchType.getBufferParentType(),config=(_g.MAP.graphics.Find("buffer")&&type===_e.SearchType.AdHoc)?_c.Buffers.Buffers[0]:eval("_c.Search."+type),attributes=_getBufferAttributeConfig(config,type===_e.SearchType.AdHoc),imageType=_g.IE6?".gif":".png",pushpinSource=_getPushpinSource(searchResult.Index,type),html='<div class="'+searchResultClass+'">';
if(type=="CustomSearch"){var node=_getSearchTypeNode();for(var i=0;i<_c.CustomSearches.CustomSearches.length;
i++){if(node.customSearchId==_c.CustomSearches.CustomSearches[i].Id){title=searchResult.Attributes[_c.CustomSearches.CustomSearches[i].Field];
description="";}}}else{if(!_u.IsUndefined(config)){title=searchResult.Attributes[attributes.Title.Attribute];
if(!_u.IsUndefined(config.Description)){if(!_u.IsUndefined(config.Description.ShowAddress)&&config.Description.ShowAddress){description=_getAddress(searchResult);
}}else{if(!attributes.Description.Attribute.isNull()){description=searchResult.Attributes[attributes.Description.Attribute];
}}}}title=title.isNull()?_c.Text.NullData:title;html+='<img class="pushpin" src="';
html+=pushpinSource;html+='" height="38" width="31" />';html+='<div class="content">';
html+='<span class="'+titleClass+'">';if(hasCenterPoint){html+='<a id="'+searchResult.SearchIndex.toString()+'" class="'+searchResult.SearchType.toCamelCaseLower()+'" href="#" title="Center the map here." onclick="Garfield.CO.US.Search.SearchResultOnClick('+(searchResult.SearchIndex).toString()+')">';
}html+=title;if(hasCenterPoint){html+="</a>";}html+="</span>";html+='<span class="description">';
html+=description;html+="</span>";if(bufferDistance){html+='<span class="distance">'+bufferDistance+"</span>";
}html+="</div>";html+="</div>";return html;},_searchResultOnClick=function(index){_m.Center(_searchResults[index].CenterPoint);
},_getAddress=function(searchResult){var attributes=searchResult.Attributes,fields=_c.Search.Address.OutFields,number=attributes[fields.Number];
direction=attributes[fields.Direction],street=attributes[fields.Street],suffix=attributes[fields.Suffix],unit=attributes[fields.Unit],address=null;
number=number===null||number.isNull()?null:number.replace(/0+/,"");direction=direction===null||direction.isNull()?null:direction;
direction=direction?direction.indexOf(".")>-1?direction:direction+".":direction;street=street===null||street.isNull()?null:street;
suffix=suffix===null||suffix.toLowerCase().isNull()?null:suffix;suffix=suffix?suffix.indexOf(".")>-1?suffix:suffix+".":suffix;
if(unit!=undefined){unit=unit===null||unit.toLowerCase().isNull()?null:"# "+unit;
}else{unit="";}address=number?number:"";address+=direction?" "+direction:"";address+=street?" "+street:"";
address+=suffix?" "+suffix:"";address+=unit?", "+unit:"";attributes[_c.Search.CustomAttributes.Address]=address;
return address;},_showSearchResultDetail=function(graphic){var searchResult=_searchResults[graphic.SearchIndex];
if(_m.InfoboxContentIsVisible()){_m.ToggleInfoBoxContent();}dojo.forEach(dojo.query("#infoBoxActions P:not(#infoBoxBuffer) A"),function(item){item.className=searchResult.SearchType.toCamelCaseLower();
});switch(searchResult.SearchType){case _e.SearchType.GasWell:_getSearch(_e.SearchType.GasWell)._isPermit._execute(searchResult.Attributes[_c.Search.GasWell.SearchFields.APINumber],function(result){searchResult.IsPermit=result.features.length>0?true:false;
dojo.byId("infoBoxContent").innerHTML=_getSearchResultDetail(searchResult);if(!_m.InfoboxContentIsVisible()){_m.ToggleInfoBoxContent();
}});_m.SetInfoboxBufferAction(searchResult.SearchType);break;case _e.SearchType.Parcel:_m.SetInfoboxBufferAction(searchResult.SearchType);
dojo.byId("infoBoxContent").innerHTML=_getSearchResultDetail(searchResult);if(!_m.InfoboxContentIsVisible()){_m.ToggleInfoBoxContent();
}break;case _e.SearchType.Area:case _e.SearchType.AdHoc:if(dojo.byId("infoBoxBuffer")){dojo.byId("infoBoxBuffer").innerHTML="";
dojo.byId("infoBoxContent").innerHTML=_getSearchResultDetail(searchResult);}if(!_m.InfoboxContentIsVisible()){_m.ToggleInfoBoxContent();
}default:dojo.byId("infoBoxContent").innerHTML=_getSearchResultDetail(searchResult);
if(!_m.InfoboxContentIsVisible()){_m.ToggleInfoBoxContent();}break;}_m.SetInfoBoxPosition(_g.MAP.toScreen(searchResult.CenterPoint));
_g.ActiveMapPoint=searchResult.CenterPoint;if(dojo.style("infoBox","display")=="none"){_m.ToggleInfoBox();
}},_getBufferAttributeConfig=function(config,isAdHoc){var attributes={Title:{Attribute:"",Alias:""},Description:{Attribute:"",Alias:""}};
if(isAdHoc){attributes.Title.Attribute=config.TitleAttributeName;attributes.Title.Alias=config.TitleAttributeAlias;
attributes.Description.Attribute=config.DescriptionAttributeName;attributes.Description.Alias=config.DescriptionAttributeAlias;
}else{attributes.Title.Attribute=config.Title.Field;attributes.Title.Alias=config.Title.Alias;
attributes.Description.Attribute=config.Description.Field;attributes.Description.Alias=config.Description.Alias;
}return attributes;},_getCustomSearchResultDetail=function(searchResult){var node=_getSearchTypeNode();
for(var i=0;i<_c.CustomSearches.CustomSearches.length;i++){if(node.customSearchId==_c.CustomSearches.CustomSearches[i].Id){title=searchResult.Attributes[_c.CustomSearches.CustomSearches[i].Field];
description=searchResult.Attributes[_c.CustomSearches.CustomSearches[i].Field];}}html="";
for(var prop in searchResult.Attributes){if(prop.toUpperCase().indexOf("SHAPE_")==-1&&prop.toUpperCase().indexOf("OBJECTID")==-1&&prop.toUpperCase().indexOf("GLOBALID")==-1&&prop.toUpperCase().indexOf("SHAPE.")==-1){html+="<li>";
html+="<span>"+prop+"</span>:<br />";html+=prop.isNull()?_c.Text.NullData:searchResult.Attributes[prop];
html+="</li>";var value;if(!searchResult.Attributes[prop]==undefined){html+="<li>";
value=searchResult.Attributes[prop]==undefined?_c.Text.NullData:searchResult.Attributes[prop];
html+=value;html+="</li>";}}}html+="</ul>";return html;},_getSearchResultDetail=function(searchResult){type=searchResult.SearchType,isAdHoc=(_g.MAP.graphics.Find("buffer")&&type===_e.SearchType.AdHoc),address="",config=isAdHoc?_c.Buffers.Buffers[0]:eval("_c.Search."+type),attributes=_getBufferAttributeConfig(config,searchResult.SearchType===_e.SearchType.AdHoc),value=searchResult.Attributes[attributes.Title.Attribute];
if(type!="CustomSearch"){var html="";if(searchResult.SearchType===_e.SearchType.GasWell&&searchResult.IsPermit){html+="<p>This gas well is a permit.</p>";
}html+="<li>";html+="<span>"+attributes.Title.Alias+"</span>:<br />";html+=value.isNull()?_c.Text.NullData:value;
html+="</li>";value="";if(!attributes.Description.Attribute.isNull()){value=searchResult.Attributes[attributes.Description.Attribute];
html+="<li>";html+="<span>"+attributes.Description.Alias+"</span>:<br />";value=value.isNull()?_c.Text.NullData:value;
if(searchResult.SearchType===_e.SearchType.GasWell&&value!=_c.Text.NullData){var href=_c.Search.GasWell.ReportUrl.replace("$",value.replace(/\-/g,"").substring(2,10));
html+='<a class="gasWell" href="'+href+'" target="_blank">';html+=value;html+="</a>";
}else{html+=value;}html+="</li>";}if(!_u.IsUndefined(config.Description)){if(!_u.IsUndefined(config.Description.ShowAddress)&&config.Description.ShowAddress){address=_getAddress(searchResult);
}if(!address.isNull()){html+="<li>";html+="<span>Address</span>:<br />";html+=address;
html+="</li>";}}html+="</ul>";return html;}else{return _getCustomSearchResultDetail(searchResult);
}},_getCurrentPageNumber=function(){try{return parseInt(dojo.query("#selectedPage")[0].innerHTML);
}catch(Error){return 1;}},_getPageCount=function(){try{var length=dojo.query("ul.pages li").length;
length=length<1?1:length;return length;}catch(Error){return 1;}},_addSearchNodes=function(){var searches=[],html="";
for(var search in _c.Searches){if(_c.Searches[search]){searches.push(search);}}for(var i=0;
i<searches.length;i++){var style=i==0?"padding-left:0;":"";if(_c.CustomSearches.CustomSearches==null){style=style.concat(i==(searches.length-1)?"border:0;":"");
}else{style=style.concat(i==(searches.length-1)&&_c.CustomSearches.CustomSearches.length==0?"border:0;":"");
}html+="<li";html+=style.length>0?' style="'+style+'"':"";html+=">";html+='<a href="#"';
html+=i==0?' class="selected"':"";html+=">";html+=searches[i].fromCamelCase();html+="</a></li>";
}if(_c.CustomSearches.CustomSearches!=null){for(var i=0;i<_c.CustomSearches.CustomSearches.length;
i++){var style=i==0?"padding-left:0;":"";if(searches.length>0){style="";}style=style.concat(i==(_c.CustomSearches.CustomSearches.length-1)?"border:0;":"");
html+="<li";html+=style.length>0?' style="'+style+'"':"";html+=">";html+='<a customSearchId="'+_c.CustomSearches.CustomSearches[i].Id+'" href="#"';
if(!searches.length>0){html+=i==0?' class="selected"':"";}html+=">";html+=_c.CustomSearches.CustomSearches[i].Name.fromCamelCase();
html+="</a></li>";}}var node=dojo.query("#search ul");if(node.length>0){node[0].innerHTML=html;
}style=null;html=null;},_initialize=function(){_addSearchNodes();_attachEvents();
if(dojo.byId("search")){_toggleSearch(null);_find.prototype=new _base({esriTaskType:_e.EsriTaskType.Find});
_query.prototype=new _base({esriTaskType:_e.EsriTaskType.Query});_identify.prototype=new _base({esriTaskType:_e.EsriTaskType.Identify});
_parcelSearch.prototype=new _find(_e.SearchType.Parcel);_areaSearch.prototype=new _query(_e.SearchType.Area);
_customSearch.prototype=new _query(_e.SearchType.CustomSearch);_addressSearch.prototype=new _query(_e.SearchType.Address);
_parcelIdentify.prototype=new _identify(_e.IdentifyType.Parcel);_gasWellIdentify.prototype=new _identify(_e.IdentifyType.GasWell);
_gasWellSearch.prototype=new _find(_e.SearchType.GasWell);_adHocIdentify.prototype=new _identify(_e.IdentifyType.AdHoc);
_adHocSearch.prototype=new _query(_e.SearchType.AdHoc);}},dojo.addOnLoad(_initialize);
_executeSearch=function(args){args.type=_u.IsUndefined(args.type)?false:args.type.toCamelCaseUpper();
args.callback=_u.IsUndefined(args.callback)?false:args.callback;if(!args.type||!_searchTypeIsDefined(args.type)){throw new Error("No Garfield.CO.US.Enums.SearchType defined.");
}if(!args.callback||typeof (args.callback)!="function"){throw new Error("No callback function specified for search.");
}_getSearch(args.type)._execute(args.callback);},_executeIdentify=function(args){args.mapPoint=_u.IsUndefined(args.mapPoint)?false:args.mapPoint;
args.type=_u.IsUndefined(args.type)?false:args.type.toCamelCaseUpper();args.callback=_u.IsUndefined(args.callback)?false:args.callback;
args.isAdHoc=_u.IsUndefined(args.isAdHoc)?false:args.isAdHoc;args.event=_u.IsUndefined(args.event)?false:args.event;
if(args.isAdHoc){args.type=_e.IdentifyType.AdHoc;}if(!_identifyTypeIsDefined(args.type)){throw new Error("No Garfield.CO.US.Enums.IdentifyType defined.");
}if(typeof (args.callback)!="function"){throw new Error("No callback function specified for identify.");
}if(!args.mapPoint){throw new Error("No map point specified for identify.");}_getIdentify(args.type)._execute(args.mapPoint,args.event,args.callback);
},_getSearch=function(type){if(!_searchTypeIsDefined(type)){throw new Error("No Garfield.CO.US.Enums.SearchType defined.");
}try{for(var search in _searches){if(_searches[search]._getType()==type){return _searches[search];
}}var searchObject=null;if(type!="CustomSearch"){searchObject=eval("new _"+type.toCamelCaseLower()+"Search");
}else{searchObject=new _customSearch;}_searches.push(searchObject);return searchObject;
}catch(error){console.log(error.message);throw new Error("Unable to create _"+type.toCamelCaseLower()+"Search");
}},_getIdentify=function(type){if(!_identifyTypeIsDefined(type)){throw new Error("No Garfield.CO.US.Enums.IdentifyType defined.");
}try{for(var identify in _identifys){if(_identifys[identify]._getType()==type){return _identifys[identify];
}}var identifyObject=eval("new _"+type.toCamelCaseLower()+"Identify");_identifys.push(identifyObject);
return identifyObject;}catch(error){throw new Error("Unable to create _"+type.toCamelCaseLower()+"Identify");
}},_doBufferSearch=function(graphic,distance){var isAdHoc=_m.IsAdHoc(),gsvc=_eo.GetTaskObject(_e.EsriTaskType.GeometryService),params=new esri.tasks.BufferParameters();
if(!isAdHoc){if(!_activePushpin||_activePushpin.geometry!=graphic.geometry){_activePushpin=graphic;
}var selectedPushpins=_g.MAP.graphics.Match("Selected");for(var selectedPushpin in selectedPushpins){var pushpin=selectedPushpins[selectedPushpin];
if(pushpin===_activePushpin){continue;}else{pushpin.Remove();}}}_activeBufferSize=distance;
distance=isNaN(distance)?distance.replace(/[a-z]|\s/gi,""):distance;params.features=isAdHoc?graphic:[_activePushpin];
params.distances=[distance];params.unit=isAdHoc?esri.tasks.BufferParameters.UNIT_FOOT:_c.Map.MetricFormat?esri.tasks.BufferParameters.UNIT_KILOMETER:esri.tasks.BufferParameters.UNIT_STATUTE_MILE;
params.bufferSpatialReference=_g.MAP.spatialReference;try{gsvc.buffer(params,function(graphics){_toggleSearchResultContent();
var geometry=graphics[0].geometry,bufferGraphic=_g.MAP.graphics.Find(_c.Symbology.BufferGraphicName);
if(bufferGraphic){bufferGraphic.setGeometry(geometry);}else{var opacity=_u.IsUndefined(_c.Symbology.BufferFillOpacity)?0:_c.Symbology.BufferFillOpacity;
bufferGraphic=new esri.Graphic().setGeometry(geometry).setSymbol(new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,new esri.symbol.SimpleLineSymbol(_c.Symbology.BufferLineStyle,new dojo.Color([_c.Symbology.BufferLineColorRed,_c.Symbology.BufferLineColorGreen,_c.Symbology.BufferLineColorBlue]),_c.Symbology.BufferLineWidth),new dojo.Color([_c.Symbology.BufferFillColorRed,_c.Symbology.BufferFillColorGreen,_c.Symbology.BufferFillColorBlue,opacity]))).SetName(_c.Symbology.BufferGraphicName);
_g.MAP.graphics.add(bufferGraphic);}_g.MAP.graphics.Remove();var searchType=isAdHoc?_e.SearchType.AdHoc:graphic.SearchType;
_getSearch(searchType)._buffer._execute(bufferGraphic.geometry,function(result){var bufferSearchType=isAdHoc?searchType:eval("_c.Search."+graphic.SearchType+".BufferSearchType");
if(dojo.style("infoBox","display")!="none"){_m.ToggleInfoBox();}_onDoSearch(result,bufferSearchType,_activePushpin);
});});gsvc=null;}catch(Error){console.log(Error);}if(!isAdHoc){if(!_u.IsUndefined(_activePushpin.symbol)){_activePushpin.SetName(_activePushpin.SearchType+"Selected").SetSearchIndex(0).symbol.setUrl(_activePushpin.symbol.url.replace(/\d{1,2}/,"selected"));
_activePushpin.setSymbol(_activePushpin.symbol);}}};return{ShowSearchResultDetail:function(index){_showSearchResultDetail(index);
},GetSearchResultsPage:function(pageNumber,index){_setSearchResultsPage(pageNumber,index);
},SearchResultOnClick:function(index){_searchResultOnClick(index);},ExecuteIdentify:function(args){_executeIdentify(args);
},OnClick:function(e){_onClick(e);},DoBufferSearch:function(graphic,e){_doBufferSearch(graphic,e);
},IdentifyTypeIsDefined:function(type){return _identifyTypeIsDefined(type);},GetSearchResults:function(){return _searchResults;
}};})();Garfield.CO.US.InfoPane={HandleResult:null};
