// ArcIMSparam.js
// Generic Map Browser
// javascript file with parameters specific to calling page

//***************************************************************************
//*			parameters File for HTML Template		    *
//***************************************************************************
// get machine name
var hostName = document.location.host;
// make URL for getting mapservice catalog
var catURL = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=catalog";
// make prefix for URL
var serverURL  = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=";

//Do not edit the following line
//DESIGNERSETSPARAMETERS
//Do not edit the above line

//New variables for Public v. Private functionality
var isPublic = false;			//marks if current map service is public or private
var isPartner = false;			//marks if current app is partner
var loadThisService = "nothing";	//marks the specific service that is loaded (only public services)
var topLayerActiveTab = 0;		//marks which tab is active in the toplayer.htm page
var communityParkValue = "";		//stores the park value to zoom to in Public_Parks after community zoom

//Disclaimers for the public sites
var zoningDisclaimer = 'The colorization of the Zoning data in this service has been regionalized. You may, however, use the "Identify" tool to identify the precise Zoning code for a specific area.';
var landuseDisclaimer = 'The colorization of the Landuse data in this service has been regionalized. You may, however, use the "Identify" tool to identify the precise Landuse code for a specific area.';

var appPath = "http://" + hostName; 
var imsURL = "";
var imsOVURL = "";

// url for Custom QueryService if not ImageService(imsURL)...otherwise empty quotes
var imsQueryURL = "";
var imsGeocodeURL = "";

var mapBackColor = "";
var ovBoxColor = "255,0,0";
var ovBoxSize = 3;

var hasOVMap=true;
var hasTOC=true;
var useModeFrame=true;

//initial map extent
var startLeft = 0;
var startRight = 0;
var startTop = 0;
var startBottom = 0;
//maximum map extent
//latest version was all zeros
var limitLeft = 0;
var limitRight = 0;
var limitTop = 0;
var limitBottom = 0;
//added by Bob - required by Netscape code
var cornerOffset = 0;

// flag available tools
var usePan=true;
var usePanNorth=true;
var usePanWest=true;
var usePanEast=true;
var usePanSouth=true;

var useZoomIn=true;
var useZoomOut=true;
var useFullExtent=true;
var useZoomActive=true;
var useZoomLast=true;

var useIdentify=true;
var useMeasure=true;
var useSelect=true;
var useQuery=true;
var useFind=true;
var useBusFind=false;
var useParkFind=false;
var useTIPFind=false;
var useCountFind=false;
var useClearSelect=true;
var useRedline=true;

var usePrint=true;
var useBuffer=true;
var useResize=true;
var useOption=false;
var useGeocode=true;
var useExtract=false;
var formFilePath="D:/ArcIMS/Website/regisims";

var useSetUnits=true;
var useHyperLink=false;
var useStoredQuery=true;
//var useBufferShape=false; // not implemented
var hasToolBarOnLayer=false;
// file locations for servlet connector form creation
var headerFilePath = formFilePath + "/header.htm";
var footerFilePath = formFilePath + "/footer.htm";

/**************************************
* Basic Map parameters
**************************************/

// variables for map pixel offset from upper left corner of frame
	// horizontal offset
var hspc = 0;
	// vertical offset
var vspc = 0;

//panning factor for arrow buttons
var panFactor = 0.85;
//zoom factors for v.3
var zoomFactor = 2;

// margin factor for zooming in on selected lines and polygons - based on feature width and height. . . margin will be selectMargin * width or height
var selectMargin = 0.25;
// margin margin factor for zooming in on selected points - based on full extent. . . margin will be selectPointMargin * fullWidth or fullHeight
var selectPointMargin = 0.90;

// show the scale factor
var showScalePercent=true;
// display coords in status line
var showXYs=true;

//variables for MapDrawing
	// North Arrow
var drawNorthArrow = true;
var NorthArrowType = "4";
var NorthArrowSize = "15";
var NorthArrowCoords = "20 30";
var NorthArrowAngle = "0";
	// Scale Bar
var drawScaleBar = true;
	// MapUnits=DEGREES,FEET,METERS
var MapUnits = "DEGREES";
	// can MapUnits be changed by user?
var setMapUnits=true;
	// ScaleBarUnits=KILOMETERS,METERS,MILES,FEET
var ScaleBarUnits = "MILES";
var ScaleBarBackground = "TRUE";
var ScaleBarBackColor = "0,0,0";

