// ArcIMSparam.js
// javascript file with parameters specific to calling page

//***************************************************************************
//*			parameters File for HTML Template		    *
//***************************************************************************

	// get machine name
	var hostName = document.location.host;   
	// common portion of url
	var esriBlurb = "/servlet/com.esri.esrimap.Esrimap?ServiceName="
	// make URL for getting mapservice catalog
	var catURL = "http://" + hostName + esriBlurb + "catalog";
	// make prefix for URL
	var serverURL  = "http://" + hostName + esriBlurb;

//*********************************************************************
//    *			parameters set by Designer			                     *
//*********************************************************************

//**********Dev Server 092706**********//
//var imsURL = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=erm";
//var imsOVURL = "http://" + hostName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=overview";
	
//**********Public Test Server 092706**********//
	var imsURL = "http://" + hostName + "/resource-app/resource?ServiceName=erm";	
	var imsOVURL = "http://" + hostName + "/resource-app/resource?ServiceName=overview";

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 = false;
var hasTOC = true;
var useModeFrame = true;

//initial map extent
var startLeft = 104000;
var startRight = 779900;
var startTop = 4998000;
var startBottom = 4470500;

//maximum map extent
var limitLeft = 104000;
var limitRight = 779900;
var limitTop = 4998000;
var limitBottom = 4470500;

var zoomToPointRadius = 400;
var usePan=true;
// kmp 07/30 For Recenter Tool
var useRecenter=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=true;
var useStoredQuery=false;
var useClearSelect=true;
var usePrint=true;
var useGeoNetwork=false;
var useBuffer=true;
var useExtract=false;

var MapUnits = "Meters";
var ScaleBarUnits = "Miles";

// End of Designer set parameters

var useHyperLink=true;
var useHyperLinkAny=false;
var useIdentifyAll=true;
var useBufferShape=false; 
var hasToolBarOnLayer=false;

	// useHyperLink takes priority - both cannot be true
if (useHyperLink) useHyperLinkAny=false;

	// useIdentify takes priority - both cannot be true
if (useIdentify) useIdentifyAll=true;

	// allow debugging
var setDebug=true;

/**************************************
* 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 = 85/100;
//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 = 25/1000;
// margin margin factor for zooming in on selected points - based on full extent. . . margin will be selectPointMargin * fullWidth or fullHeight
var selectPointMargin = 25/10000

// show the scale factor
var showScalePercent=true;
// display coords in status line
var showXYs=true;

// Have ArcXML responses URL encoded? Will not work with multi-byte characters
var doURLencode = false;

//variables for MapDrawing
	// North Arrow
var drawNorthArrow = true;
var NorthArrowType = "6";
var NorthArrowSize = "15";
var NorthArrowCoords = "25 55";
var NorthArrowAngle = "0";
	// Scale Bar
var drawScaleBar = true;
	// MapUnits=DEGREES,FEET,METERS
	// can MapUnits be changed by user?
var setMapUnits=false;
	// 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 = "14";
var ScaleBarWidth = "7";
var ScaleBarPrecision = 2;
var numDecimals = ScaleBarPrecision;
	// Copyright blurb
var drawCopyright = true;
var CopyrightFont = "Arial";
var CopyrightStyle = "Normal";
var CopyrightSize = "11";
var CopyrightCoords = "20 30";
var CopyrightColor = "0,0,0";
var CopyrightBackground = "False";
var CopyrightBGColor = "255,255,255";
var CopyrightGlow = "true";
var CopyrightGlowColor = "255,255,255";
var CopyrightText = "Disclaimer: This map does not show all natural resources regulated by NYS DEC, or for which permits";
	// Copyright blurb 2
var drawCopyright2 = true;
var CopyrightFont2 = "Arial";
var CopyrightStyle2 = "Normal";
var CopyrightSize2 = "11";
var CopyrightCoords2 = "20 15";
var CopyrightColor2 = "0,0,0";
var CopyrightBackground2 = "False";
var CopyrightBGColor2 = "255,255,255";
var CopyrightGlow2 = "true";
var CopyrightGlowColor2 = "255,255,255";
var CopyrightText2 = "from NYS DEC may be required. Please contact your DEC Regional office for more information.";

	// 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;

// map image background transparent? - requires gif or png8 types
var mapTransparent=false;

// setup test for Nav 4.0
var isIE = false;
var isNav = (navigator.appName.indexOf("Netscape")>=0);
var isNav4 = false;
var isIE4 = false;
var is5up = false;

//alert(navigator.appVersion);
if (isNav) {
	if (parseFloat(navigator.appVersion)<5) {
		isNav4=true;
		//alert("Netscape 4.x or older");
	} else {
		is5up = true;
	}
} else {
	isIE4=true;
	isIE=true;
	if (navigator.appVersion.indexOf("MSIE 5")>0) {
		isIE4 = false;
		is5up = true;
		//alert("IE5");
	}
}	
		
/**************************************
* Extended Map parameters
**************************************/

