// ArcIMSparam.js
// 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";

//var catURL = "http://" + hostName + "/Columbia/ims?ServiceName=catalog";

// make prefix for URL
var serverURL  = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=";

//var serverURL  = "http://" + hostName + "/Columbia/ims?ServiceName=";

//*********************************************************************
//*			parameters set by Designer			                     *
//*********************************************************************
var imsURL = '/servlet/com.esri.esrimap.Esrimap?ServiceName=ColumbiaCo';
var imsOVURL =  '/servlet/com.esri.esrimap.Esrimap?ServiceName=ColumbiaCoOV';
var imsQueryURL = '';
var imsGeocodeURL = '';


// variables for setting component colors

var mapBackColor = '255,255,255';
var ovBoxColor = '#ff0000';
var ovBoxSize = 3;
var zoomBoxColor = '#ff0000';

// variables for using individual components

var hasOVMap = true;
var hasTOC = true;
var useModeFrame = true;
var showDrillID = true;
//initial map extent
var startLeft = 451584.145707916;
var startRight = 658689.106830306;
var startTop = 432133.195584;
var startBottom = 299843.291658549;
//maximum map extent
var limitLeft = 451584.145707916;
var limitRight = 658689.106830306;
var limitTop = 432133.195584;
var limitBottom = 299843.291658549;

//Web site path
var formFilePath = "D:/ArcIMS/Website/ColumbiaCo"
var usePan=true;
var usePanNorth=false;
var usePanWest=false;
var usePanEast=false;
var usePanSouth=false;
var useZoomIn=true;
var useZoomOut=true;
var useFullExtent=true;
var useZoomActive=true;
var useZoomLast=true;
var useIdentify=true;
var useMeasure=true;
var useSetUnits=true;
var useSelect=true;
var useQuery=true;
var useFind=true;
var useGeocode=false;
var useStoredQuery=false;
var useClearSelect=true;
var usePrint=true;
var useBuffer=true;
var useExtract=false;

var MapUnits = "Feet";
var ScaleBarUnits = "Feet";

var lTaxKey="";
var autoRefresh=true;


// End of Designer set parameters

var useHyperLink=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.5;
// margin margin factor for zooming in on selected points - based on full extent. . . margin will be selectPointMargin * fullWidth or fullHeight
var selectPointMargin = 0.5;

// show the scale factor
var showScalePercent=true;
// display coords in status line
var showXYs=true;

//variables for MapDrawing
	// North Arrow
var drawNorthArrow = false;
var NorthArrowType = "3";
var NorthArrowSize = "25";
var NorthArrowCoords = "75 43";
var NorthArrowAngle = "0";
	// Scale Bar
var drawScaleBar = true;
	// MapUnits=DEGREES,FEET,METERS
	// can MapUnits be changed by user?
var setMapUnits=true;
	// ScaleBarUnits=KILOMETERS,METERS,MILES,FEET
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 = "15";
var ScaleBarWidth = "6";
var ScaleBarPrecision = 4;
var numDecimals = ScaleBarPrecision;
	// Copyright blurb
var drawCopyright = true;
var CopyrightFont = "Arial";
var CopyrightStyle = "Bold";
var CopyrightSize = "11";
var CopyrightCoords = "4 4";
var CopyrightColor = "0,0,0";
var CopyrightBackground = "False";
var CopyrightBGColor = "255,255,255";
var CopyrightGlow = "true";
var CopyrightGlowColor = "255,255,255";
var CopyrightText = "Columbia County Land Information Department (2004)";
	// Mode on Map
var drawModeOnMap = false;
var modeRefreshMap = false;
var modeMapColor = "White";
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 (navigator.appVersion.search("5.0") == -1)
   		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=0;
var dblayer = 0;
var NumGroups=8;

var Groups=["Tax Parcels","Transportation","Political Features","Emergency Services","Natural Environment","Recreation","Conservation Themes","PLSS","Orthophotography"];

var TaxParcels = [0,1,"Parcels"];
var Transportation = [2,3,"Rail Road"];
var PoliticalFeatures = [4,8,"Municipal Boundaries"];
var EmergencyServices = [9,10,"EMS Response Districts"];
var NaturalEnvironment = [11,14,"Water Body (Lines)"];
var Recreation = [15,17,"Ice Age National Scenic Trail"];
var ConservationThemes = [18,22,"Hydric Soils (NRCS Rating)"];
var PLSS = [23,27,"HARN GPS Points"];
var Orthophotography = [28,31,"2007 Photography (1 foot pixel)"];


// variables for using individual components
var useTextFrame=true;
// use external window for dialogs
var useExternalWindow=false;