var ScaleBarFontColor = "255,255,255";
var ScaleBarColor = "192,192,192";
var ScaleBarFont = "Arial";
var ScaleBarStyle = "Bold";
var ScaleBarRound = "1";
var ScaleBarSize = "14";
var ScaleBarWidth = "7";
var ScaleBarPrecision = 2;
var numDecimals = ScaleBarPrecision;
	// Copyright blurb
var drawCopyright = true;
var CopyrightFont = "Arial";
var CopyrightStyle = "Bold";
var CopyrightSize = "8";
var CopyTextCoords = "1 4";
var CopySymCoords = "45 10";
var CopyrightCoords = "50 4";
var CopyrightColor = "0,0,0";
var CopyrightBackground = "False";
var CopyrightBGColor = "255,255,255";
var CopyrightGlow = "True";
var CopyrightGlowColor = "255,255,255";
var CopyrightText = "REGIS";
	// Mode on Map
var drawModeOnMap = false;
var modeRefreshMap = false;
var modeMapColor = "255,255,255";
var modeMapGlow = "128,0,255";

var ovImageVar;
var ovBorderWidth = 2;
var ovExtentBoxSize = 2;

// setup test for Nav 4.0
var isNav4 = false;
var isNav5up = false;
var isNav = false;
var isIE = false;
if (navigator.appName == "Netscape") {
	isNav =true;
	if (parseFloat(navigator.appVersion)<5)
   		isNav4 = true;
	else isNav5up = true;
	}
else 
	isIE = true;
		
/**************************************
* Extended Map parameters
**************************************/

// variables for ovmap offset
var ovHspc = 0;
var ovVspc = 0;

// color for Main Map zoombox in html hex RGB format
var zoomBoxColor = "#ff0000";

// index of initial active layer. . . if more than or equal to layer count top layer used
var ActiveLayerIndex=99;

// variables for using individual components
var useTextFrame=false;
// use external window for dialogs
var useExternalWindow=true;

// colors for tables 
var textFrameBackColor="Silver";
var tableBackColor="White";
var textFrameTextColor="Black";
var textFrameLinkColor="Blue";
var textFrameFormColor="Gray";

// LayerList visible at service load
var showTOC=true;
// set layer visibility according to LayerList or by custom programming
var toggleVisible = true;
// set layer visibility of OVMap according to LayerList or by custom programming
	// imsURL must equal imsOVMap - depends on one LayerList
var toggleOVVisible = true;
// will the LayerList show all layers, not just those available at current scale
var listAllLayers = true;

	// Mode on floating layer
var drawFloatingMode = false;
var modeLayerOn = false;
var modeLayerColor = "Black";
var modeLayerShadowColor = "White";
var modeLayerFont = "Arial";
var modeLayerSize = "4";

	// does the overview map a layer on top of map?... 
var ovMapIsLayer=true;

var webParams = "";
if (parent.MapFrame!=null) {
	webParams = parent.document.location.search;
} else {
	webParams = document.location.search;
}

/**************************************
* Interactive Map parameters
**************************************/

// Click points - Measure/Shape Select/Shape Buffer
var clickMarkerColor="255,0,0";
var clickMarkerType="Circle";
var clickMarkerSize="6";


/**************************************
* Identify/Select/Query/Buffer parameters
**************************************/

// search tolerance in pixels around click - originally 5 pixels
var pixelTolerance=.001;
// color of selected features in decimal RGB format
var selectColor="255,255,0";
// color of highlighted feature in decimal RGB format
var highlightColor="255,0,0";
// level of transparency of selected and highlighted color
var transparentLevel = "0.5";
	// zoom to selected feature if only one is returned?
var zoomToSingleSelect = true;