// variables for ovmap offset
var ovHspc = 10;
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;

// variables for using individual components
var useTextFrame=true;
// use external window for dialogs
var useExternalWindow=true;

// colors for tables 
var textFrameBackColor="#0066CC";
var tableBackColor="White";
var textFrameTextColor="Black";
var textFrameLinkColor="Blue";
var textFrameFormColor="#0066CC";

// 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 = false;

// will the LayerList show all layers, not just those available at current scale
var listAllLayers = false;

// toggle the check of non-listing of layers in LayerList and Legend
// if true, noListLayer array must have an element defined for each layer
var hideLayersFromList = true;

// layers that will be listed in the LayerList or Legend
	// Note: This does not affect map display
var noListLayer = new Array();
	noListLayer[0] = false;	   	// Classified Streams
	noListLayer[1] = true;		 	// Classified Streams
	noListLayer[2] = true;		 	// Geologically Unique Features
	noListLayer[3] = false;	   	// Classified Ponds 
	noListLayer[4] = true;		 	// Classified Ponds
	noListLayer[5] = false;			// Wetland Polygons
	noListLayer[6] = true;			// Wetland Polygons
	noListLayer[7] = true;			// Rare Plants and Animals
	noListLayer[8] = false;			// Rare Plants and Animals
	noListLayer[9] = false;		  // Significant Natural Communities Buffered	
	noListLayer[10] = true;			// Significant Natural Communities	
	noListLayer[11] = true;			// Natural Communities Nearby
	noListLayer[12] = true;			// Old or Potential Records	
	noListLayer[13] = true;			// Zip Codes
	noListLayer[14] = false;
	noListLayer[15] = true;
	noListLayer[16] = true;
	noListLayer[17] = true; 
	noListLayer[18] = true;
	noListLayer[19] = true;
	noListLayer[20] = false;
	noListLayer[21] = false;	
	noListLayer[22] = true; 
	noListLayer[23] = false;
	noListLayer[24] = 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=false;
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,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;

