/*
 *
 * This establishes a number of constants used for configuration of the application
 *
 * Many of these can be over-ridden in the Mapbook. Some cannot as they are used to initalize the interface.
 * Example:
 * <mapbook>
 *	<interface>
 *		<param name="BLANK_IMAGE" value="shared/images/my_blank.gif"/>
 *		<param name="MAP_GROUND_UNITS" value="FT"/>
 *	</interface>
 *	...
 * </mapbook>
 *
 */

/*
 * Application Configuration Location
 */

var MAPBOOK_FILE = 'statedemo.xml'; /* This is the default mapbook! This setting can be overridden by setting the mapbook= variable in the URL */

/* This sets the "startup" view for the application
 * commonly expressed as min-x,min-y,max-x,max-y
 */
var INITIAL_VIEW = '189783.560000,4816309.330000,761653.524114,5472346.500000';

/* This populates and "Jump To:" type boxes */
var VIEWS = {
	'Jump To:' : {
		'State' : '189783.560000,4816309.330000,761653.524114,5472346.500000',
		'Anoka County' : '498550.871588792,4986926.43635412,459784.705034088,5029161.76057812'
	}
};
/*
 * MapServer Location
 */

var MAPSERVER_MAPFILE_ROOT = '/ms4w/apps/geomoose/maps_statedemo/';	/* Root location of mapfiles */
var MAPSERVER_ROOT = '/cgi-bin/mapserv.exe';
var MAPSERVER_IMAGE_URL = MAPSERVER_ROOT+'?map=%MAPFILE%&mapext=%EXTENTS%&mapsize=%SIZE%&mode=%MODE%';
var MAPSERVER_DATA_URL = MAPSERVER_ROOT+'?map=%MAPFILE%&mapext=%EXTENTS%&mapsize=%SIZE%&mode=nquery&searchmap=true';
var MAPSERVER_LEGEND_URL = MAPSERVER_ROOT+'?map=%MAPFILE%&mapext=%EXTENTS%&mapsize=%SIZE%&mode=legend';

var POPUPS_TRIGGER_CHANGETOOL = false;	/* Controls whether the "Map Tips" can be used simutaneously with other tools */
var MAP_POPUPS_ENABLED = true;	/* Controls whether the Map will render the "Map Tip"s aka Popups */
var MAP_ASSUME_DATA = false;	/* This tells the map whether to read data from a layer if the 'data' attribute is unset for a 'map' tag */
var MAP_LEGENDS_ENABLED = true; /* Controls whether the Map will load Legends */
var MAP_ZOOMIN_STYLE = 'blank';	/* Set to 'scale','clip', 'none', or 'auto' to change the behaviour for Zooming In 
				 * 'auto' setting will make it 'clip' style for IE6 and 'scale' for anyone else.
				 * 'scale' will scale the image similiar to that for the Dynamic Zoom
				 * 'clip' will clip the window the the zoome box.
				 * 'none' will do nothing.
				 * 'blank' will clear out the image with BLANK_IMAGE.
				 */
var MAP_TIMESTAMP_REQ = true;	/* When set true the Map will timestamp layers.  The prevents images from being cached by the browser. */
var MAP_NAVIGATION_DELAY = 500;
var OPACITY_CONTROLS = 'full';/* Set to 'none', 'prompt', 'full', or 'auto' to changethe behaviour for the Opacity Controls
				 * 'auto' settings will force 'prompt' for those using IE6 and allows 'full' opacity control for all others.
				 * This effects both the Map Object (where opacity is rendered) and the Visible Layers Object (where the controls lay)
				 */

var MAP_DEBUG_LAYERS = false;	/* When set true, GeoMOOSE will query each layer
				 * to see if it returns an image
				 */

/* Prompt Message to display for when OPACITY_CONTROLS is set to "Prompt" */
var OPACITY_CONTROLS_DISABLED_MESSAGE = "Opacity controls have been disabled.\nClick 'Enable Opacity Controls' to enable them.";
var OPACITY_CONTROLS_ENABLE_WARNING = "Opacity controls can cause performance problems on older hardware with IE6 and earlier.\nWould you still like to enable them?";