/****************************
*     Aliases and such      *
****************************/
// arrays storing layer names that are categorized into groupings of features
var layerGroup = new Array(); 
//first iteration is cadastral
layerGroup[0] = "Historical Lot Lines, Lot Number Text, Parcel Block Numbers, Parcel Block Nm. Text, Parcels, Parcelsshp, Parcel for Orthos, Parcel Sale Data, Parcel Tax Data, ROW Encroachments, ROW Encroachment Text, Subdivisions, Subdivision Text, LANDR.CITIES_PT, LANDR.PROVINCE_POLY";
//second is electric/steam 
layerGroup[1] = "Electric Arrestor, Electric Duct Bank, Electric Enclosure, Electric Fuse, Electric Pole, Electric Primary Conductor, Electric Riser, Electric Secondary Conductor, Electric Switch, Electric Text, Electric Underground Structures, Electric Load Break Junction, Steam Anchor Point, Steam Expansion Joint, Steam Plant, Steam Pressure Reducing Station, Steam Service Connection, Steam System Line, Steam Text, Steam Valve, Electric Street Light Controller, Electric Transformer Bank";
//third is landbase
layerGroup[2] = "Combined Utility Easements, Combined Utility Easement Text, Existing Landuse Areas, Existing Landuse Text, FEMA Amendment Locations, FEMA Amendment Text, FEMA Flood Zones, FEMA Flood Zone Text, Lake Level Control Structure, Lake Level Control Text, Lakes and Ponds, Lakes and Pondsshp, Landfill Lines, Landfills, Landfill Text, Orthophotography, Private Utility Easements, Private Utility Easement Text, Public Easements, Public Easement Text, Public Land Survey Areas, Public Land Survey Boundaries, Public Land Survey Text, River and Stream Lines, Soils, Soil Text, Survey Monuments, Survey Monument Text, Watersheds, Watershed Text, Wetlands, Wetland Text";
//fourth is political/planning
layerGroup[3] = "Airport Noise Contours, Airport Zoning Permit Applications, Airport Zoning Permit Text, Census Blocks, Census Tracts, Community College Districts, Community College District Text, County Boundaries, County Commissioner Districts, County Commissioner District Text, Downtown Development Authority Regions, Downtown Development Authority Text, Government Units, Historical Districts, Historical District Text, Historical Sites, Historical Site Text, Intermediate School Districts, Intermediate School District Text, Library Districts, Library District Text, Neighborhood Associations, Neighborhood Association Text, Parking Lots, Parking Lot Text, Park Outlines, Parks, Park Text, Planned Landuse Areas, Planned Landuse Text, Recreational Sites, Recreational Site Text, Renaissance Zones, Renaissance Zone Text, School Districts, School District Text, Special Zoning Districts, Special Zoning District Text, State House Districts, State House District Text, State Senate Districts, State Senate District Text, US Congressional Districts, US Congressional District Text, Variance Points, Variance Text, Village Areas, Village Boundaries Text, Zoning Areas, Zoning Text";
//fifth is sanitary
layerGroup[4] = "Sanitary Sewer Districts, Sanitary Sewer Easements, Sanitary Sewer Easement Text, Sanitary Sewersheds, Sanitary Sewershed Text, Sewer Air Relief Valve, Sewer Backflow Preventor/Check Valve, Sewer Blind Connection, Sewer Flow Regulator, Sewer Lateral, Sewer Lift Station, Sewer Main, Sewer Manhole, Sewer Metering Station, Sewer Overflow, Sewer Service Contract Areas, Sewer Service Contract Area Text, Sewer Text, Sewer Treatment Plant";

//sixth is storm
layerGroup[5] = "Drainage Restriction Points, Drainage Restriction Text, Storm Bridge, Storm Culverts, Storm Detention Basins, Storm Detention Text, Storm Drainage Easements, Storm Drainage Easement Text, Storm Inlet, Storm Lateral, Storm Lift Station, Storm Main, Storm Manhole, Storm Outfall, Storm Sewer Text, Steam Vault, Storm Weir, Subcatchment Area, Subcatchment Text, Water Quality BMP";

//seventh is transportation
layerGroup[6] = "Bridges, Bridge Text, Bus Routes, Bus Route Text, Bus Stops, Bus Stop Text, Railroad Text, Railroad Tracks, Street Centerlines, Street Cut Permit Locations, Street Cut Permit Text, Street Intersections, Street Maintenance Districts, Street Maintenance District Text, Traffic Signals, Traffic Signal Text, Trails and Bikeways, Trail and Bikeway Text";
//eighth is water
layerGroup[7] = "Water Access Vault, Water Air Relief Valve, Water Blow Off Valve, Water Casing, Water Contract Areas, Water Contract Area Text, Water Control Valve, Water Easements, Water Easement Text, Water Fire Hydrant, Water Fitting, Water Hydrant Districts, Water Hydrant District Text, Water Interconnect, Water Main, Water Meters, Water Meter Station, Water Pump Station, Water Quality BMP, Water Service Areas, Water Service Area Text, Water Service Pipe, Water Supply Well, Water System Valve, Water Tank, Water Text, Water Wiring Conduit";

//intangible layers-not to be queried
layerGroup[8] = "Mask Layer, Overview Roads, Parcel Geocoding, Orthophotography, Street Geocoding, Government Labels, Downtown Transit Center";