// 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]="#SHAPE#";   // Classified Streams
selFieldList[1]="SDEADMIN.DOW_NHD_WTRCLS_LINE.PARTITEM SDEADMIN.DOW_NHD_WTRCLS_LINE.STANDARD SDEADMIN.DOW_NHD_WTRCLS_LINE.CLASSIFICA #SHAPE#";   // Classified Streams
selFieldList[2]="SDEADMIN.DEP_UNIQUEGEOLOGICFEATURES.NAME SDEADMIN.DEP_UNIQUEGEOLOGICFEATURES.TYPE SDEADMIN.DEP_UNIQUEGEOLOGICFEATURES.COUNTY SDEADMIN.DEP_UNIQUEGEOLOGICFEATURES.FEATURES";		// Geologically Unique Features
selFieldList[3]="#SHAPE#";		// Classified Ponds
selFieldList[4]="SDEADMIN.DOW_NHD_WTRCLS_POLY.PARTITEM SDEADMIN.DOW_NHD_WTRCLS_POLY.STANDARD SDEADMIN.DOW_NHD_WTRCLS_POLY.CLASSIFICA #SHAPE#";						// Classified Ponds     
selFieldList[5]="#SHAPE#";		// Wetland Polygons
selFieldList[6]="SDEADMIN.DFW_REGUWET_BUFFERED.WETID SDEADMIN.DFW_REGUWET_BUFFEREDCLASS SDEADMIN.DFW_REGUWET_BUFFEREDSIZE_ #SHAPE#";						// Wetland Polygons     
selFieldList[7]="#SHAPE#";	// Rare Plants and Animals
selFieldList[8]="AIMS.DFW_RARE_PLANTS_ANIMALS_UNION.KEY_2 #SHAPE#";	// Rare Plants and Animals 
selFieldList[9]="#SHAPE#";	// Significant Natural Communities Buffered
selFieldList[10]="SDEADMIN.DFW_COMMUNITIES_ACTUAL.SCIEN_NAME SDEADMIN.DFW_COMMUNITIES_ACTUAL.SURVEYSITE SDEADMIN.DFW_COMMUNITIES_ACTUAL.SYSTEM #SHAPE#";	// Significant Natural Communities
selFieldList[11]="SDEADMIN.DFW_COMMUNITIES_NEARBY.FIRST_SCIE SDEADMIN.DFW_COMMUNITIES_NEARBY.FIRST_SURV SDEADMIN.DFW_COMMUNITIES_NEARBY.FIRST_SYST #SHAPE#";	// Natural Communities Nearby
selFieldList[12]="AIMS.DFW_OLD_RECORDS.COMMONNAME AIMS.DFW_OLD_RECORDS.SCIEN_NAME AIMS.DFW_OLD_RECORDS.LAST_OBS AIMS.DFW_OLD_RECORDS.SURVEYSITE AIMS.DFW_OLD_RECORDS.GEN_DESC_1 AIMS.DFW_OLD_RECORDS.ELEM_GROUP AIMS.DFW_OLD_RECORDS.NY_LISTED #SHAPE#";	// Old or Potential Records
selFieldList[13]="AIMS.ZIPPOLY.ZIP AIMS.ZIPPOLY.NAME AIMS.ZIPPOLY.COUNTY #SHAPE#";		// Zip Codes  
selFieldList[14]="AIMS.INTERSTATES.HIGHWAY1 #SHAPE#";		// Interstate Highways
selFieldList[15]="AIMS.NYSUSPKWY.HIGHWAY1 #SHAPE#";		// State and US highways
selFieldList[16]="AIMS.ALISROADS.FULLSTNAME #SHAPE#";		// Local Streets     
selFieldList[17]="#ALL#";		// Planimetrics
selFieldList[18]="#ALL#";		// DOT Atlas
selFieldList[19]="ARCS.STRMNAME.STREAMNAME #SHAPE#";		//Rivers and Lakes
selFieldList[20]="#ALL#";		// Major Waterbodies
selFieldList[21]="AIMS.ADKBLULN.ADIRONBOU #SHAPE#";		// Adirondack Park Boundary
selFieldList[22]="AIMS.MUN_TWN_VILL_CITY.MUNICIPALI AIMS.MUN_TWN_VILL_CITY.COUNTY #SHAPE#";		// Towns
selFieldList[23]="AIMS.MUN_COUNTY.MUN_CNTY AIMS.MUN_COUNTY.AREA_SQ_MI #SHAPE#";		// Counties
selFieldList[24]="SDEADMIN.DFW_QUADRANGLE24.DOT_QUAD #SHAPE#";		// DOT Quads

var prevActiveLayer = 1;
var ActiveSearchLayer = -1;
var ActiveIDLayer = ActiveLayerIndex;
var searchMode = 0;
var searchZip = '';
var searchTown = '';
var useFieldAlias=true;
var fieldAliasList = new Array();

