//Map Layer URLs
var _serverURL = "http://65.196.129.4";

//AGS Map Services
var _parcelLayer = _serverURL + "/ArcGIS/rest/services/SumnerTN/Sumner.Parcel/MapServer";
var _parcelFeatureLayer = _serverURL + "/ArcGIS/rest/services/SumnerTN/Sumner.Parcel/FeatureServer";
var _LayersLayer = _serverURL + "/ArcGIS/rest/services/SumnerTN/Sumner.Layers/MapServer";
var _locatorService = _serverURL + "/ArcGIS/rest/services/SumnerTN/Sumner.Locator/GeocodeServer";
var _dynBaseLayer = _serverURL + "/ArcGIS/rest/services/SumnerTN/Sumner.DynBase/MapServer";
var _baseMapLayers = _serverURL + "/ArcGIS/rest/services/General/Basemap/MapServer"
var _ExportWebMapURL = "http://65.196.129.8/arcgis/rest/services/SumnerTN/ExportWebMap_TnSumner/GPServer/Export Web Map";


//Arc Online Services
var _topoLayer = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";
var _streetmapLayer = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
var _esriTopoURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer";
var _esriCanvasUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer";
var _esriShadedReliefURL = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer";

//Geom Service
var _geometryService = "http://65.196.129.4/ArcGIS/rest/services/Geometry/GeometryServer";

//Other Map Services
var _TNImageryLayer = "http://tnmap.tn.gov/ArcGIS/rest/services/TNMap_Imagery_Base_WebMercator/MapServer";

//If a parameter is null, display this message in the parcel details window.
var _NAString = "Not Available";

//Set links to add to Property Details here...
//NAME property is displayed as the link
//LINK property is the destination
var _propDetailsLinks = [
{ name: "Sumner County Homepage", link: "http://www.sumnertn.org/" }, 
{ name: "Tennessee Property Assessment Data", link: "http://www.assessment.state.tn.us/SelectCounty.asp" }
];

//Number of owner search results per page.
var _ownerSearchResultsPageSize = 15;

function setConfigProperties(){
  spRef = new esri.SpatialReference({ wkid: 102100 });
  startExtent = new esri.geometry.Extent(-9662007.15206155, 4329862.52901883, -9591081.87901101, 4394444.29178235, spRef);

 fullExtent = new esri.geometry.Extent(-9657433.5182,4334253.6974,-9596311.7069,4390810.7478, spRef);
  fields = {
                COUNTY_ID:"COUNTY_ID",
                PARCEL_TYP:"PARCEL_TYP",
                GISLINK:"GISLINK",
                CALC_ACRE:"CALC_ACRE",
                GISLINK_1:"GISLINK_1",
                NUMBER_:"NUMBER_",
                STREET:"STREET",
                COMMUNITY:"city",
                ESN:"ESN",
                ZIP:"ZIP",
                X:"X",
                Y:"Y",
                FIRE:"FIRE",
                POLICE:"POLICE",
                EMS: "EMS",
                ST_ABB:"ST_ABB",
                REGION:"REGION",
                NEW_ESN:"NEW_ESN",
                gpdata_own: "owner",
                gpdata_cor: "aprval",
                gpdata_par: "parcelid",
                gpdata_map:"gpdata_map",
                gpdata_pt_: "pt_des",
                gpdata_gp:"gpdata_gp",
                gpdata_cma:"gpdata_cma",
                gpdata_p_1:"gpdata_p_1",
                gpdata_gis:"gpdata_gis",
                gpdata_use:"gpdata_use",
                FullAddr: "propaddr"

     }
  aliases = {
                COUNTY_ID:"COUNTY_ID",
                PARCEL_TYP:"PARCEL_TYP",
                GISLINK:"GISLINK",
                CALC_ACRE:"CALC_ACRE",
                GISLINK_1:"GISLINK_1",
                NUMBER_:"NUMBER_",
                STREET:"STREET",
                COMMUNITY:"COMMUNITY",
                ESN:"ESN",
                ZIP:"ZIP",
                X:"X",
                Y:"Y",
                FIRE:"FIRE",
                POLICE:"POLICE",
                EMS: "EMS",
                ST_ABB:"ST_ABB",
                REGION:"REGION",
                NEW_ESN:"NEW_ESN",
                gpdata_par:"gpdata_par",
                gpdata_own:"gpdata_own",
                gpdata_cor:"gpdata_cor",
                gpdata_map:"gpdata_map",
                gpdata_pt_:"gpdata_pt_",
                gpdata_gp:"gpdata_gp",
                gpdata_cma:"gpdata_cma",
                gpdata_p_1:"gpdata_p_1",
                gpdata_gis:"gpdata_gis",
                gpdata_use:"gpdata_use",
                FullAddr:"FullAddr"
    
  }
  // this is the primary key field for the tax parcel layer
  // these 2 fields are shown in the search results window on the left hand side of the app
  keyField = fields.gpdata_own;
  addressField = fields.FullAddr;
}

function setLayoutProperties(){
  // should not need to change these properties unless you make changes to the popup
  infoWindowWidth = 330;
  infoWindowHeight = 270;
  // the app will zoom to the feature extent + and - the addExtent in map units
  addExtent = 600;
}

function checkVal(strUrl){
  // check that the server URL paths end with a "/", add it if not present
  var strLen = strUrl.length;
  if( strUrl.substring(strLen-1,strLen) != "/"){
    alert(strUrl + " in config.js is missing '/' at the end of the string, automatically added");
    strUrl = strUrl + "/";
  }
  return(strUrl);
}