//Descriptions for the Map Services to display to the public
var serviceDescTitle = new Array();
var serviceDescription = new Array();
serviceDescTitle[0] =  "Census";
serviceDescription[0] = "Census Data";
serviceDescTitle[1] = "Community_Districts";
serviceDescription[1] = "Community Districts";
serviceDescTitle[2] = "Environmental";
serviceDescription[2] = "Environmental";
serviceDescTitle[3] = "ITP";
serviceDescription[3] = "ITP routes and stops";
serviceDescTitle[4] = "Parcels";
serviceDescription[4] = "Parcels and residential information";
serviceDescTitle[5] = "PDM_Center";
serviceDescription[5] = "PD&M Center Counter Application";
serviceDescTitle[6] = "Planning";
serviceDescription[6] = "Planning";
serviceDescTitle[7] = "PTAS";
serviceDescription[7] = "PTAS parcel information";
serviceDescTitle[8] = "Public_Bus_Info";
serviceDescription[8] = "Public Bus Finder";
serviceDescTitle[9] = "Public_Parcel_Find";
serviceDescription[9] = "Public Parcel Finder";
serviceDescTitle[10] = "Public_Parks";
serviceDescription[10] = "Public Park Finder";
serviceDescTitle[11] = "Public_PlannedLanduse";
serviceDescription[11] = "Public Planned Landuse Finder";
serviceDescTitle[12] = "Public_Zoning";
serviceDescription[12] = "Public Zoning Finder";
serviceDescTitle[13] = "Recreation";
serviceDescription[13] = "Recreation";
serviceDescTitle[14] = "Transportation";
serviceDescription[14] = "Transportation";
serviceDescTitle[15] = "Utility";
serviceDescription[15] = "Utilities";
serviceDescTitle[16] = "Water_Utility_System";

serviceDescription[16] = "Water Utility information"; 

// parameters for setting up hyperlinks in data display
var hyperLinkLayers = new Array(); // layers to have hyperlink
var hyperLinkFields = new Array();	// field in those layers to be used for hyperlink
hyperLinkLayers[0] = "Image";
hyperLinkFields[0] = "URL";

// will the returned data be displayed in text frame?
var showSelectedData=true;
// will the returned features be drawn?
var showSelectedFeatures=true;
// maximum number of features returned from query
var maxFeaturesReturned=50;

// number of data samples retrieved for query form
var numberDataSamples = 50;



/**************************************
* Legend parameters - aimsLegend.js
**************************************/

// legend map size
var legWidth=170;
var legHeight=300;
var legFont="Arial";
var legTitle="Legend";

/**************************************
* Options parameters - aimsOptions.js
**************************************/

// allowing user to set options
var allowOptions=false;

/**************************************
* ClassRender parameters - aimsClassRender.js
**************************************/

// parameters for custom class rendering... overrides default renderer
var ClassRenderLayer = new Array();  // layers to have custom renderers
var ClassRenderString = new Array(); // initial custom renderer XML string for the layers
ClassRenderLayer[0] = "Cities";
ClassRenderString[0] = "";
/*
ClassRenderString[0] ='<VALUEMAPRENDERER lookupfield="population">\n<RANGE LOWER="0" UPPER="1000000">\n<SIMPLEMARKERSYMBOL color="255,0,255" type="circle" size="4" />\n</RANGE>';
ClassRenderString[0] = ClassRenderString[0] + '<RANGE LOWER="1000000" UPPER="2500000">\n<SIMPLEMARKERSYMBOL color="255,0,255" type="circle" size="6" />\n</RANGE>';
ClassRenderString[0] = ClassRenderString[0] + '<RANGE LOWER="2500000" UPPER="5000000">\n<SIMPLEMARKERSYMBOL color="255,0,255" type="circle" size="9" />\n</RANGE>';
ClassRenderString[0] = ClassRenderString[0] + '<RANGE LOWER="5000000" UPPER="10000000">\n<SIMPLEMARKERSYMBOL color="255,0,255" type="circle" size="12" />\n</RANGE>';
ClassRenderString[0] = ClassRenderString[0] + '<RANGE LOWER="10000000" UPPER="30000000">\n<SIMPLEMARKERSYMBOL color="255,0,255" type="circle" size="16" />\n</RANGE>\n</VALUEMAPRENDERER>';
*/
var numStatDecimals = 4;


/***********************************
* Geocode parameters - aimsGeocode.js
************************************/

// maximum geocode candidates returned - default = 20
var maxGeocodeCandidates=20;
// minimal acceptable geocode score for candidate
var minGeocodeScore=50;
var geocodePointColor = "255,0,0";
var geocodePointSize = "15";
var geocodeLabelSize = "12";
// custom functions needed for Reverse Geocoding
var useReverseGeocode = false;