// colors for tables 
var textFrameBackColor="images/ColumbiaBack.png";
var tableBackColor="images/ColumbiaBack.png";
var textFrameTextColor="White";
var textFrameLinkColor="Gray";
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 = "black";
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
var pixelTolerance=5;
// color of selected features in decimal RGB format
var selectColor="255,255,0";
// color of highlighted feature in decimal RGB format
var highlightColor="255,200,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;

// fields to be returned in identify/selection/query request. . . #ALL#=all fields
// var selectFields= "#ALL#";
var selectFields= "#ID# #SHAPE#";
// swap out the list of returned fields? 
//If true, a list must be defined in selFieldList[n] for each layer to update selectFields
var swapSelectFields=true;
// array for each layer's returned fields if swapSelectFields=true
var selFieldList = new Array();
// sample set for world - if not #ALL#, id and shape fields required. Separate with a space
selFieldList[0]=" GIS_PIN #ID# #SHAPE#";
selFieldList[1]=" NAME_FIDLA PLAT #ID# #SHAPE#";
selFieldList[2]=" EXISTING #ID# #SHAPE#";
selFieldList[3]=" LABEL ROUTE_CATE #ID# #SHAPE#";
selFieldList[4]=" MCD MCD_NAME MCD_TYPE #ID# #SHAPE#";
selFieldList[5]=" SCHOOL_DIS DIST_NUM TOTAL_MILE TOTAL_ACRE #ID# #SHAPE#";
selFieldList[6]=" JVTD2 #ID# #SHAPE#";
selFieldList[7]=" JVTD2 #ID# #SHAPE#";
selFieldList[8]=" JVTD JVTD2 #ID# #SHAPE#";
selFieldList[9]=" EMS_DEP TOTAL_MILE TOTAL_ACRE #ID# #SHAPE#";
selFieldList[10]=" FIRE_DEPT FIRE_HDQRT FIRE_CHIEF FIRE_PHONE FIRE_ADDRE CITY STATE ZIPCODE TOTAL_MILE TOTAL_ACRE #ID# #SHAPE#";
selFieldList[11]=" FEATURE_ID #ID# #SHAPE#";
selFieldList[12]=" FEATURE_ID #ID# #SHAPE#";
selFieldList[13]=" MUNAME MUSYM #ID# #SHAPE#";
selFieldList[14]=" WSHED_ID WSHED_NAME #ID# #SHAPE#";
selFieldList[15]=" SEG_NAME #ID# #SHAPE#";
selFieldList[16]=" LINE_ID CONDITION STATE_COR YEAR_ #ID# #SHAPE#";
selFieldList[17]=" TYPE AGENCY NAME SIZE_ACRES WILDLIFE OTHER_REC HABITAT CONTACT OTHER #ID# #SHAPE#";
selFieldList[18]=" DESC #ID# #SHAPE#";
selFieldList[19]=" DESC #ID# #SHAPE#";
selFieldList[20]=" DESC #ID# #SHAPE#";
selFieldList[21]=" MUSYM DRN_DESC CS_NA PRIMEFL CORN_YIELD ALF_YIELD SOY_YIELD WW_YIELD AG_CORN AG_ALF AG_SOY AG_WW AG_TOTAL #ID# #SHAPE#";
selFieldList[22]=" MUSYM LIMIT CORRECT MAINT MUSPOT COMPIND #ID# #SHAPE#";
selFieldList[23]=" STATION_NO STATION_NA X_COORD_CO Y_COORD_CO X_COORD_ST Y_COORD_ST #ID# #SHAPE#";
selFieldList[24]=" TOWN RANGE #ID# #SHAPE#";
selFieldList[25]=" TOWN RANGE SECTION #ID# #SHAPE#";
selFieldList[26]=" TOWN RANGE SECTION Q_SEC #ID# #SHAPE#";
selFieldList[27]=" TOWN RANGE SECTION Q_SEC QQ_SEC #ID# #SHAPE#";
selFieldList[28]=" #ALL#";
selFieldList[29]=" #ALL#";
selFieldList[30]=" #ALL#";
selFieldList[31]=" #ALL#";