var MAP_IE_SCALE_STYLE_SWITCH = 6;	/* Minimum IE Version for 'auto' to switch to using scale mode 
					 * Switch this to '100' if you want to disable Scale-style zoom in for all versions of IE.
					*/

var MAP_DYNAMIC_ZOOM = true;	/* Enable/Disable the Mouse Zoom Tool 
				 * This is here because it's image scaling behavior is controlled separately from the rest of the zoom tools.
				*/
var MAP_FADE_EFFECTS = !true;	/* Fade Effects Control
				 * When MAP_FADE_EFFECTS is set to true and MAP_FADE_EFFECTS_DURATION is greater than 0
				 * new map images will appear to "fade" in.
				 */
var MAP_FADE_EFFECTS_DURATION = 500;	/* This is in milliseconds and refers to the duration of the effect not the step value */
var MAP_MAPBOOK_ORDER = true;	/* Enable/Disable whether the order in the mapbook is honored 
				 * If the MAP_MAPBOOK_ORDER is set to false then layers will appear in the order in which they are added
				 * with newer layers being placed on top of other layers (unless the zindex attribute is set to "-1" then
				 * the map-layer will be placed on the bottom of the other layers).
				 * If the MAP_MAPBOOK_ORDER is set to true then layers will appear in the order in which they appear in the 
				 * mapbook.
				 */

/* 
 * THIS WILL BE DEPRECIATED IN FAVOR OF SCALE BAR ON THE MAP!
 * You can have what-ever CGI you want generate a scale bar
 * only two variables are passed to it:
 *	[SIZE] - The image size of hte map
 *	[EXTENTS] - The extents in "MINX MINY MAXX MAXY" format.
 * To disable the Scalebar, simply set SCALEBAR_CALL to null or ''
 */
/*var SCALEBAR_CALL = '/datasets/ANNOTATION/SAINT_PAUL/PUBLIC_WORKS/GISMO/scalebar.map?mapsize=[SIZE]&mapext=[EXTENTS]&mode=scalebar';*/
/*** THIS WILL BE REMOVED IN RC3 ***/

/*
 * This is the client enforced limit on how many objects it will
 * be willing to process once downloaded.  Setting this rediculously high
 * will the control to be in the mapfiles/server.
 */
var LAYER_MAXIMUM_OBJECTS = 200;

/*
 * Default Image Icons
 */

var BLANK_IMAGE = 'shared/images/blank.gif';

var REMOVE_ICON = 'shared/images/remove.png';
var RELOAD_ICON = 'shared/images/reload.png';
var FADE_ICON = 'shared/images/fade.png';
var UNFADE_ICON = 'shared/images/unfade.png';
var LEGEND_TOGGLE_ICON = 'shared/images/text_linespacing.png';
var SERVICE_DEFAULT_ICON = 'shared/images/tool.png';

var UP_ICON = 'shared/images/arrow_up.png';
var DOWN_ICON = 'shared/images/arrow_down.png';

var META_DEFAULT_ICON = 'shared/images/meta.png';
var HELP_DEFAULT_ICON = 'shared/images/help.png';

/*
 * Three Popup States
 * 1) ACTIVE - The popups the user will see on the map
 * 2) AVAILABLE - The data is loaded but they are not selected by the layer
 * 3) UNAVAILABLE - There is no popup data loaded for that particular layer
 */
var POPUP_ACTIVE_ICON = 'shared/images/flag_green.png';
var POPUP_AVAILABLE_ICON = 'shared/images/flag_yellow.png';
var POPUP_UNAVAILABLE_ICON = 'shared/images/flag_red.png';

var POPUP_MESSAGE = new Array();
POPUP_MESSAGE['PopupsAvailable'] = 'Popups available for this layer.';
POPUP_MESSAGE['PopupsUnavailable'] = 'Popups unavailable for this layer.';
POPUP_MESSAGE['PopupsActive'] = 'Popups for this layer are displayed on the map.';

var POPUP_LAYERCHANGE_CLEAR = true;	/* Clear the old popups when you change layers */

