/*
 *
 * 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 */

/*
 * Additional Server Tools
 * This will be phased out in RC3! Drawing tools are now defined in the Mapbook!!!
 */
var DRAWING_URL = '/gis/mapscript/cgi-bin/saveDrawing.pl?coords=%COORDS%&shape=%SHAPE%&buffer=%BUFFER%&title=%TITLE%';

/*
 * MapServer Location
 */

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 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 = false; /* 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 = false;	/* 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)
				 */

/* 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 = '';
/*** 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 UNKNOWN_DEFAULT_ICON = 'shared/images/map_info.gif';
var SERVICE_DEFAULT_ICON = 'shared/images/tool.png';
var MAP_DEFAULT_ICON = 'shared/images/map_image_loaded.png';
var VIEW_DEFAULT_ICON = 'shared/images/view.png';

var FOLDER_ICON = 'shared/images/folder.png';
var FOLDER_OPEN_ICON = 'shared/images/open_folder.png';
var MAP_LOADING_ICON ='shared/images/loading.png';
var MAP_DATA_ICON = 'shared/images/map_data_loaded.png';
var MAP_OVERLOAD_ICON = 'shared/images/map_overload.png';
var MAP_ERROR_ICON = 'shared/images/map_error.png';

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 CHECKED_ICON = 'shared/images/map_info.gif';
var UP_ICON = 'shared/images/arrow_up.png';
var DOWN_ICON = 'shared/images/arrow_down.png';

var SLIDE_LEFT = 'shared/images/slide_left.png';
var SLIDE_RIGHT = 'shared/images/slide_right.png';

var META_DEFAULT_ICON = 'shared/images/meta.png';
var HELP_DEFAULT_ICON = 'shared/images/help.png';

/*
 * 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 OPENMNND_SKIN = 'green';	/* 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 = 'statemenu.xml';
var MENU_TOGGLE_ICON = 'shared/images/checkmark.gif';

/* Settings for the Map Navigator */
var SHOW_MAP_NAVIGATOR = false;
var EAST_WEST_PERCENTAGE = .25; /* Percentage of the map that they Map Navigator will scroll when clicked */
var NORTH_SOUTH_PERCENTAGE = .25;
var SLIDER_MIN_SCALE = 100;	/* Map Navigator Minimum/Maximum Scale */
var SLIDER_MAX_SCALE = null;	/* If left undefined the SLIDER_MAX_SCALE will be determined by the default extents */

/* Settings for the references map */
var REFERENCE_MAP = true;		/* Turns on/off 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 = true;	/* The reference map can be static (older style) or Dynamic like Google & others (newer style) */
					/* Not fully implemented */
var REFERENCE_MAP_MULTIPLIER = 16;	/* The scale multiplier between the main-map and the reference map */

var OPENMNND_TITLE = 'GeoMOOSE'; /* Window Title */
var OPENMNND_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 = true; /* Toggles whether to the map coordinates should be shown in the footer. */
var MAP_SCALE_DISPLAY = false;	/* Toggles whether the scale box should be shown */
var MAP_COORDINATE_SYSTEM = 'LATLON'; /* Sets the Map Coordinate system, for coordinate reprojection to Lat/Long */

var MEASURE_LENGTH_UNITS = "FT"; // "IN", "FT", "M", "MI"
var MEASURE_AREA_UNITS = "SQFT"; // "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:6'] = '6';
SCALEBOX_JUMPER_INCREMENTS['1:12'] = '12';
SCALEBOX_JUMPER_INCREMENTS['1:120'] = '120';
SCALEBOX_JUMPER_INCREMENTS['1:1200'] = '1200';
SCALEBOX_JUMPER_INCREMENTS['1:2400'] = '2400';
SCALEBOX_JUMPER_INCREMENTS['1:24000'] = '24000';
SCALEBOX_JUMPER_INCREMENTS['1:120000'] = '120000';


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,SuperTitle];
	TABS_IDS = ['content_map_layers', 'content_tools_list', 'content_results_form', 'my_custom_div'];
} 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 = 30000; /* 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 = false;
var TREEVIEW_SHOW_LEGENDS = true;


/*
 * 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 = 0;
var MAP_MAXSCALE = 3500000;

/*
 * 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';

