/*
 *
 * 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 = 'BlaineMoose.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 = '478127.252837134, 4995667.8566793, 489676.01715961, 5006993.51924282';

/* This populates and "Jump To:" type boxes */
var VIEWS = {
	'Quick Park Finder:' : {
		'Full City': '478127.252837134, 4995667.8566793, 489676.01715961, 5006993.51924282',
		'Airport': '482730, 5000400, 483200, 5000850',
		'Aquatore': '480690, 4997900, 481490, 4998500',
		'Aurelia': '479540, 4997830, 479910, 4998220',
		'Austin': '486710, 4996850, 486900, 4997040',
		'Baseball Complex': '480570, 5003650, 481220, 5004320',
		'Broken Oaks': '482040, 5005170, 482220, 5005320',
		'Carrara East': '482060, 5006060, 482340, 5006340',
		'Carrara West': '481750, 5006280, 481950, 5006480',
		'Centennial Green': '486300, 4999500, 487170, 5000200',
		'Centennial': '488600, 5000670, 488700, 5000770',
		'Cloverleaf': '479760, 4999180, 480190, 4999650',
		'Colony Preserve': '480860, 4999830, 480960, 4999950',
		'Deacons': '482280, 5001990, 482670, 5002390',
		'East Lake': '485400, 5003930, 485800, 5004330',
		'Eastside': '487800, 5001100, 488280, 5001490',
		'Fillmore': '480730, 5001060, 480870, 5001210',
		'Fort Lion': '479250, 5001620, 479380, 5001750',
		'Happy Acres': '479175, 5003540, 479690, 5004100',
		'Hidden Ponds': '480660, 5002700, 480870, 5002920',
		'Ivy Hills': '482160, 5004120, 482460, 5004430',
		'Jaycee': '480490, 5003540, 481130, 5004140',
		'Jefferson': '479880, 5005380, 480270, 5005780',
		'Kane Meadows': '484450, 4997480, 484800, 4997850',
		'Laddie Lake': '480750, 4997210, 481100, 4997560',
		'Lakes Athletic Complex': '482860, 5004100, 483600, 5004860',
		'Lakeside Commons': '484630, 5004030, 485152, 5004575',
		'Lakeside': '481825, 5002815, 482070, 5003065',
		'Little Bit': '480520, 4996930, 480730, 4997160',
		'Little League': '479980, 5002090, 480350, 5002470',
		'Lochness': '487310, 5001930, 488175, 5002830',
		'London': '482760, 5003640, 482905, 5003790',
		'Mary Elizabeth': '481835, 4996970, 482075, 4997220',
		'Meadowbrook': '479940, 5005090, 480230, 5005390',
		'North Oaks West': '484910, 5002220, 485175, 5002500',
		'Northwood': '480340, 5003940, 480733, 5004345',
		'Oak Creek': '480200, 5004150, 480505, 5004440',
		'Olympia': '480730, 4999380, 480830, 4999480',
		'Ostmans': '480950, 5005840, 481330, 5006221',
		'Palmer': '482740, 5003120, 482915, 5003300',
		'Pine Grove Gardens': '481615, 5002700, 481820, 5002900',
		'Pioneer': '483250, 5004850, 484100, 5005730',
		'President': '479250, 5000100, 479500, 5000335',
		'Quail Creek': '483022, 5005860, 483300, 5006160',
		'Quincy': '480090, 5000950, 480370, 5001240',
		'Radisson Woods': '483850, 5001660, 483925, 5001740 ',
		'Sanctuary North': '484310, 5001260, 484425, 5001375',
		'Sanctuary South': '483880, 5000700, 484010, 5000825',
		'Savanna Grove': '485420, 5005220, 485650, 5005455',
		'Soccer Complex': '482420, 5000300, 483130, 5000950',
		'South Lake': '485030, 5003230, 485135, 5003340',
		'Sunnyside': '479780, 4998280, 480470, 4998990',
		'Suzanne': '481300, 5001450, 481440, 5001590',
		'Swan': '479190, 4999350, 479365, 4999530',
		'Territorial': '479517, 5000290, 480050, 5000840',
		'The Commons': '481890, 5002225, 482033, 5002372',
		'The Green': '481730, 5002370, 481860, 5002510',
		'Town Square': '483470, 5001330, 483630, 5001490',
		'Trees Edge': '481970, 5002450, 482350, 5002840',
		'Van Buren': '480160, 4998730, 480395, 4998970',
		'West Lake': '484069, 5003390, 484625, 5003970',
		'Westwood': '480460, 4997420, 480590, 4997560',
		'Xylite': '483870, 4997715, 484140, 4998000'

	}
};
/*
 * MapServer Location
 */

var MAPSERVER_MAPFILE_ROOT = '/ms4w/apps/geomoose/maps_Blaine/';	/* 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 = 'BlaineMoose_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 = false;		/* Turns on/off the reference map */
var REFERENCE_MAP_VISIBLE = false;	/* 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 = 'City of Blaine GeoMOOSE Application'; /* 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 = 1000000;

/*
 * 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';