/*
 * Cursor Configuration
 */

var CURSOR_NOTHING = 'default';
var CURSOR_ZOOM_IN = 'url(cursors/zoomin2.cur),auto';
var CURSOR_ZOOM_OUT = 'url(cursors/zoomout2.cur),auto';
var CURSOR_ZOOM_PAN = 'url(cursors/pan.cur),auto';

var CURSOR_POPUPS = 'help';
var CURSOR_DRAW = 'url(cursors/pencil2.cur),auto';
var CURSOR_MEASURE = 'url(cursors/measure2.cur),auto';

/*
 * OpenMNND Specific Configuration
 */
var GEOMOOSE_SKIN = 'blue';	/* Default skin/theme to load */
var HEADER_URL = 'skins/%THEME%/header.html';	/* The header could be fixed, but this default allows it to change with the Theme */
var SIDE_PANEL_RIGHT = true;	/* Sets whether the side panel should be on the right or left side of the screen */
var MENU_SOURCE = 'statedemo_menu.xml';
var MENU_TOGGLE_ICON = 'shared/images/checkmark.gif';

/* Settings for the Map Navigator */
var SHOW_MAP_NAVIGATOR = true;
var EAST_WEST_PERCENTAGE = .25; /* Percentage of the map that they Map Navigator will scroll when clicked */
var NORTH_SOUTH_PERCENTAGE = .25;
var MAP_NAVIGATOR_SCALES = [
	{ 'scale' : 250000, 'label' : 'Full Extent' },
	{ 'scale' : 125000, 'label' : '1:125,000' },
	{ 'scale' : 75000, 'label' : null },
	{ 'scale' : 35000, 'label' : '1:35000 Scale XXX' },
	{ 'scale' : 18000, 'label' : '18,000' },
	{ 'scale' : 9000, 'label' : '1:9000 Scale' }

];

/* Settings for the references map */
var REFERENCE_MAP = true;		/* Turns on/off the reference map */
var REFERENCE_MAP_VISIBLE = true;	/* Toggle visibility of the reference map */
var REFERENCE_MAP_WIDTH = 150;		/* Reference Map Dimensions */
var REFERENCE_MAP_HEIGHT = 100;
var REFERENCE_MAP_TOP = false;		/* Reference Map Location, the reference map can be pinned to one of the four corners of the map */
var REFERENCE_MAP_LEFT = false;
var REFERENCE_MAP_DYNAMIC = false;	/* The reference map can be static (older style) or Dynamic like Google & others (newer style) */
					/* Not fully implemented */
var REFERENCE_MAP_MULTIPLIER = 10;	/* The scale multiplier between the main-map and the reference map */

var GEOMOOSE_TITLE = 'GeoMOOSE'; /* Window Title */
var GEOMOOSE_ORGANIZATION = 'The GeoMOOSE Project'; /* Organization that will be displayed in the footer */

var SHOW_MAP_WIDTH = false;
/*
 * Toolbar Display Options
 */
var TOOLBAR_TEXT = false; /* Toggles whether the Tools show have the title shown */
var TOOLBAR_IMAGE = true; /* Toggles whether the Tools should have icons */
var TOOLS_SHOW_AS_SELECTED = false; /* Toggles Whether the Tools anchors have the .className is set to selected */
var TOOLS_DIVIDE_PANEL = false; /* This makes the upper toolbar defined only on-load and the tool-panel dynamic if set true, otherwise both are dynamic */
var TOOLS_SHOW_REMOVE = false;

/*
 * Unit Specification
 */

var MAP_GROUND_UNITS = "M"; // "IN", "FT", "M", "MI" /* Sets the type of Ground Units */
var MAP_COORDINATE_DISPLAY = {
	groundUnits : true,
	lonLat : true /* Will only display if MAP_COORDINATE_SYSTEM is set */
};

var MAP_SCALE_DISPLAY = true;	/* Toggles whether the scale box should be shown */
var MAP_COORDINATE_SYSTEM = 'UTM-15'; /* Sets the Map Coordinate system, for coordinate reprojection to Lat/Long */