// the starting point. . . it all starts here on loading
function checkParams() {
	//alert("You have reached the checkParams function");
	appDir = getPath(document.location.pathname);
	// global for overview map. . . change if not on same frame as Map
	ovImageVar = document.ovImage;
	//set debugon to 0 for no XML message reporting or 4 to report the messages
	debugOn = 0;
	formTitle = parent.PostFrame.document.title;
	if (parent.PostFrame.document.theForm!=null) formExists = true;
	//alert(tURL);
	if (parent.TextFrame==null) {
		useTextFrame = false;
		useExternalWindow=true;
	}
	if (!hasLayer("measureBox")) useMeasure=false;
	if ((!useMeasure) && (!drawScaleBar)) useSetUnits=false;
	if (ovImageVar==null) hasOVMap = false;
	if (parent.TOCFrame==null) hasTOC = false;
	if (parent.ModeFrame==null) useModeFrame = false;

	if (!isNav)	{
		if (hasLayer("theTop")) document.all.theTop.style.cursor = "crosshair";
		if (hasOVMap) ovImageVar.style.cursor = "hand";
	}
		
	if (hasOVMap) {
		// size of ov map image
		i2Width = ovImageVar.width;
		i2Height = ovImageVar.height;
		// position of ov map
		ovMapLeft = iWidth - (i2Width + 6);
		ovMapTop = 2;
	}
	if (webParams!="") {
		//alert(webParams);
		getCommandLineParams(webParams);
	}
	// if starting extents zero'd then flag to get start from mapservice
	if ((startLeft!=0) && (startRight!=0)) getStartingExtent=false;
	// if limit extents zero'd then flag to get max from mapservice
	if ((limitLeft!=0) && (limitRight!=0)) {
		getLimitExtent=false;
		enforceFullExtent=true;
	}
	if (ovBoxColor=="") ovBoxColor = "255,0,0";
	//ovBoxColor = convertHexToDec(ovBoxColor);
	if (aimsNavigationPresent) {
		// Set up event capture for mouse movement
		if (isNav4) {
			document.captureEvents(Event.MOUSEMOVE);
			document.captureEvents(Event.MOUSEDOWN);
			document.captureEvents(Event.MOUSEUP);
			//document.captureEvents(Event.MOUSEOUT);
		}
		document.onmousemove = getMouse;
		//document.onmousedown = chkMouseDown;
		document.onmousedown = mapTool;
		document.onmouseup = chkMouseUp;
		//document.onmouseout = chkMouseOut;
	} else {
		usePan=false;
		usePanNorth=false;
		usePanWest=false;
		usePanEast=false;
		usePanSouth=false;
		useMeasure=false;
		useZoomIn=false;
		useZoomOut=false
		//useFullExtent=false;
		useZoomActive=false;
		//useZoomLast=false;
		useRedline=false;	
	}
	
	if (!aimsBufferPresent) {
		useBuffer=false;
	}
	if (!aimsQueryPresent) {
		aimsBufferPresent=false;
		useQuery=false;
		useFind=false;
		useBuffer=false;
		useStoredQuery=false;
	}
	if (!aimsSelectPresent) {
		aimsQueryPresent=false;
		aimsBufferPresent=false;
 		useSelect=false;
		useQuery=false;
		useFind=false;
		useBuffer=false;
		useStoredQuery=false;
		useClearSelect=false;
	}
	if (!aimsIdentifyPresent) {
		aimsSelectPresent=false;
		aimsQueryPresent=false;
		aimsBufferPresent=false;
		canQuery=false;
		useIdentify=false;
 		useSelect=false;
		useQuery=false;
		useFind=false;
		useBuffer=false;
		useStoredQuery=false;
		useHyperLink=false;
	}
	if (!aimsGeocodePresent) {
		useGeocode=false;
		useReverseGeocode=false;
	}
	if (!aimsPrintPresent) {
		usePrint=false;
	}
	if (!aimsOptionsPresent) {

		allowOptions=false;


	}
	if ((aimsXMLPresent) && (aimsMapPresent)) {
		if (aimsClickPresent) clickFunction("zoomin");
		//if (parent.ToolFrame!=null) parent.ToolFrame.document.location="toolbar.htm";
		startMap();
	} else {





		alert("Unable to load one of the following Javascript Libraries:\naimsCommon.js\naimsXML.js\naimsMap.js");
	}
	//alert(parent.MapFrame.useZoomIn);
}



