/*
 *
 * 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 = 'crawforddemoUTM.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 = '365013, 3910000, 419340, 3959000';

/* This populates and "Jump To:" type boxes */
var VIEWS = {
	'Zoom to:' : {
    'State of Arkansas' : '324269,3645647,811150,4051213',
    'Four State Map' : '-487420,3601036,877579,4519168',
    'Northwest Emer Mgt Area' : '350966,3834873,583017,4048382',
/*
    'Crawford and Adjacent Counties' : '291047,3818114,465926,4018398',
    'WAPDD Planning Area' : '327880,3779101,488306,3960932',
*/
'' : '',
'Arkansas Counties :' : '',
'Arkansas' : '617556,3756906,680944,3826632',
'Ashley' : '579946,3650838,645447,3697322',
'Baxter' : '533713,3979382,576675,4042848',
'Benton' : '352425,3995004,427935,4043499',
'Boone' : '469269,3996306,511581,4043499',
'Bradley' : '556704,3668164,597695,3731551',
'Calhoun' : '519940,3681264,566001,3742539',
'Carroll' : '418170,3996632,474477,4043174',
'Chicot' : '641221,3651683,684747,3715916',
'Clark' : '452749,3735777,515714,3799587',
'Clay' : '694035,4007047,766806,4045971',
'Cleburne' : '565156,3911994,612063,3955520',
'Cleveland' : '547830,3728171,598540,3772542',
'Columbia' : '451481,3651683,505572,3704083',
'Conway' : '494162,3880723,549520,3925517',
'Craighead' : '675027,3952562,746866,3988904',
'Crawford' : '365013, 3910000, 419340, 3959000',
'Crittenden' : '724047,3857058,770531,3928475',
'Cross' : '675873,3889597,729541,3928052',
'Dallas' : '505149,3740848,563888,3780993',
'Desha' : '629811,3709154,699115,3779303',
'Drew' : '590088,3694787,645024,3741693',
'Faulkner' : '534307,3856636,582904,3916642',
'Franklin' : '396100,3894230,441400,3962500',
'Fulton' : '573600,4010456,640376,4042995',
'Garland' : '460356,3804658,521630,3850297',
'Grant' : '526701,3767893,574875,3819449',
'Greene' : '691086,3981720,754473,4018907',
'Hempstead' : '408800,3702816,460356,3762822',
'Hot Spring' : '457820,3778881,534307,3819449',
'Howard' : '380910,3732819,427817,3802968',
'Independence' : '602343,3932278,664463,3979185',
'Izard' : '570227,3968198,621360,4016372',
'Jackson' : '624740,3913684,680098,3974959',
'Jefferson' : '568114,3769161,647137,3819871',
'Johnson' : '431189,3909080,486194,3960179',
'Lafayette' : '418520,3651683,467962,3707042',
'Lawrence' : '645447,3971578,705876,4012569',
'Lee' : '670379,3834239,738837,3868045',
'Lincoln' : '592201,3738313,647982,3781416',
'Little River' : '360203,3710845,426126,3756906',
'Logan' : '392600,3874200,476700,3921750',
'Lonoke' : '577833,3815645,628121,3883258',
'Madison' : '409057,3956599,462760,4020716',
'Marion' : '506373,3990448,554543,4042848',
'Miller' : '399926,3652528,439226,3721409',
'Mississippi' : '741795,3922559,806028,3991440',
'Monroe' : '639531,3799587,683479,3878187',
'Montgomery' : '411336,3799165,466272,3847762',
'Nevada' : '452749,3700703,493740,3758597',
'Newton' : '448765,3953018,506698,4000212',
'Ouachita' : '486133,3692674,545295,3743806',
'Perry' : '470075,3846494,544027,3887062',
'Phillips' : '671647,3776345,727850,3838465',
'Pike' : '410913,3756484,467539,3802123',
'Poinsett' : '675873,3922559,747712,3957633',
'Polk' : '361471,3782261,418097,3844381',
'Pope' : '468944,3884670,518351,3956924',
'Prairie' : '606146,3813955,653053,3886217',
'Pulaski' : '521207,3813955,590934,3877342',
'Randolph' : '637840,3997778,703763,4043840',
'Saline' : '489936,3806348,572340,3858326',
'Scott' : '362847,3835459,439430,3885444',
'Searcy' : '500515,3952042,555194,3997608',
'Sebastian' : '364302,3865154,407947,3926015',
'Sevier' : '360203,3733664,413026,3786910',
'Sharp' : '611640,3973691,659392,4042572',
'St. Francis' : '667421,3858326,738837,3895091',
'Stone' : '549943,3950872,609527,3998623',
'Union' : '499233,3652106,591779,3693519',
'Van Buren' : '511065,3913684,570650,3961859',
'Washington' : '358118,3956103,421116,4011886',
'White' : '578256,3878187,652631,3935236',
'Woodruff' : '636995,3863397,680994,3925939',
'Yell' : '430538,3844311,509953,3909731'
	}	
};
/*
 * MapServer Location
 */

var MAPSERVER_MAPFILE_ROOT = '/ms4w/apps/GeoMOOSE/maps_crawford_UTM/';	/* 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 = true;	/* 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 = 'crawford';	/* 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 = 'crawfordmenuUTM.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' : 180000, 'label' : '1:180,000' },
	{ 'scale' : 100000, 'label' : '1:100,000' },
	{ 'scale' : 50000, 'label' : '1:50,000' },
	{ 'scale' : 20000, 'label' : '1:20,000' },
	{ 'scale' : 5000, 'label' : '1:5,000' },
	{ 'scale' : 1000, 'label' : '1:1,000' }

];


/* 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 = 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 GEOMOOSE_TITLE = 'Crawford County'; /* Window Title */
var GEOMOOSE_ORGANIZATION = 'Crawford County AR'; /* 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 */

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 'Hang on...' default message to pretty much anything you want.
 * This is more useful for internationalization than anything else.
 */
var LOADING_MESSAGE = 'Hang on...';
var LOADING_IMAGE = './shared/images/waiting.gif';
var LOADING_TIMEOUT = 600000; /* 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 = 0;
var MAP_MAXSCALE = 4500000;

/*
 * 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';