/* To use MN County Coordinates uncomment the line below.
 * Replace 'RAMSEY' with your county name in ALLCAPS
 *  MAP_COORDINATE_SYSTEM = 'MNCOUNTY-DAKOTA';
 */



var MEASURE_LENGTH_UNITS = "FT"; // "IN", "FT", "M", "MI"
var MEASURE_AREA_UNITS = "SQACRE"; // "SQIN", "SQFT", "SQM", "SQMI", "SQACRE" ** "SQACRE" is acres, not "Square Acres"
var MAP_PIXELS_PER_INCH = 72; /* Sets the scrreen DPI for scale calculations */

var ZOOM_BOX_SHAPE = 'box'; ///'scalebox' /* The rubber-band zoom in/out can be forced to be displayed using the aspect ratio of the map */


/*
 * These set the scale-settings
 * This is an associative array, the Key is displayed as the title and the Value is the Scale
 */
var SCALEBOX_JUMPER_INCREMENTS = new Array();
SCALEBOX_JUMPER_INCREMENTS['1:1000'] = '1000';
SCALEBOX_JUMPER_INCREMENTS['1:2000'] = '2000';
SCALEBOX_JUMPER_INCREMENTS['1:5000'] = '5000';
SCALEBOX_JUMPER_INCREMENTS['1:8000'] = '8000';
SCALEBOX_JUMPER_INCREMENTS['1:20000'] = '20000';
SCALEBOX_JUMPER_INCREMENTS['1:50000'] = '50000';
SCALEBOX_JUMPER_INCREMENTS['1:180000'] = '180000';


var SERVICE_OVERLOAD_MESSAGE = 'Service returned too many objects! Narrow your search!';
var SERVICE_RETURN_NEW_WINDOW = false;/* Sets whether results will be rendered in a new window or in the control panel. */ 
var SERVICE_SHOW_WARNINGS = !true; /* Default empty results checking can be turned off */

/*
 * This controls the visibility and names of the tabs as they are displayed
 * in the side-panel
 */
var TABS_SHOW_PANEL = true;			/* This sets whether or not to show the Tabs Panel at the top of the Control Panel */
var TABS_CATALOG_NAME = 'Map Layers';		/* These are some default titles for the different panels/tabs */
var TABS_LEGENDS_NAME = 'Legends & Controls';
var TABS_TOOLS_NAME = 'Tools';
var TABS_RESULTS_NAME = 'Information';

var TOOLS_SHOW_TAB = false; /* Defines whether to show the Tools Tab */

/*
 * These two arrays define the titles and id's for the tabs
 * They can be re-arranged in any order.
 * The tab TITLES order is directly relayed to the TABS_IDS order,
 * if 'Catalog' is in TABS_TITLES[0] and 'div_my_catalog' is in TABS_IDS[0],
 * then when 'Catalog' is clicked 'div_my_catalog' will be set to visible.
 */
var TABS_TITLES = new Array();
var TABS_IDS = new Array();
if(TOOLS_SHOW_TAB) {
	TABS_TITLES = [TABS_CATALOG_NAME,TABS_TOOLS_NAME,TABS_RESULTS_NAME];
	TABS_IDS = ['content_map_layers', 'content_tools_list', 'content_results_form'];
} else {
	TABS_TITLES = [TABS_CATALOG_NAME,TABS_RESULTS_NAME];
	TABS_IDS = ['content_map_layers', 'content_results_form'];
}


/*
 * Map Popup Functions
 * These are used to dynamically  build the popup menu for the menu.
 * The title for the menu is the array key and the URL is in the array value.
 */
var MAP_POPUP_MENU = true;	/* Sets whether the Map Popup Menu is available */
var MAP_POPUP_FUNCTIONS = new Array();
MAP_POPUP_FUNCTIONS['Zoom In'] = "javascript:Map.recenterOnZoomPoint(.7)";
MAP_POPUP_FUNCTIONS['Zoom Out'] = "javascript:Map.recenterOnZoomPoint(1.2)";
MAP_POPUP_FUNCTIONS['Recenter Here'] = "javascript:Map.recenterOnZoomPoint(1)";