fieldAliasList[0]="";
fieldAliasList[1]="sdeadmin.dow_nhd_wtrcls_line.PARTITEM:Regulation|sdeadmin.dow_nhd_wtrcls_line.STANDARD:Standard|sdeadmin.dow_nhd_wtrcls_line.CLASSIFICA:Classification";
fieldAliasList[2]="sdeadmin.dep_UniqueGeologicFeatures.NAME:Name|sdeadmin.dep_UniqueGeologicFeatures.TYPE:Type|sdeadmin.dep_UniqueGeologicFeatures.COUNTY:County|sdeadmin.dep_UniqueGeologicFeatures.FEATURES:Description";
fieldAliasList[3]="";
fieldAliasList[4]="sdeadmin.dow_nhd_wtrcls_poly.PARTITEM:Regulation|sdeadmin.dow_nhd_wtrcls_poly.STANDARD:Standard|sdeadmin.dow_nhd_wtrcls_poly.CLASSIFICA:Classification";
fieldAliasList[5]="";
fieldAliasList[6]="sdeadmin.dfw_reguwet_buffered.WETID:Wetland ID|sdeadmin.dfw_reguwet_buffered.CLASS:Wetland Class|sdeadmin.dfw_reguwet_buffered.SIZE_:Wetland Size (Acres)";
fieldAliasList[7]="";
fieldAliasList[8]="aims.dfw_rare_plants_animals_union.KEY_2:This location is in the vicinity of one or more &#58; ";
fieldAliasList[9]="";
fieldAliasList[10]="sdeadmin.dfw_communities_actual.SCIEN_NAME:Natural Community Name|sdeadmin.dfw_communities_actual.SURVEYSITE:Location|sdeadmin.dfw_communities_actual.SYSTEM:Ecological System";
fieldAliasList[11]="sdeadmin.dfw_communities_nearby.FIRST_SCIE:Natural Community Name|sdeadmin.dfw_communities_nearby.FIRST_SURV:Location|sdeadmin.dfw_communities_nearby.FIRST_SYST:Ecological System";
fieldAliasList[12]="aims.dfw_old_records.COMMONNAME:Common Name|aims.dfw_old_records.SCIEN_NAME:Scientific Name|aims.dfw_old_records.LAST_OBS:Date Last Documented|aims.dfw_old_records.SURVEYSITE:Location|aims.dfw_old_records.GEN_DESC_1:Habitat Where Last Seen|aims.dfw_old_records.ELEM_GROUP:Animal, Plant, or other|aims.dfw_old_records.NY_LISTED:NYS Protected Status";
fieldAliasList[13]="aims.zippoly.ZIP:ZIP Code|aims.zippoly.NAME:ZIP Name|aims.zippoly.COUNTY:County";
fieldAliasList[14]="aims.interstates.HIGHWAY1:Highway";
fieldAliasList[15]="aims.nysuspkwy.HIGHWAY1:Name";
fieldAliasList[16]="aims.alisroads.FULLSTNAME:Street Name";
fieldAliasList[17]="";
fieldAliasList[18]="";
fieldAliasList[19]="arcs.strmname.STREAMNAME:Name";
fieldAliasList[20]="";
fieldAliasList[21]="aims.adkbluln.adironbou:The point you clicked on is within the Adirondack Park. For locations of State-Regulated Freshwater Wetlands within the Adirondack Park, please contact the Adirondack Park Agency";
fieldAliasList[22]="aims.mun_twn_vill_city.MUNICIPALI:Town or City Name|aims.mun_twn_vill_city.COUNTY:County";
fieldAliasList[23]="aims.mun_county.MUN_CNTY:County|aims.mun_county.AREA_SQ_MI:Area (Mile<sup>2</sup>) ";
fieldAliasList[24]="sdeadmin.dfw_quadrangle24.DOT_QUAD:USGS Quadrangle Name ";

// Hide the ID field display? The ID Field must be included in field list, but we don't have to show it.   

/// This variable didn't work in this app as the #ID# field shows up as #ObjectId# when returned. 
/// Excluding the #ID# field from the selFieldList array keeps the field from appearing in returned tables.
/// - 05/31/07 - GDC
var hideIDFieldData = true;

// Hide the shape field display? The Shape Field must be included in field list, but we don't have to show it.
var hideShapeFieldData = true;

// 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
var hyperLinkPrefix = new Array();  // prefix (if any) to place before field value to make hyperlink url
var hyperLinkSuffix = new Array();  // suffix (if any) to place after field value to make hyperlink url

hyperLinkLayers[0] = "";
hyperLinkFields[0] = "";
hyperLinkPrefix[0] = "";
hyperLinkSuffix[0] = "";

// 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=300;
// for ID All - List all visible layers in response - default is false
	// if false only visible layers with idenitified features written to table
	// if true the names of all visible layers will be diplayed even if no features returned
var listAllLayersInIDAll = false;

// number of data samples retrieved for query form
var numberDataSamples = 50;

/**************************************
* Legend parameters - aimsLegend.js
**************************************/

// legend map size
var legWidth=170;
var legHeight=600;
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>';
*/

/**************************************
* Geocode parameters - aimsGeocode.js
**************************************/

// maximum geocode candidates returned - default = 20
var maxGeocodeCandidates=1;
// 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;
	//ovImageVar = parent.OverviewFrame.document.ovImage;
	
	debugOn = 0;
	//debugOn = 4;
	
	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;*/
	
	//kmp
	//if (parent.TOC.ActvLayer==null) hasTOC = false;
	if (parent.TOC.MapLayers==null) hasTOC = false;
	//if (parent.TOCFrame==null) hasTOC = false;
	if (parent.ModeFrame==null) useModeFrame = false;
	
	if (isIE)	{
		if (hasLayer("theTop")) document.all.theTop.style.cursor = "crosshair";
		if (hasOVMap) ovImageVar.style.cursor = "hand";
	}
		
	if (hasOVMap) {
		// size of ov map image
		i2Width = parseInt(ovImageVar.width);
		i2Height = parseInt(ovImageVar.height);
		forceNewOVMap = false;
		// 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);
	checkCoords();
	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=false;
		useHyperLinkAny=false;
		useIdentifyAll=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(msgList[0]);
	}
}