// use the field alias in the data display? 
//If true, a list must be defined in fieldAliasList[n] for each layer defining aliases for those fields needing them
var useFieldAlias=true;
// array for aliases for each layer's returned fields if useFieldAlias=true
var fieldAliasList  = new Array();
// sample set for world - fieldname:alias pairs separated by a bar (|)... if no aliases, use empty string ("")
fieldAliasList[0]="GIS_PIN:Tax Parcel Identification Number";
fieldAliasList[1]="NAME_FIDLA:Official Plat Name|PLAT:Plat Name";
fieldAliasList[2]="EXISTING:Existing";
fieldAliasList[3]="LABEL:Road Name|ROUTE_CATE:Route Category";
fieldAliasList[4]="MCD:Tax District Number|MCD_NAME:Tax District Name|MCD_TYPE:Tax District Type";
fieldAliasList[5]="SCHOOL_DIS:School District|DIST_NUM:District Number|TOTAL_MILE:District Area (Miles Square)|TOTAL_ACRE:District Area (Acres)";
fieldAliasList[6]=" JVTD2:Supervisory District";
fieldAliasList[7]=" JVTD2:Supervisory District";
fieldAliasList[8]=" JVTD:Supervisory District|JVT:Voting Ward";
fieldAliasList[9]="EMS_DEP:EMS District|TOTAL_MILE:District Area (Miles Square)|TOTAL_ACRE:District Area (Acres)";
fieldAliasList[10]="FIRE_DEPT:Fire Department|FIRE_HDQRT:Headquarters|FIRE_CHIEF:Fire Chief|FIRE_PHONE:Phone Number|FIRE_ADDRE:Address|CITY:City|STATE:State|ZIPCODE:Zipcode|TOTAL_MILE:District Area (Miles Square)|TOTAL_ACRE:District Area (Acres)";
fieldAliasList[11]="FEATURE_ID:Feature ID";
fieldAliasList[12]="FEATURE_ID:Feature ID";
fieldAliasList[13]="MUNAME:Soil Type|MUSYM:Soil Type Abbreviation (MUSYM)";
fieldAliasList[14]="WSHED_ID:Watershed ID|WSHED_NAME:Watershed Name";
fieldAliasList[15]="SEG_NAME:Segment Name";
fieldAliasList[16]="LINE_ID:Line Type|CONDITION:Condition|SOURCE:Source";
fieldAliasList[17]="TYPE:Managing Agency|AGENCY:Managing Department|NAME:Name|SIZE_ACRES:Total Acres (if available)|WILDLIFE:Wildlife|OTHER_REC:Other Recreational Opertunities|HABITAT:Habitat|CONTACT:Contact Agency|OTHER:Alias";
fieldAliasList[18]="DESC:Hydric Type";
fieldAliasList[19]="DESC:Farmland Type";
fieldAliasList[20]="DESC:Erodible Land Type";
fieldAliasList[21]="MUSYM:Soil Type Abbreviation (MUSYM)|DRN_DESC:Drainage|CS_NA:Capability Subclass -Natural|PRIMEFL:Farmland Type|CORN_YIELD:Corn Yield (Bu/Acre)|ALF_YIELD:Alfalfa Yield (Tons/Acre)|SOY_YIELD:Soy Yield (Bu/Acre)|WW_YIELD:Winter Wheat Yield (Bu/Acre)|AG_CORN:Agricultural Group Rating -Corn|AG_ALF:Agricultural Group Rating -Alfalfa|AG_SOY:Agricultural Group Rating -Soy|AG_WW:Agricultural Group Rating -Winter Wheat|AG_TOTAL:Agricultural Group Rating -All Listed Crops";
fieldAliasList[22]="MUSYM:Soil Type Abbreviation (MUSYM)|LIMIT:Limitation (for dwelling with basement)|CORRECT:Corrective Measure|MAINT:Maintenance Action|MUSPOT:Group Rating of Building Site Potential|COMPIND:Numeric Rating of Building Site Potential";
fieldAliasList[23]="STATION_NO:Station Number|STATION_NA:Station Name|X_COORD_CO:Northing (Columbia County Coord. -US Survey Foot)|Y_COORD_CO:Easting (Columbia County Coord. -US Survey Foot)|X_COORD_ST:Northing (State Plane Coord. -US Survey Foot)|Y_COORD_ST:Easting (State Plane Coord. -US Survey Foot)";
fieldAliasList[24]="TOWN:Town|RANGE:Range";
fieldAliasList[25]="TOWN:Town|RANGE:Range|SECTION:Section";
fieldAliasList[26]="TOWN:Town|RANGE:Range|SECTION:Section|Q_SEC:Quarter Section";
fieldAliasList[27]="TOWN:Town|RANGE:Range|SECTION:Section|Q_SEC:Quarter Section|QQ_SEC:Quarter-Quarter Section";
fieldAliasList[28]="";
fieldAliasList[29]="";
fieldAliasList[30]="";
fieldAliasList[31]="";





// 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] = "Parcels";
hyperLinkFields[0] = "Common";
// 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=1000;

// number of data samples retrieved for query form
var numberDataSamples = 150;


/**************************************
* Legend parameters - aimsLegend.js
**************************************/

// legend map size
var legWidth=170;
var legHeight=300;
var legFont="Arial";
var legTitle="";

/**************************************
* 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>';
*/

/**************************************
* 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() {
	appDir = getPath(document.location.pathname);
	// global for overview map. . . change if not on same frame as Map
	ovImageVar = document.ovImage;
	debugOn = 0;
	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 (!document.layers)	{
		if (hasLayer("theMap")) document.all.theMap.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;	
	}
	
	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=true;
	}
	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");
	}
}