/*
 * Loading Bar Message and Image
 * You can change the 'Loading...' default message to pretty much anything you want.
 * This is more useful for internationalization than anything else.
 */
var LOADING_MESSAGE = 'Loading...';
var LOADING_IMAGE = './shared/images/waiting.gif';
var LOADING_TIMEOUT = 15000; /* In milliseconds, this is how long the loading box will wait until it thinks the layer is broken */

/*
 * Controls for the TreeView,
 * if desired the legends and layer controls can be displayed in the TreeView
 */
var TREEVIEW_SHOW_CONTROLS = true;
var TREEVIEW_LEGENDS = {
	enabled: true,		/* Sets whether the legends are shown in the tree view */
	visible: false		/* sets whether the legends are visible by default */
};

/* 
 * If a layer is out of range, then the checkbox will be disabled
 */
var TREEVIEW_CHECKBOX_RANGE_VISIBILITY = true;

/*
 * TREEVIEW_CONTROLS is a way to do fine-grained adjustments when 
 *	TREEVIEW_SHOW_CONTROLS is set to true.
 */
var TREEVIEW_CONTROLS = {
	up: false,
	down: false,
	fade: true,
	unfade: true,
	refresh: false,
	legendToggle: true
};

var TREEVIEW_BREAK_FOR_CONTROLS = false; 	/* If true, controls go on a line AFTER the layer title
							if false, they go on the same line. */

var MAP_LOAD_LEGENDS = false;
/*
 * This array is used to load custom Javascripts into the interface
 * If there is a custom application launching function you need this is the place to add those functions.
 */
var CUSTOM_SCRIPTS = new Array();
CUSTOM_SCRIPTS[0] = './custom/synergen.js';
CUSTOM_SCRIPTS[1] = './custom/validate.js';

var VALIDATE_FUNCTIONS = new Array();
VALIDATE_FUNCTIONS['INTEGER'] = 'validateInteger'; /* This is in ./custom/validate.js */

var SERVICES_INVALID_BACKGROUND = '#F00';
var SERVICES_INVALID_MESSAGE = 'Cannot call service, there is still invalid input (check inputs whose backgrounds are red)!';

/*
 * Messages for when one is creating new shapes
 */
var SHAPE_MESSAGES = new Array();
SHAPE_MESSAGES['poly'] = 'Select a freehand polygon. Press down with the left mouse button and drag it around. Let up to finish drawing.';
SHAPE_MESSAGES['point'] = 'Click a point on the map.';
SHAPE_MESSAGES['measurearea'] = 'Click the corners of the polygon. Double-click to finish the polygon.';
SHAPE_MESSAGES['measureline'] = 'Click the points of the line. Double-click to finish the line.';
SHAPE_MESSAGES['box'] = 'Hold the mouse down and drag to draw a box.  Releasing the mouse finishes the line.';

/*
 * When using ProcessURLString() delim and sep (pointdelim) are optional
 * These are the defaults it will use as delimiters.
 * ..DELIM will be used to divide the X and Y of points and items in lists (like Layer titles) 
 * ..POINT_DELIM will be used to divide points
 */
var URL_DEFAULT_DELIM = ' ';
var URL_DEFAULT_POINT_DELIM = ',';

/*
 * XSL Definition Files
 */

var XSL_RESULTS = 'xsl/results.xsl';
var XSL_IMAGEMAP = 'xsl/imagemap.xsl';

/*
 * Min/Maxing capability for the Map as a whole.
 * Setting the minscale="" and mapscale="" will set local min/max displays for those layers.
 */

var MAP_MINSCALE = 100;
var MAP_MAXSCALE = 10000000;

/*
 * Namespacing for the HTML returns
 */
var MAPBOOK_NAMESPACE_URI = 'http://geomoose.org/';
var MAPBOOK_NAMESPACE_PREFIX = 'moose';

/*
 * Set this to show a "waiting message"
 * References a DIV
 */
var SERVICE_WAITING_DIV = 'WaitingMessage';
