if(SelectedParent==undefined){
var SelectedParent=null;
}
var CommonToolbarItems=function(_1){
if(!_1){
throw "A valid map toolbar controller reference is required to create 'CommonToolbarItems'.";
}
var _2=_1;
var _3=null;
var _4=[];
var _5=function(id){
if(!id){
throw "A valid element id is required.";
}
if(!document.getElementById(id)){
throw "The element id '"+id+"' is not valid. ";
}
};
return {toolbarController:_2,addPanTool:function(_7,_8){
if(!_8){
throw "A valid toolbar reference is required to add the pan tool.";
}
var _9=_2.addTool(_8,_7,null,true);
_9.addListener("select",function(){
_2.activateNav(esri.toolbars.Navigation.PAN);
//_2.map.enableScrollWheelZoom();
_9.addMapListener("onClick",function(e){
if(e.mapPoint){
_2.map.centerAt(e.mapPoint);
}
});
});
return _9;
},addFullExtentCommand:function(_b,_c){
if(!_c){
throw "A valid toolbar reference is required to add the full extent command.";
}
var _d=_2.addCommand(_c,_b);
_d.addClickListener(function(e){
var _f=_2.map.getLayer(_2.map.layerIds[0]);
_2.map.setExtent(_f.fullExtent);
});
return _d;
},addPreviousExtentCommand:function(_10,_11){
if(!_11){
throw "A valid toolbar reference is required to add the previous extent command.";
}
var _12=_2.addCommand(_11,_10);
if(_2.esriNavToolbar.isFirstExtent()){
_2.disableCommand(_12);
}
dojo.connect(_2.esriNavToolbar,"onExtentHistoryChange",function(){
if(_2.esriNavToolbar.isFirstExtent()){
_2.disableCommand(_12);
}else{
_2.enableCommand(_12);
}
});
_12.addClickListener(function(e){
_2.esriNavToolbar.zoomToPrevExtent();
});
return _12;
},addNextExtentCommand:function(_14,_15){
if(!_15){
throw "A valid toolbar reference is required to add the next extent command.";
}
var _16=_2.addCommand(_15,_14);
if(_2.esriNavToolbar.isLastExtent()){
_2.disableCommand(_16);
}
dojo.connect(_2.esriNavToolbar,"onExtentHistoryChange",function(){
if(_2.esriNavToolbar.isLastExtent()){
_2.disableCommand(_16);
}else{
_2.enableCommand(_16);
}
});
_16.addClickListener(function(e){
_2.esriNavToolbar.zoomToNextExtent();
});
return _16;
},addZoomInTool:function(_18,_19){
if(!_19){
throw "A valid toolbar reference is required to add the zoom in tool.";
}
var _1a=_2.addTool(_19,_18);
_1a.addListener("select",function(){
_2.activateNav(esri.toolbars.Navigation.ZOOM_IN);
//_2.map.enableScrollWheelZoom();
_1a.addMapListener("onClick",function(e){
if(_2.map._baseLayer.tileInfo){
_2.map.setLevel(_2.map.getLevel()+1);
}
});
if(SelectedParent){
_1a.addClickListener(function(e){
$("#"+SelectedParent).removeClass("selected");
});
}
});
return _1a;
},addZoomOutTool:function(_1d,_1e){
if(!_1e){
throw "A valid toolbar reference is required to add the zoom out tool.";
}
var _1f=_2.addTool(_1e,_1d);
_1f.addListener("select",function(){
_2.activateNav(esri.toolbars.Navigation.ZOOM_OUT);
//_2.map.enableScrollWheelZoom();
_1f.addMapListener("onClick",function(e){
if(_2.map._baseLayer.tileInfo){
_2.map.setLevel(_2.map.getLevel()-1);
}
});
if(SelectedParent){
_1f.addClickListener(function(e){
$("#"+SelectedParent).removeClass("selected");
});
}
});
return _1f;
},addDrawPointTool:function(_22,_23,_24){
if(!_23){
throw "A valid toolbar reference is required to add the draw point tool.";
}
var _25=_2.addTool(_23,_22);
_25.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.POINT);
_25.addDrawToolbarListener("onDrawEnd",_24);
});
return _25;
},addDrawMultiPointTool:function(_26,_27,_28){
if(!_27){
throw "A valid toolbar reference is required to add the draw multi point tool.";
}
var _29=_2.addTool(_27,_26);
_29.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.MULTI_POINT);
_29.addDrawToolbarListener("onDrawEnd",_28);
});
return _29;
},addDrawLineTool:function(_2a,_2b,_2c){
if(!_2b){
throw "A valid toolbar reference is required to add the draw line tool.";
}
var _2d=_2.addTool(_2b,_2a);
_2d.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.LINE);
_2d.addDrawToolbarListener("onDrawEnd",_2c);
});
return _2d;
},addDrawPolyLineTool:function(_2e,_2f,_30){
if(!_2f){
throw "A valid toolbar reference is required to add the draw polyline tool.";
}
var _31=_2.addTool(_2f,_2e);
_31.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.POLYLINE);
_31.addDrawToolbarListener("onDrawEnd",_30);
});
return _31;
},addDrawPolygonTool:function(_32,_33,_34){
if(!_33){
throw "A valid toolbar reference is required to add the draw polygon tool.";
}
var _35=_2.addTool(_33,_32);
_35.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.POLYGON);
_35.addDrawToolbarListener("onDrawEnd",_34);
});
return _35;
},addDrawBoxTool:function(_36,_37,_38){
if(!_37){
throw "A valid toolbar reference is required to add the select box tool.";
}
var _39=_2.addTool(_37,_36);
_39.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.EXTENT);
_39.addDrawToolbarListener("onDrawEnd",_38);
});
return _39;
},addSelectTool:function(_3a,_3b,_3c){
_5(_3a);
if(!_3b){
throw "A valid toolbar reference is required to add the select box tool.";
}
if((!_3c)||(!_3c.callback)){
throw "A valid options parameter with atleast the 'callback' property is required.";
}
_3c.pixelTolerance=_3c.pixelTolerance||3;
_3c.bufferDistance=_3c.bufferDistance||10;
_3c.bufferUnit=_3c.bufferUnit||"esriMeters";
var _3d=_1.mapManager;
var map=_1.map;
var _3f=function(_40,_41){
if(!_40){
throw "The distance to be converted from meters is required.";
}
if(!_41){
throw "The unit the meters distance should be converted to is required.";
}
if(_41==="esriMeters"){
return _40;
}else{
if(_41==="esriFeet"){
return _40/0.3048;
}else{
if(_41==="esriInches"){
return _40/0.0254;
}else{
if(_41==="esriKilometers"){
return _40/1000;
}else{
if(_41==="esriMiles"){
return _40/1609.3472186944375;
}else{
if(_41==="esriNauticalMiles"){
return _40/1853.27;
}else{
if(_41==="esriDecimalDegrees"){
return _40/111194.87428468118;
}else{
if(_41==="esriCentimeters "){
return _40/0.01;
}else{
if(_41==="esriDecimeters "){
return _40/0.1;
}else{
if(_41==="esriMillimeters "){
return _40/0.001;
}
}
}
}
}
}
}
}
}
}
return null;
};
var _42=function(_43,_44){
if(!_43){
throw "The distance to be converted to meters is required.";
}
if(!_44){
throw "The unit of the distance to be converted to meters is required.";
}
if(_44==="esriMeters"){
return _43;
}else{
if(_44==="esriFeet"){
return _43*0.3048;
}else{
if(_44==="esriInches"){
return _43*0.0254;
}else{
if(_44==="esriKilometers"){
return _43*1000;
}else{
if(_44==="esriMiles"){
return _43*1609.3472186944375;
}else{
if(_44==="esriNauticalMiles"){
return _43*1853.27;
}else{
if(_44==="esriDecimalDegrees"){
return _43*111194.87428468118;
}else{
if(_44==="esriCentimeters "){
return _43*0.01;
}else{
if(_44==="esriDecimeters "){
return _43*0.1;
}else{
if(_44==="esriMillimeters "){
return _43*0.001;
}
}
}
}
}
}
}
}
}
}
return null;
};
var _45=function(X,Y,_48){
onePixelInInches=0.010416666666666666;
var _49=map.extent.getWidth()/map.width;
var _4a=_49*_48.pixelTolerance;
var _4b=_42(_48.bufferDistance,_48.bufferUnit);
var _4c=_3f(_4b,map._baseLayer.units);
var _4d=_4a;
if(_4c>_4a){
_4d=_4c;
}
var _4e=X-_4d;
var _4f=X+_4d;
var _50=Y-_4d;
var _51=Y+_4d;
return new esri.geometry.Extent(_4e,_50,_4f,_51,map._baseLayer.spatialReference);
};
var _52=null;
var _53=function(e){
_3d.removeListener(_3d.errorSelectionEventName,_52);
$(_3d.mapElement).unblock();
alert("An unexpected error occurred while selecting features. Selection failed. "+e);
};
var _55=function(_56){
_3d.removeListener(_3d.errorSelectionEventName,_52);
$(_3d.mapElement).unblock();
if(_3c.callback){
_3c.callback(_56);
}
};
var _57=function(_58){
$(_3d.mapElement).block({message:"<img src='../images/wait.gif' /><br><span class='waitingMessage'><b>Selecting features...</b></span>"});
var _59=_58;
if((_58.xmin===_58.xmax)&&(_58.ymin===_58.ymax)){
_59=_45(_58.xmin,_58.ymin,_3c);
}
_52=_3d.addListener(_3d.errorSelectionEventName,_53);
var qry=new esri.tasks.Query();
qry.geometry=_59;
qry.spatialRelationship=esri.tasks.Query.SPATIAL_REL_INTERSECTS;
qry.returnGeometry=true;
qry.where=null;
_3d.selectInActiveLayer(qry,_55);
};
var _5b=_2.addTool(_3b,_3a);
_5b.addListener("select",function(){
_2.activateDraw(esri.toolbars.Draw.EXTENT);
_5b.addDrawToolbarListener("onDrawEnd",_57);
});
return _5b;
},addResetTool:function(_5c,_5d){
if(!_5d){
throw "A valid toolbar reference is required to add the reset tool.";
}
var _5e=_2.addTool(_5d,_5c);
_5e.addListener("select",function(){
});
return _5e;
}};
};
var GraphicsLayerManager=function(map){
if(!map){
throw "A valid map object is required to create a 'GraphicsLayerManager'";
}
var _60=map;
var _61=new Array();
_removeFromArray=function(_62,_63,to){
var _65=_62.slice((to||_63)+1||_62.length);
_62.length=_63<0?_62.length+_63:_63;
return _62.push.apply(_62,_65);
};
var _66=function(_67){
var _68=_61.length;
_61[_68]=_67;
return _68;
};
var _69=function(_6a){
return _66(new tgGraphicsLayer(_60,_6a));
};
var _6b=function(_6c){
for(var i=0;i<_61.length;i++){
if(_61[i]){
if(_61[i].layerName===_6c){
return i;
}
}
}
return -1;
};
var _6e=function(_6f){
var _70=_6b(_6f);
if(_70===-1){
return null;
}else{
return _61[_70];
}
};
var _71=function(_72){
if(!_72){
throw "A valid name is required to create a 'tgGraphicsLayer'. The layer name '"+_72+"' is not valid.";
}
if(_6b(_72)===-1){
return _69(_72);
}else{
throw "Cannot add new 'tgGraphicsLayer' graphics layer. A layer with the same name'"+_72+"' already exists";
return -1;
}
};
var _73=function(_74){
var _75=_6b(_74);
if(_75===-1){
throw "Cannot remove 'tgGraphicsLayer' graphics layer. Tha layer with the name does not exist.";
}else{
var _76=_61[_75];
_76.clearLayer();
_removeFromArray(_61,_75);
}
};
var _77=function(_78,_79){
if(!_78){
throw "A valid name is required to create a point 'tgGraphicsLayer'. The layer name '"+_78+"' is not valid.";
}
if(_6b(_78)===-1){
var _7a=_66(new tgFeatureGraphicsLayer(_60,_78,_79,"point"));
return _61[_7a];
}else{
throw "Cannot add new point 'tgGraphicsLayer' graphics layer. A layer with the same name'"+_78+"' already exists";
return -1;
}
};
var _7b=function(_7c,_7d){
if(!_7c){
throw "A valid name is required to create a multi point 'tgGraphicsLayer'. The layer name '"+_7c+"' is not valid.";
}
if(_6b(_7c)===-1){
var _7e=_66(new tgFeatureGraphicsLayer(_60,_7c,_7d,"multipoint"));
return _61[_7e];
}else{
throw "Cannot add new multi point 'tgGraphicsLayer' graphics layer. A layer with the same name'"+_7c+"' already exists";
return -1;
}
};
var _7f=function(_80,_81){
if(!_80){
throw "A valid name is required to create a polyline 'tgGraphicsLayer'. The layer name '"+_80+"' is not valid.";
}
if(_6b(_80)===-1){
var _82=_66(new tgFeatureGraphicsLayer(_60,_80,_81,"polyline"));
return _61[_82];
}else{
throw "Cannot add new polyline 'tgGraphicsLayer' graphics layer. A layer with the same name'"+_80+"' already exists";
return -1;
}
};
var _83=function(_84,_85){
if(!_84){
throw "A valid name is required to create a polygon 'tgGraphicsLayer'. The layer name '"+_84+"' is not valid.";
}
if(_6b(_84)===-1){
var _86=_66(new tgFeatureGraphicsLayer(_60,_84,_85,"polygon"));
return _61[_86];
}else{
throw "Cannot add new polygon 'tgGraphicsLayer' graphics layer. A layer with the same name'"+_84+"' already exists";
return -1;
}
};
var _87=function(_88,_89){
if(!_88){
throw "A valid name is required to create a extent 'tgGraphicsLayer'. The layer name '"+_88+"' is not valid.";
}
if(_6b(_88)===-1){
var _8a=_66(new tgFeatureGraphicsLayer(_60,_88,_89,"extent"));
return _61[_8a];
}else{
throw "Cannot add new extent 'tgGraphicsLayer' graphics layer. A layer with the same name'"+_88+"' already exists";
return -1;
}
};
return {addGraphicsLayer:function(_8b){
_71(_8b);
},removeGraphicsLayer:function(_8c){
_73(_8c);
},getGraphicsLayerByName:function(_8d){
return _6e(_8d);
},getGraphicsLayerByIndex:function(_8e){
return _61[_8e];
},addPointGraphicsLayer:function(_8f,_90){
return _77(_8f,_90);
},addMultiPointGraphicsLayer:function(_91,_92){
return _7b(_91,_92);
},addPolylineGraphicsLayer:function(_93,_94){
return _7f(_93,_94);
},addPolygonGraphicsLayer:function(_95,_96){
return _83(_95,_96);
},addExtentGraphicsLayer:function(_97,_98){
return _87(_97,_98);
}};
};
var MapCommand=function(_99,_9a,_9b){
var _9c="mapcommand";
var _9d=_99;
var _9e=_9a;
var _9f=new Object();
_9f.click=new Array();
_9f.enable=new Array();
_9f.disable=new Array();
if(!_9e){
throw "A valid DIV ID is required for creating a map command. The DIV ID '"+_9e+"' is not valid.";
}
var _a0=document.getElementById(_9e);
if(!_a0){
throw "A valid DIV element is required for creating a map command.";
}
$(_a0).addClass(_9c);
if(_9b){
$(_a0).addClass(_9b);
}
var _a1=function(_a2){
if(_a0){
return $(_a0).hasClass(_a2);
}
return false;
};
var _a3=function(_a4){
if(_a0){
$(_a0).removeClass(_a4);
}
};
var _a5=function(_a6){
if(_a0){
$(_a0).addClass(_a6);
}
};
var _a7=function(){
return _a1(_9d.getEnabledClass());
};
var _a8=function(){
return _a1(_9d.getDisabledClass());
};
var _a9=function(_aa,e){
if(_9f[_aa]){
for(var i=0;i<_9f[_aa].length;i++){
if(_9f[_aa][i]){
_9f[_aa][i](e);
}
}
}
};
var _ad=function(){
if(_a8()){
_a3(_9d.getDisabledClass());
_a5(_9d.getEnabledClass());
_a9(_9d.enableEventName);
}
};
var _ae=function(){
if(_a7()){
_a3(_9d.getEnabledClass());
_a5(_9d.getDisabledClass());
_a9(_9d.disableEventName);
}
};
var _af=function(){
_9f.click=new Array();
};
var _b0=function(e){
if(_a7()){
if(_9f.click){
for(var i=0;i<_9f.click.length;i++){
if(_9f.click[i]){
_9f.click[i](e);
}
}
}
}
};
var _b3=function(_b4){
if(_9f[_b4]){
_9f[_b4]=new Array();
}
};
$(_a0).bind("click",_b0);
return {id:_9e,element:_a0,getCSSClass:_9c,isEnabled:function(){
return _a7();
},enable:function(){
if(_a8()){
_a3(_9d.getDisabledClass());
_a5(_9d.getEnabledClass());
}
},disable:function(){
if(_a7()){
_a3(_9d.getEnabledClass());
_a5(_9d.getDisabledClass());
}
},hasClass:function(_b5){
return _a1(_b5);
},removeClass:function(_b6){
return _a3(_b6);
},addClass:function(_b7){
return _a5(_b7);
},createListener:function(_b8){
if(!_9f[_b8]){
_9f[_b8]=new Array();
}
},addListener:function(_b9,_ba){
if(!_9f[_b9]){
throw "The event '"+_b9+"' is not supported by MapTool.";
}
return _9f[_b9].push(_ba);
},removeListener:function(_bb,_bc){
if(_9f[_bb]){
_removeFromArray(_9f[_bb],_bc);
}
},raiseEvent:function(_bd){
_a9(_bd);
},clearListeners:function(_be){
_b3(_be);
},addClickListener:function(_bf){
if(_9f.click){
return _9f.click.push(_bf);
}
},removeClickListener:function(_c0){
if(_9f.click){
_9f.click[_c0]=null;
}
},clearClickListeners:function(){
_af();
}};
};
if(SelectedParent==undefined){
var SelectedParent=null;
}
var MapDropDown=function(_c1,_c2,_c3,_c4){
var _c5="dropdown";
var _c6="first";
var _c7=_c1;
var _c8=_c2;
var _c9=new Array();
var _ca=new Array();
if(!_c8){
throw "A valid DIV ID is required for creating a toolbar dropdown. The DIV ID '"+_c8+"' is not valid.";
}
var _cb=document.getElementById(_c8);
if(!_cb){
throw "A valid DIV element is required for creating a toolbar dropdown.";
}
if(!_c1){
throw "A valid toolbar reference is required to create a toolbar dropdown.";
}
_c4=_c4||new Object();
if(!(_c4.toggle===false)){
_c4.toggle=true;
}
if(!(_c4.parentNode)){
_c4.parentNode=null;
}
var _cc=function(_cd){
if(_cb){
return $(_cb).hasClass(_cd);
}
return false;
};
var _ce=function(_cf){
if(_cb){
$(_cb).removeClass(_cf);
}
};
var _d0=function(_d1){
if(_cb){
$(_cb).addClass(_d1);
}
};
var _d2=function(_d3){
$(_d3).insertBefore($(_d3).parent().children(":first-child"));
};
var _d4=function(_d5){
if(!_d5){
_d5=_c9[0]||_ca[0];
}
if(_d5){
if(_ca){
for(var i=0;i<_ca.length;i++){
if(_ca[i]){
if(_ca[i].id===_d5.id){
if(!_ca[i].hasClass(_c6)){
_ca[i].addClass(_c6);
_d2(_ca[i].element);
}
}else{
if(_ca[i].hasClass(_c6)){
_ca[i].removeClass(_c6);
}
}
}
}
}
if(_c9){
for(var i=0;i<_c9.length;i++){
if(_c9[i]){
if(_c9[i].id===_d5.id){
if(!_c9[i].hasClass(_c6)){
_c9[i].addClass(_c6);
_d2(_c9[i].element);
}
}else{
if(_c9[i].hasClass(_c6)){
_c9[i].removeClass(_c6);
}
}
}
}
}
}
};
var _d7=function(cmd){
if(!cmd){
throw "A valid MapCommand reference is needed to be added to the MapDropDown.";
}
cmd.addClickListener(function(e){
if(_c4.toggle){
_d4(cmd);
}
});
_c9.push(cmd);
return cmd;
};
var _da=function(tl){
if(!tl){
throw "A valid MapTool reference is needed to be added to the MapDropDown.";
}
tl.addClickListener(function(e){
if(_c4.toggle){
_d4(tl);
}
if(_c4.parentNode){
if(SelectedParent!=_c4.parentNode&&SelectedParent!=null){
$("#"+SelectedParent).removeClass("selected");
}
SelectedParent=_c4.parentNode;
$("#"+SelectedParent).addClass("selected");
}else{
if(SelectedParent!=null){
$("#"+SelectedParent).removeClass("selected");
}
}
});
_ca.push(tl);
return tl;
};
var _dd=function(_de,_df){
return _d7(_c7.addCommand(_de,_df));
};
var _e0=function(_e1,_e2){
return _da(_c7.addTool(_e1,_e2));
};
var _e3=function(){
if(_c9){
for(var i=0;i<_c9.length;i++){
if(_c9[i]){
_c9[i].disable();
}
}
}
if(_ca){
for(var i=0;i<_ca.length;i++){
if(_ca[i]){
_ca[i].disable();
}
}
}
};
var _e5=function(){
if(_c9){
for(var i=0;i<_c9.length;i++){
if(_c9[i]){
_c9[i].enable();
}
}
}
if(_ca){
for(var i=0;i<_ca.length;i++){
if(_ca[i]){
_ca[i].enable();
}
}
}
};
var _e7=function(){
$(_cb).addClass(_c5);
if(_c3){
$(_cb).addClass(_c3);
}
};
_e7();
return {id:_c8,element:_cb,getCSSClass:_c5,toolbar:_c7,hasClass:function(_e8){
return _cc(_e8);
},removeClass:function(_e9){
return _ce(_e9);
},addClass:function(_ea){
return _d0(_ea);
},addMapCommand:function(cmd){
return _d7(cmd);
},addMapTool:function(tl){
return _da(tl);
},addCommand:function(_ed,_ee){
return _dd(_ed,_ee);
},addTool:function(_ef,_f0){
return _e0(_ef,_f0);
},enableDropdown:function(){
_e5();
},disableDropdown:function(){
_e3();
}};
};
var MapManager=function(_f1,_f2,_f3,_f4){
dojo.require("esri.map");
var _f5;
var _f6=_f1;
if(!_f6){
throw "A valid DIV ID is required for creating a map.";
}
var _f7=document.getElementById(_f6);
if(!_f7){
throw "A valid DIV element on the page is required for creating a map.";
}
if(_f2){
_f5=new esri.Map(_f6,_f2);
}else{
_f5=new esri.Map(_f6);
}
var _f8=_f3;
var _f9=_f4;
var _fa=new Array();
var _fb=new GraphicsLayerManager(_f5);
var _fc=new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,10,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([255,0,0]),1),new dojo.Color([0,255,0,0.25]));
var _fd=new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,10,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([255,0,0]),1),new dojo.Color([0,255,0,0.25]));
var _fe=new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([255,0,0]),3);
var _ff=new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([255,0,0]),2),new dojo.Color([0,0,255,0.25]));
var _100=new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,new dojo.Color([255,0,0]),2),new dojo.Color([0,0,255,0.25]));
var _101=_fb.addPointGraphicsLayer("pointSelection",_fc);
var _102=_fb.addMultiPointGraphicsLayer("multiPointSelection",_fd);
var _103=_fb.addPolylineGraphicsLayer("lineSelection",_fe);
var _104=_fb.addPolygonGraphicsLayer("polygonSelection",_ff);
var _105=_fb.addExtentGraphicsLayer("extentSelection",_100);
var _106=0;
var _107=0;
var _108=0;
var _109=0;
var _10a=0;
var _10b="mapOnLoad";
var _10c="esriLayersLoaded";
var _10d="tgfLayersLoaded";
var _10e="beginSelection";
var _10f="endSelection";
var _110="errorSelection";
var _111="selectionSetChanged";
var _112="activeLayerChanged";
var _113="bucketChanged";
var _114="beginMapRefresh";
var _115="endMapRefresh";
var _116=new Object();
_116.mapOnLoad=new Array();
_116.esriLayersLoaded=new Array();
_116.tgfLayersLoaded=new Array();
_116.beginSelection=new Array();
_116.endSelection=new Array();
_116.errorSelection=new Array();
_116.selectionSetChanged=new Array();
_116.activeLayerChanged=new Array();
_116.bucketChanged=new Array();
_116.beginMapRefresh=new Array();
_116.endMapRefresh=new Array();
var _117=null;
var _118={layer:null,feature:null};
var _119=new Array();
var _11a="GLOBALID";
var _11b=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID"];
var _11c={"esriGeometryPolygon":"polygon","esriGeometryPolyline":"polyline","esriGeometryPoint":"point","esriGeometryMultipoint":"multipoint","esriGeometryEnvelope":"extent"};
_removeFromArray=function(_11d,from,to){
var rest=_11d.slice((to||from)+1||_11d.length);
_11d.length=from<0?_11d.length+from:from;
return _11d.push.apply(_11d,rest);
};
var _121=function(_122,e){
if(_116[_122]){
for(var i=0;i<_116[_122].length;i++){
if(_116[_122][i]){
_116[_122][i](e);
}
}
}
};
var _125=function(_126){
_118=_126;
_121(_113,_118);
};
var _127=function(_128){
};
var _129=function(_12a){
if(!_12a){
_118={layer:null,feature:null};
_121(_113,_118);
}
if(_12a&&_12a.layer&&_12a.feature){
_118=_12a;
_121(_113,_118);
}
};
var _12b=function(_12c){
_117=_12c;
_121(_112,_117);
_12d();
};
var _12e=function(_12f){
if(_12f&&(!_117)){
_12b(_12f);
}
if((!_12f)&&_117){
_12b(_12f);
}
if(_12f&&_117){
if(_12f.identifier!==_117.identifier){
_12b(_12f);
}
}
};
var _130=function(_131,_132){
if(!_131){
throw "The distance to be converted from meters is required.";
}
if(!_132){
throw "The unit the meters distance should be converted to is required.";
}
if(_132==="esriMeters"){
return _131;
}else{
if(_132==="esriFeet"){
return _131/0.3048;
}else{
if(_132==="esriInches"){
return _131/0.0254;
}else{
if(_132==="esriKilometers"){
return _131/1000;
}else{
if(_132==="esriMiles"){
return _131/1609.3472186944375;
}else{
if(_132==="esriNauticalMiles"){
return _131/1853.27;
}else{
if(_132==="esriDecimalDegrees"){
return _131/111194.87428468118;
}else{
if(_132==="esriCentimeters "){
return _131/0.01;
}else{
if(_132==="esriDecimeters "){
return _131/0.1;
}else{
if(_132==="esriMillimeters "){
return _131/0.001;
}
}
}
}
}
}
}
}
}
}
return null;
};
var _133=function(_134,unit){
if(!_134){
throw "The distance to be converted to meters is required.";
}
if(!unit){
throw "The unit of the distance to be converted to meters is required.";
}
if(unit==="esriMeters"){
return _134;
}else{
if(unit==="esriFeet"){
return _134*0.3048;
}else{
if(unit==="esriInches"){
return _134*0.0254;
}else{
if(unit==="esriKilometers"){
return _134*1000;
}else{
if(unit==="esriMiles"){
return _134*1609.3472186944375;
}else{
if(unit==="esriNauticalMiles"){
return _134*1853.27;
}else{
if(unit==="esriDecimalDegrees"){
return _134*111194.87428468118;
}else{
if(unit==="esriCentimeters "){
return _134*0.01;
}else{
if(unit==="esriDecimeters "){
return _134*0.1;
}else{
if(unit==="esriMillimeters "){
return _134*0.001;
}
}
}
}
}
}
}
}
}
}
return null;
};
var _136=function(X,Y,_139){
onePixelInInches=0.010416666666666666;
var _13a=map.extent.getWidth()/map.width;
var _13b=_13a*_139.pixelTolerance;
var _13c=_133(_139.bufferDistance,_139.bufferUnit);
var _13d=_130(_13c,map._baseLayer.units);
var _13e=_13b;
if(_13d>_13b){
_13e=_13d;
}
var xmin=X-_13e;
var xmax=X+_13e;
var ymin=Y-_13e;
var ymax=Y+_13e;
return new esri.geometry.Extent(xmin,ymin,xmax,ymax,map._baseLayer.spatialReference);
};
var _143=function(_144,_145){
if(!_144){
return _f5.getExtent();
}
_145=_145||new Object();
_145.pixelTolerance=_145.pixelTolerance||3;
_145.bufferDistance=_145.bufferDistance||10;
_145.bufferUnit=_145.bufferUnit||"esriMeters";
var _146;
if(_144.type==="point"){
_146=_136(_144.x,_144.y,_145);
}else{
if(_144.type==="extent"){
_146=_144;
}else{
_146=_144.getExtent();
}
}
return _146;
};
var _147=function(){
_10a=0;
_121(_114);
};
var _148=function(){
_10a++;
if(_10a===_106){
_10a=0;
_121(_115);
}
};
var _149=function(_14a){
_107++;
if((_106!==0)&&(_106===_107)){
_121(_10c);
}
dojo.connect(_14a,"onUpdate",_148);
};
var _14b=function(_14c){
var _14d=_14c.getSubLayerCount();
for(var i=0;i<_14d;i++){
var _14f=_14c.getAGSSubLayer(i);
if(!_14f.isGroupLayer){
_14f.identifier=_14f.name+"_"+_109+"_"+i;
_14f.displayName=_14f.displayName||_14f.name;
_14f.serviceLayerIndex=_109;
_14f.agsSubLayerIndex=i;
_14f.keyFieldName=_11a;
_fa.push(_14f);
}
}
_109++;
if((_108!==0)&&(_108===_109)){
_121(_10d);
}
};
var _150=function(_151){
if(_151){
if(!_151.loaded){
dojo.connect(_151,"onLoad",_149);
}else{
_149(_151);
}
_f5.addLayer(_151);
_106++;
}
};
var _152=function(_153){
if(_153){
if(!_153.isLoaded()){
_153.addOnLoad(_14b);
}else{
_14b(_153);
}
_150(_153.getAGSServiceLayer());
_108++;
}
};
var _154=function(_155,_156){
if(!_155){
throw "A field name is required to match the values in and to remove selection on map.";
}
var _157=new Array();
for(var i=0;i<_119.length;i++){
if(_156===_119[i].attributes[_155]){
_157.push(_119[i]);
}
}
return _157;
};
var _159=function(id){
var _15b=_154(_117.keyFieldName,id);
if(_15b){
return _15b[0];
}
return null;
};
var _15c=function(_15d,_15e){
if(!_15d){
throw "A field name is required to match the values in and to remove selection on map.";
}
var _15f=new Array();
for(var i=0;i<_119.length;i++){
if(_15e===_119[i].attributes[_15d]){
_15f.push(i);
}
}
for(var i=0;i<_15f.length;i++){
if(_117){
var _161=_162(_117.layerProperties.geometryType);
if(_161){
_161.removeGraphic(_119[_15f[i]]);
_119.remove(i);
}
}
}
if(_15f&&_15f.length>0){
_121(_111,_119);
}
return (_15f&&_15f.length>0);
};
var _163=function(id){
return _15c(_117.keyFieldName,id);
};
var _162=function(_165){
if(_165==="esriGeometryPolygon"){
return _104;
}else{
if(_165==="esriGeometryPoint"){
return _101;
}else{
if(_165==="esriGeometryPolyline"){
return _103;
}else{
if(_165==="esriGeometryMultipoint"){
return _102;
}else{
if(_165==="esriGeometryEnvelope"){
return _105;
}
}
}
}
}
};
var _12d=function(){
_119=new Array();
_101.clearLayer();
_102.clearLayer();
_104.clearLayer();
_103.clearLayer();
_105.clearLayer();
_121(_111,_119);
};
var _166=function(_167,_168){
_121(_10e);
var _169=dojo.subscribe("esri.Error",this,_16a);
var _16a=function(_16b){
dojo.unsubscribe(_169);
_121(_10f);
};
var _16c=function(_16d){
dojo.unsubscribe(_169);
_121(_10f);
_16d.layerName=_117.name;
_12d();
_119.geometryType=_16d.geometryType;
var _16e=_162(_16d.geometryType);
if(_16e){
jQuery.each(_16d.features,function(key,_170){
var _171=_16e.addGeometry(_170.geometry,_170.attributes);
_119.push(_171);
});
}
_121(_111,_119);
if(_168){
_168(_16d);
}
};
if(_117){
_117.query(_167,_16c);
}else{
_121(_110,"An active Layer must be set for the selection to operate on. Unable to find current active layer from map manager.");
}
};
var _172=function(){
dojo.connect(_f5,"onLoad",function(_173){
_174(_173);
});
if(_f8){
for(var i=0;i<_f8.length;i++){
_150(_f8[i]);
}
}
if(_f9){
for(var i=0;i<_f9.length;i++){
_152(_f9[i]);
}
}
};
var _174=function(_176){
_121(_10b,_176);
};
var _177=function(){
dojo.connect(_f5,"onLoad",_147);
dojo.connect(_f5,"onZoomStart",_147);
dojo.connect(_f5,"onPanStart",_147);
};
_177();
return {mapID:_f6,mapElement:_f7,mapOnLoadEventName:_10b,esriLayersLoadedEventName:_10c,tgfLayersLoadedEventName:_10d,beginSelectionEventName:_10e,endSelectionEventName:_10f,errorSelectionEventName:_110,activeLayerChangedEventName:_112,bucketChangedEventName:_113,selectionSetChangedEventName:_111,beginMapRefreshEventName:_114,endMapRefreshEventName:_115,initializeMap:function(){
_172();
},getMap:function(){
return _f5;
},addMapServiceLayer:function(_178){
_150(_178);
},addTGFLayer:function(_179){
_108++;
_106++;
_150(_179.getAGSServiceLayer());
},createListener:function(_17a){
if(!_116[_17a]){
_116[_17a]=new Array();
}
},addListener:function(_17b,_17c){
if(!_116[_17b]){
throw "The event '"+_17b+"' is not supported by MapManager.";
}
return _116[_17b].push(_17c);
},removeListener:function(_17d,_17e){
if(_116[_17d]){
_removeFromArray(_116[_17d],_17e);
}
},raiseEvent:function(_17f){
_121(_17f);
},getSubLayers:function(){
return _fa;
},getFirstSubLayerByName:function(name){
for(var i=0;i<_fa.length;i++){
if(_fa[i].name===name){
return _fa[i];
}
}
return null;
},getActiveLayer:function(){
return _117;
},setActiveLayer:function(_182){
_12e(_182);
},getBucket:function(){
return _118;
},setBucket:function(_183){
_129(_183);
},clearBucket:function(){
_129(null);
},getBucketLayer:function(){
if(_118){
return _118.layer;
}
return null;
},getBucketFeature:function(){
if(_118){
return _118.feature;
}
return null;
},setBucketFeature:function(_184){
_127(_184);
},selectInActiveLayer:function(_185,_186){
_166(_185,_186);
},getSelectionSet:function(){
return _119;
},getSelectionByID:function(id){
return _159(id);
},getSelectionByFieldValue:function(_188,_189){
return _154(_188,_189);
},removeSelectionByID:function(id){
return _163(id);
},removeSelectionByFieldValue:function(_18b,_18c){
return _15c(_18b,_18c);
},clearSelection:function(){
_12d();
},getExtent:function(_18d,_18e){
return _143(_18d,_18e);
},getTypeOfGeometry:function(_18f){
return _11c[_18f];
}};
};
var MapTool=function(_190,_191,_192){
var _193="maptool";
var _194=_190;
var _195=_191;
var _196=new Object();
_196.click=new Array();
_196.select=new Array();
_196.unselect=new Array();
_196.enable=new Array();
_196.disable=new Array();
if(!_195){
throw "A valid DIV ID is required for creating a map tool. The DIV ID '"+_195+"' is not valid.";
}
var _197=document.getElementById(_195);
if(!_197){
throw "A valid DIV element is required for creating a map tool. The DIV ID '"+_197+"' is not valid.";
}
$(_197).addClass(_193);
if(_192){
$(_197).addClass(_192);
}
_removeFromArray=function(_198,from,to){
var rest=_198.slice((to||from)+1||_198.length);
_198.length=from<0?_198.length+from:from;
return _198.push.apply(_198,rest);
};
var _19c=function(_19d){
if(_197){
return $(_197).hasClass(_19d);
}
return false;
};
var _19e=function(_19f){
if(_197){
$(_197).removeClass(_19f);
}
};
var _1a0=function(_1a1){
if(_197){
$(_197).addClass(_1a1);
}
};
var _1a2=function(){
return _19c(_194.getEnabledClass());
};
var _1a3=function(){
return _19c(_194.getDisabledClass());
};
var _1a4=function(){
return _19c(_194.getSelectedClass());
};
var _1a5=function(){
_196.click=new Array();
};
var _1a6=function(_1a7,e){
if(_196[_1a7]){
for(var i=0;i<_196[_1a7].length;i++){
if(_196[_1a7][i]){
_196[_1a7][i](e);
}
}
}
};
var _1aa=function(){
if(!_1a4()){
_1a0(_194.getSelectedClass());
_1a6(_194.selectEventName);
}
};
var _1ab=function(){
if(_1a4()){
_19e(_194.getSelectedClass());
_1a6(_194.unselectEventName);
if(_190.mapToolbarController){
_190.mapToolbarController.clearAllToolbarItemEventsTracked(_195);
}
}
};
var _1ac=function(){
if(_1a3()){
_19e(_194.getDisabledClass());
_1a0(_194.getEnabledClass());
_1a6(_194.enableEventName);
}
};
var _1ad=function(){
if(_1a2()){
if(_1a4()){
_1ab();
_194.mapToolbarController.selectDefaultTool();
}
_19e(_194.getEnabledClass());
_1a0(_194.getDisabledClass());
_1a6(_194.disableEventName);
}
};
var _1ae=function(e){
if(_1a2()){
if(_196.click){
for(var i=0;i<_196.click.length;i++){
if(_196.click[i]){
_196.click[i](e);
}
}
}
}
};
var _1b1=function(_1b2){
if(_196[_1b2]){
_196[_1b2]=new Array();
}
};
$(_197).bind("click",_1ae);
return {id:_195,element:_197,getCSSClass:_193,isEnabled:function(){
return _1a2();
},isSelected:function(){
return _1a4();
},enable:function(){
_1ac();
},disable:function(){
_1ad();
},select:function(){
_1aa();
},unselect:function(){
_1ab();
},hasClass:function(_1b3){
return _19c(_1b3);
},removeClass:function(_1b4){
return _19e(_1b4);
},addClass:function(_1b5){
return _1a0(_1b5);
},createListener:function(_1b6){
if(!_196[_1b6]){
_196[_1b6]=new Array();
}
},addListener:function(_1b7,_1b8){
if(!_196[_1b7]){
throw "The event '"+_1b7+"' is not supported by MapTool.";
}
return _196[_1b7].push(_1b8);
},removeListener:function(_1b9,_1ba){
if(_196[_1b9]){
_removeFromArray(_196[_1b9],_1ba);
}
},clearListeners:function(_1bb){
_1b1(_1bb);
},raiseEvent:function(_1bc){
_1a6(_1bc);
},addClickListener:function(_1bd){
if(_196.click){
return _196.click.push(_1bd);
}
},removeClickListener:function(_1be){
if(_196.click){
_removeFromArray(_196.click,_1be);
}
},clearClickListeners:function(){
_1a5();
},addMapListener:function(_1bf,_1c0){
if(_190.mapToolbarController){
_190.mapToolbarController.addMapListener(_195,_1bf,_1c0);
}
},addNavToolbarListener:function(_1c1,_1c2){
if(_190.mapToolbarController){
_190.mapToolbarController.addNavToolbarListener(_195,_1c1,_1c2);
}
},addDrawToolbarListener:function(_1c3,_1c4){
if(_190.mapToolbarController){
_190.mapToolbarController.addDrawToolbarListener(_195,_1c3,_1c4);
}
},clearMapAndToolbarListeners:function(){
if(_190.mapToolbarController){
_190.mapToolbarController.clearAllToolbarItemEventsTracked(_195);
}
}};
};
var MapToolbar=function(_1c5,_1c6){
var _1c7="maptoolbar";
var _1c8="selected";
var _1c9="disabled";
var _1ca="enabled";
var _1cb="checked";
var _1cc="enable";
var _1cd="disable";
var _1ce="select";
var _1cf="unselect";
var _1d0="check";
var _1d1="uncheck";
var _1d2=_1c5;
if(!_1d2){
throw "A valid DIV ID is required for creating a map toolbar. The DIV id "+_1d2+" is not valid.";
}
var _1d3=document.getElementById(_1d2);
if(!_1d3){
throw "A valid DIV element is required for creating a map toolbar. The DIV id "+_1d3+" is not valid.";
}
$(_1d3).addClass(_1c7);
var _1d4;
var _1d5=_1c6;
var _1d6=null;
var _1d7=new Array();
var _1d8=new Array();
var _1d9=new Array();
var _1da=function(){
for(var i=0;i<_1d7.length;i++){
if(_1d7[i]){
if(_1d7[i].hasClass(_1c8)){
return _1d7[i];
}
}
}
return null;
};
var _1dc=function(tool){
if(_1d7){
if(!tool){
for(var i=0;i<_1d7.length;i++){
_1d7[i].unselect();
}
}else{
if(_1d5){
_1d5.unselectAllMapTools();
}
for(var i=0;i<_1d7.length;i++){
if(_1d7[i].id===tool.id){
_1d7[i].select();
}else{
_1d7[i].unselect();
}
}
}
}
};
var _1df=function(_1e0){
if(_1e0){
_1d8.push(_1e0);
return _1e0;
}
return null;
};
var _1e1=function(_1e2,_1e3,_1e4){
if(_1d3&&_1e2){
var _1e5;
if(_1e4){
_1e5=new MapCommand(_1e2,_1e3,_1e4);
}else{
_1e5=new MapCommand(_1e2,_1e3,_1ca);
}
_1d8.push(_1e5);
return _1e5;
}else{
throw "Error occurred adding command '"+_1e3+"' to the toolbar. A valid toolbar reference is required to add the command.";
}
};
var _1e6=function(_1e7,_1e8,_1e9){
if(_1d3&&_1e7){
var _1ea;
if(_1e9){
_1ea=new MapToggle(_1e7,_1e8,_1e9);
}else{
_1ea=new MapToggle(_1e7,_1e8,_1ca);
}
_1d9.push(_1ea);
return _1ea;
}else{
throw "Error occurred adding toggle button '"+_1e8+"' to the toolbar. A valid toolbar reference is required to add the toggle button.";
}
};
var _1eb=function(_1ec){
if(_1ec){
_1d7.push(_1ec);
return _1ec;
}
return null;
};
var _1ed=function(_1ee,_1ef,_1f0,_1f1){
if(_1d3&&_1ee){
var tool;
if(_1f0){
tool=new MapTool(_1ee,_1ef,_1f0);
}else{
tool=new MapTool(_1ee,_1ef,_1ca);
}
tool.addClickListener(function(e){
_1dc(tool);
});
if(_1f1===true){
_1d6=tool;
}
return _1eb(tool);
}else{
throw "Error occurred adding tool '"+_1ef+"' to the toolbar. A valid toolbar reference is required to add the tool.";
}
};
var _1f4=function(tool){
if(tool&&_1d7){
for(var i=0;i<_1d7.length;i++){
if(_1d7[i].id===tool.id){
return true;
}
}
}
return false;
};
var _1f7=function(_1f8){
if(_1f8&&_1d8){
for(var i=0;i<_1d8.length;i++){
if(_1d8[i].id===_1f8.id){
return true;
}
}
}
return false;
};
var _1fa=function(_1fb){
if(_1fb&&_1d8){
for(var i=0;i<_1d8.length;i++){
if(_1d8[i].id===_1fb.id){
_1d8[i].disable();
break;
}
}
}
};
var _1fd=function(_1fe){
if(_1fe&&_1d8){
for(var i=0;i<_1d8.length;i++){
if(_1d8[i].id==_1fe.id){
_1d8[i].enable();
break;
}
}
}
};
var _200=function(tool){
if(tool){
return tool.isEnabled();
}
return false;
};
var _202=function(_203){
if(_203){
return _203.isEnabled();
}
};
var _204=function(){
if(_1d8){
for(var i=0;i<_1d8.length;i++){
if(_1d8[i]){
_1d8[i].disable();
}
}
}
if(_1d7){
for(var i=0;i<_1d7.length;i++){
if(_1d7[i]){
_1d7[i].disable();
}
}
}
};
var _206=function(){
if(_1d8){
for(var i=0;i<_1d8.length;i++){
if(_1d8[i]){
_1d8[i].enable();
}
}
}
if(_1d7){
for(var i=0;i<_1d7.length;i++){
if(_1d7[i]){
_1d7[i].enable();
}
}
}
};
return {id:_1d2,element:_1d3,enableEventName:_1cc,disableEventName:_1cd,selectEventName:_1ce,unselectEventName:_1cf,checkEventName:_1d0,uncheckEventName:_1d1,mapToolbarController:_1d5,getToolbarController:function(){
return _1d5;
},getDefaultTool:function(){
return _1d6;
},setToolbarController:function(_208){
_1d5=_208;
},getSelectedTool:function(){
_1da();
},getSelectedClass:function(){
return _1c8;
},enable:function(){
_206();
},disable:function(){
_204();
},getEnabledClass:function(){
return _1ca;
},getDisabledClass:function(){
return _1c9;
},getCheckedClass:function(){
return _1cb;
},isCommandEnabled:function(_209){
return _202(_209);
},disableCommand:function(_20a){
_1fa(_20a);
},enableCommand:function(_20b){
_1fd(_20b);
},selectTool:function(tool){
_1dc(tool);
},addTool:function(_20d,_20e,_20f){
return _1ed(this,_20d,_20e,_20f);
},addCommand:function(_210,_211){
return _1e1(this,_210,_211);
},addToggle:function(_212,_213){
return _1e6(this,_212,_213);
},getTools:function(){
return _1d7;
},getPanTool:function(){
return _1d4;
},getCommands:function(){
return _1d8;
},isToolEnabled:function(tool){
return _200(tool);
},isCommandEnabled:function(_215){
return _202(_215);
},hasTool:function(tool){
return _1f4(tool);
},hasCommand:function(_217){
return _1f7(_217);
}};
};
var MapToolbarController=function(_218){
if(!_218){
throw "A valid esri map manager reference is required to create a 'MapToolbarController'.";
}
dojo.require("esri.toolbars.navigation");
dojo.require("esri.toolbars.draw");
var _219=_218;
var _map=_219.getMap();
var _21b=new Array();
var _21c=new esri.toolbars.Navigation(_map);
var _21d=new esri.toolbars.Draw(_map);
var _21e=null;
var _21f=new Object();
var _220=new Object();
var _221=new Object();
var _222=function(item){
if(item){
for(var evt in item){
if(evt){
var _225=item[evt];
if(_225){
for(var i=0;i<_225.length;i++){
if(_225[i]){
dojo.disconnect(_225[i]);
}
}
}
}
}
}
};
var _227=function(_228){
for(var item in _21f){
if(item&&(item===_228)){
_222(_21f[item]);
}
}
for(var item in _220){
if(item&&(item===_228)){
_222(_220[item]);
}
}
for(var item in _221){
if(item&&(item===_228)){
_222(_221[item]);
}
}
};
var _22a=function(){
for(var item in _21f){
if(item){
_222(_21f[item]);
}
}
};
var _22c=function(){
for(var item in _220){
if(item){
_222(_220[item]);
}
}
};
var _22e=function(){
for(var item in _221){
if(item){
_222(_221[item]);
}
}
};
var _230=function(){
_22a();
_22c();
_22e();
};
var _231=function(_232,_233,_234){
if(!_21f[_232]){
_21f[_232]=new Object();
}
if(!_21f[_232][_233]){
_21f[_232][_233]=new Array();
}
_21f[_232][_233].push(dojo.connect(_map,_233,_234));
};
var _235=function(_236,_237,_238){
if(!_220[_236]){
_220[_236]=new Object();
}
if(!_220[_236][_237]){
_220[_236][_237]=new Array();
}
_220[_236][_237].push(dojo.connect(_21c,_237,_238));
};
var _239=function(_23a,_23b,_23c){
if(!_221[_23a]){
_221[_23a]=new Object();
}
if(!_221[_23a][_23b]){
_221[_23a][_23b]=new Array();
}
_221[_23a][_23b].push(dojo.connect(_21d,_23b,_23c));
};
var _23d=function(){
var _23e=_21b.length;
for(var i=0;i<_23e;i++){
if(_21b[i]){
var _240=_21b[i].getSelectedTool();
if(_240){
return _240;
}
}
}
return null;
};
var _241=function(_242){
var _243=_21b.length;
for(var i=0;i<_243;i++){
if(_21b[i].id===_242.id){
return true;
}
}
return false;
};
var _245=function(_246){
var _247=_21b.length;
for(var i=0;i<_247;i++){
if(_21b[i].id===_246){
return true;
}
}
return false;
};
var _249=function(_24a,tbar,_24c){
if(tbar){
if(!_241(tbar)){
if(_24c===true){
_21e=tbar;
}
return _21b.push(tbar);
}
}
return null;
};
var _24d=function(_24e,_24f){
if(_24f){
var _250=_24f.length;
for(var i=0;i<_250;i++){
_249(_24e,_24f[i]);
}
}
};
var _252=function(){
if(_21b){
var _253=_21b.length;
for(var i=0;i<_253;i++){
_21b[i].selectTool(null);
}
}
};
var _255=function(tool){
if(tool&&_21b){
var _257=_21b.length;
for(var i=0;i<_257;i++){
if(_21b[i].hasTool(tool)){
_21b[i].selectTool(tool);
}else{
_21b[i].selectTool(null);
}
}
}
};
var _259=function(tool){
if(toolID&&_21b){
var _25b=_21b.length;
for(var i=0;i<_25b;i++){
if(_21b[i].hasTool(tool)){
_21b[i].isToolEnabled(tool);
}
}
}
return false;
};
var _25d=function(_25e){
if(_25e&&_21b){
var _25f=toolbars.length;
for(var i=0;i<_25f;i++){
if(_21b[i].hasCommand(_25e)){
_21b[i].isCommandEnabled(tool);
}
}
}
return false;
};
var _261=function(_262){
if(_262&&_21b){
var _263=_21b.length;
for(var i=0;i<_263;i++){
if(_21b[i].hasCommand(_262)){
_21b[i].disableCommand(_262);
}
}
}
};
var _265=function(_266){
if(_266&&_21b){
var _267=_21b.length;
for(var i=0;i<_267;i++){
if(_21b[i].hasCommand(_266)){
_21b[i].enableCommand(_266);
}
}
}
};
var _269=function(){
if(_21e){
if(_21e.getDefaultTool()){
return _21e.getDefaultTool();
}
}
return null;
};
var _26a=function(){
if(_21e){
var tool=_21e.getDefaultTool();
if(tool){
_21e.selectTool(tool);
}
}
};
var _26c=function(){
_252();
_21d.deactivate();
_21c.deactivate();
};
return {mapManager:_219,map:_map,esriNavToolbar:_21c,esriDrawToolbar:_21d,initMapToolbar:function(_26d){
var _26e=new MapToolbar(_26d);
addToolbar(_26e);
return _26e;
},getDefaultToolbar:function(){
return _21e;
},getSelectedTool:function(){
_23d();
},getDefaultTool:function(){
return _269();
},selectDefaultTool:function(){
_26a();
},selectTool:function(tool){
_255(tool);
},enableCommand:function(_270){
_265(_270);
},disableCommand:function(_271){
_261(_271);
},addToolbar:function(tbar,_273){
return _249(this,tbar,_273);
},addMapToolbar:function(_274,_275){
var _276=new MapToolbar(_274,this);
_249(this,_276,_275);
return _276;
},addToolbars:function(_277){
_24d(this,_277);
},addMapToolbars:function(_278){
if(_278){
var _279=new Array();
for(var i=0;i<_278.length;i++){
var _27b=new MapToolbar(_278[i],this);
_279.push(_27b);
}
return _279;
}
return null;
},getToolbars:function(){
return _21b;
},addTool:function(_27c,_27d,_27e,_27f){
var tool=_27c.addTool(_27d,_27e,_27f);
return tool;
},addCommand:function(_281,_282,_283){
var _284=_281.addCommand(_282,_283);
return _284;
},isToolEnabled:function(tool){
return _259(toolID);
},isCommandEnabled:function(_286){
return _25d(commandID);
},unselectAllMapTools:function(){
_252();
},addMapListener:function(_287,_288,_289){
_231(_287,_288,_289);
},addNavToolbarListener:function(_28a,_28b,_28c){
_235(_28a,_28b,_28c);
},addDrawToolbarListener:function(_28d,_28e,_28f){
_239(_28d,_28e,_28f);
},clearAllMapEventsTracked:function(){
_22a();
},clearAllNavToolbarEventsTracked:function(){
_22c();
_21c.deactivate();
},clearAllDrawToolbarEventsTracked:function(){
_22e();
_21d.deactivate();
},clearAllEventsTracked:function(){
_230();
_21d.deactivate();
_21c.deactivate();
},clearAllToolbarItemEventsTracked:function(_290){
_227(_290);
_21d.deactivate();
_21c.deactivate();
},activateNav:function(_291){
_21d.deactivate();
_21c.activate(_291);
},activateDraw:function(_292){
_21c.deactivate();
_21d.activate(_292);
},deactivateNav:function(){
_21c.deactivate();
},deactivateDraw:function(){
_21d.deactivate();
},reset:function(){
_26c();
}};
};
var tgCommon=new Object();
var tgFramework={components:{jQuery:{url:"jquery-1.2.6.min.js",loaded:false},jQueryUI:{url:"jquery-ui-personalized-1.6rc2.min.js",loaded:false},jQueryForm:{url:"jquery.form.js",loaded:false},jQueryValidate:{url:"jquery.validate.min.js",loaded:false},Bucket2:{url:"Bucket2.js",loaded:false},ActiveLayer:{url:"ActiveLayer.js",loaded:false},FormHelper:{url:"FormHelper.js",loaded:false},MapToolbarController:{url:"MapToolbarController.js",loaded:false},MapToolbar:{url:"MapToolbar.js",loaded:false},MapTool:{url:"MapTool.js",loaded:false},MapCommand:{url:"MapCommand.js",loaded:false},MapDropDown:{url:"MapDropDown.js",loaded:false},tgGraphicsLayer:{url:"tgGraphicsLayer.js",loaded:false},GraphicsLayerManager:{url:"GraphicsLayerManager.js",loaded:false},SimpleFormHelper:{url:"SimpleFormHelper.js",loaded:false},ZoomToFeature:{url:"ZoomToFeature.js",loaded:false},SelectLayer:{url:"SelectLayer.js",loaded:false}},using:function(_293){
var c=this.components[_293];
if(c&&c.loaded===false){
var s=document.createElement("script");
s.setAttribute("type","text/javascript");
s.setAttribute("src",c.url);
document.getElementsByTagName("head")[0].appendChild(s);
}
},addNamespace:function(name){
this[name]=new Object();
return this[name];
},componentAvailable:function(_297){
if(this.components[_297]){
this.components[_297].loaded=true;
}
},isLoaded:function(_298){
var c=this.components[_298];
return (c&&c.loaded===true);
}};
tgFramework.addNamespace("UI");
tgFramework.addNamespace("Form");
if(!Array.prototype.indexOf){
Array.prototype.indexOf=function(elt){
var len=this.length;
var from=Number(arguments[1])||0;
from=(from<0)?Math.ceil(from):Math.floor(from);
if(from<0){
from+=len;
}
for(;from<len;from++){
if(from in this&&this[from]===elt){
return from;
}
}
return -1;
};
}
Array.prototype.remove=function(from,to){
var rest=this.slice((to||from)+1||this.length);
this.length=from<0?this.length+from:from;
return this.push.apply(this,rest);
};
tgCommon.Curry=function(fn,_2a1){
var _2a1=_2a1||window;
var args=[];
for(var i=2,len=arguments.length;i<len;++i){
args.push(arguments[i]);
}
return function(){
fn.apply(_2a1,args);
};
};
tgCommon.Template=function(){
var _2a5=new Object();
var _2a6=function(_2a7,data){
var err="";
try{
var func=_2a5[_2a7];
if(!func){
var _2ab="var p=[],print=function(){p.push.apply(p,arguments);};"+"with(obj){p.push('"+_2a7.replace(/[\r\t\n]/g," ").replace(/'(?=[^#]*#>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g,"',$1,'").split("<#").join("');").split("#>").join("p.push('")+"');}return p.join('');";
func=new Function("obj",_2ab);
_2a5[_2a7]=func;
}
return func(data);
}
catch(e){
err=e.message;
}
return err;
};
return {processTemplate:function(_2ac,data){
return _2a6(_2ac,data);
}};
};
tgCommon.EventModel=function(_2ae){
var _2af=new Object();
var _2b0={events:[]};
var _2b1=$.extend({},_2b0,_2ae);
_removeFromArray=function(_2b2,from,to){
var rest=_2b2.slice((to||from)+1||_2b2.length);
_2b2.length=from<0?_2b2.length+from:from;
return _2b2.push.apply(_2b2,rest);
};
var _2b6=function(_2b7){
if(!_2af[_2b7]){
_2af[_2b7]=new Array();
}
};
var _2b8=function(_2b9,_2ba){
if(typeof (_2b9)==="string"&&typeof (_2ba)==="function"){
if(!_2af[_2b9]){
throw "The event '"+_2b9+"' is not supported.";
}
return {name:_2b9,index:_2af[_2b9].push(_2ba)};
}else{
throw "Cannot add event listener. Invalid argument. A valid event name and listener function is required.";
}
};
var _2bb=function(_2bc){
if(_2bc&&_2bc.name&&(_2bc.index||_2bc.index===0)){
if(_2af[_2bc.name]){
_removeFromArray(_2af[_2bc.index],index);
}
}else{
throw "Cannot remove listener. Inavalid event listener object.";
}
};
var _2bd=function(_2be,e){
if(_2af[_2be]){
for(var i=0;i<_2af[_2be].length;i++){
if(_2af[_2be][i]){
_2af[_2be][i](e);
}
}
}
};
var _2c1=function(_2c2){
if(_2af[_2c2]){
_2af[_2c2]=new Array();
}
};
var _2c3=function(){
if(_2b1.events){
jQuery.each(_2b1.events,function(key,_2c5){
if(typeof (_2c5)==="string"){
_2af[_2c5]=new Array();
}
});
}
};
_2c3();
return {createEvent:function(_2c6){
_2b6(_2c6);
},addListener:function(_2c7,_2c8){
_2b8(_2c7,_2c8);
},removeListener:function(_2c9){
_2bb(_2c9);
},raiseEvent:function(_2ca,e){
_2bd(_2ca,e);
}};
};
var tgGraphicsLayer=function(map,name){
if(!map){
throw "A valid map object is required to create a 'tgGraphicsLayer'";
}
if(!name){
throw "A valid name is required to create a 'tgGraphicsLayer'. The name '"+name+"' is not valid.";
}
var _map=map;
var _2cf=name;
var _2d0=new Array();
_removeFromArray=function(_2d1,from,to){
var rest=_2d1.slice((to||from)+1||_2d1.length);
_2d1.length=from<0?_2d1.length+from:from;
return _2d1.push.apply(_2d1,rest);
};
var _2d5=function(_2d6){
if(!_2d6){
throw "A valid graphic object is required to be added to 'tgGraphicsLayer'.";
}
var _2d7=_2d0.length;
_2d6.layerName=_2cf;
_2d6.graphicID=_2d7;
_2d0[_2d7]=_2d6;
_map.graphics.add(_2d6);
return _2d7;
};
var _2d8=function(_2d9){
for(var i=0;i<_2d0.length;i++){
if(_2d0[i].graphicID===_2d9){
return i;
}
}
return null;
};
var _2db=function(_2dc){
if(_2dc||_2dc===0){
_map.graphics.remove(_2d0[_2dc]);
_2d0.remove(_2dc);
}
};
var _2dd=function(_2de){
if(!_2de){
throw "A valid graphic object is required to be removed from 'tgGraphicsLayer'.";
}
if(_2de.layerName!=_2cf){
throw "The graphic object to be removed does not belong to this 'tgGraphicsLayer' layer object";
}
if((!_2de.graphicID)&&(_2de.graphicID!==0)){
throw "The graphic object to be removed from the 'tgGraphicsLayer' layer object does not have a layer ID.";
}
if(isNaN(parseInt(_2de.graphicID))){
throw "Unable to remove graphic object from 'tgGraphicsLayer'. The layer ID on the graphic object is not an integer.";
}
_2db(_2d8(_2de.graphicID));
};
var _2df=function(){
for(var i=0;i<_2d0.length;i++){
if(_2d0[i]){
_2d0[i].hide();
}
}
};
var _2e1=function(){
for(var i=0;i<_2d0.length;i++){
if(_2d0[i]){
_2d0[i].show();
}
}
};
var _2e3=function(){
for(var i=0;i<_2d0.length;i++){
if(_2d0[i]){
_map.graphics.remove(_2d0[i]);
}
}
_2d0=new Array();
};
return {layerName:_2cf,show:function(){
_2e1();
},hide:function(){
_2df();
},clearLayer:function(){
_2e3();
},addGraphic:function(_2e5){
return _2d5(_2e5);
},removeGraphic:function(_2e6){
_2dd(_2e6);
},getGraphic:function(_2e7){
if(_2e7<_2d0.length&&_2e7>=0){
return _2d0[_2e7];
}
return null;
},getGraphicCount:function(){
if(_2d0==null){
return 0;
}
return _2d0.length;
}};
};
var tgFeatureGraphicsLayer=function(map,name,_2ea,_2eb){
var _2ec=["point","multipoint","polyline","polygon","extent"];
var _2ed=["simplemarkersymbol","picturemarkersymbol","simplelinesymbol","cartographiclinesymbol","simplefillsymbol","picturefillsymbol","textsymbol"];
var _2ee=["simplemarkersymbol","picturemarkersymbol","textsymbol"];
var _2ef=["simplelinesymbol","cartographiclinesymbol","textsymbol"];
var _2f0=["simplefillsymbol","picturefillsymbol","textsymbol"];
if(!_2ea){
throw "A valid symbol is required to create a 'tgFeatureGraphicsLayer' layer.";
}
if(_2ed.indexOf(_2ea.type)===-1){
throw "The symbol type is not valid";
}
if(!_2eb){
throw "A geometry type is required to create a 'tgFeatureGraphicsLayer' layer.";
}
var _2f1=_2ec.indexOf(_2eb);
if(_2f1===-1){
throw "A valid geometry type is required to create a 'tgFeatureGraphicsLayer' layer. Valid geometryTypes are 'point', 'multipoint', 'polyline', 'polygon', 'extent'.";
}
if(_2f1===0||_2f1===1){
if(_2ee.indexOf(_2ea.type)===-1){
throw "The symbol type cannot be applied to a point.";
return;
}
}else{
if(_2f1===2){
if(_2ef.indexOf(_2ea.type)===-1){
throw "The symbol type cannot be applied to a polyline.";
return;
}
}else{
if(_2f1===3||_2f1===4){
if(_2f0.indexOf(_2ea.type)===-1){
throw "The symbol type cannot be applied to a polygon.";
return;
}
}
}
}
var _2f2=_2ea;
var _2f3=new tgGraphicsLayer(map,name);
var _2f4=_2eb;
var _2f5=function(_2f6){
if(!_2f6){
throw "A valid graphic object is required to be added to 'tgGraphicsLayer'.";
}
if(_2f6.geometry.type===_2f4){
_2f6.symbol=_2f2;
_2f3.addGraphic(_2f6);
}else{
throw "Cannot add a '"+_2f6.geometry.type+"' type of geometry to a "+_2f4+" graphics layer.";
}
};
var _2f7=function(_2f8){
if(!_2f8){
throw "A valid graphic object is required to be removed from the 'tgGraphicsLayer'.";
}
if(_2f8.geometry.type===_2f4){
_2f8.symbol=_2f2;
_2f3.removeGraphic(_2f8);
}else{
throw "Cannot remove a '"+_2f8.geometry.type+"' type of geometry from a "+_2f4+" graphics layer.";
}
};
var _2f9=function(_2fa,_2fb){
if(!_2fa){
throw "A valid geometry object is required to be added to 'tgGraphicsLayer'.";
}
if(_2fa.type===_2f4){
var _2fc=new esri.Graphic(_2fa,_2f2,_2fb);
_2f5(_2fc);
return _2fc;
}else{
throw "Cannot add a '"+_2fc.geometry.type+"' type of geometry to a "+_2f4+" graphics layer.";
}
};
return {layerName:_2f3.layerName,show:function(){
_2f3.show();
},hide:function(){
_2f3.hide();
},clearLayer:function(){
_2f3.clearLayer();
},addGraphic:function(_2fd){
_2f5(_2fd);
},getGraphic:function(_2fe){
return _2f3.getGraphic(_2fe);
},getGraphicCount:function(){
return _2f3.getGraphicCount();
},removeGraphic:function(_2ff){
_2f7(_2ff);
},addGeometry:function(_300,_301){
return _2f9(_300,_301);
}};
};

