AWP.Configuration = OpenLayers.Class({
	HOST: '',
	NAMESPACE: 'awp',
	WMS_URL: '',
	RESOLUTION: 156543.0339,
	LAYOUT: {
		southRegionHeight: 450,
		seawaSouthRegionHeight: 300,
		seawaRatio: 0.618
	},
	externelURL: 'http://albertawater.com/awp/',
	//baseURL: 'components/com_awp/',
	/**
	 * Used by Ajax. It should be customized according to different projects such as SEAWA and WSOW.
	 * For example: AWP.Configuration.prototype.serviceURL = 'index.php?option=<?php echo SEAWA_COM?>';
	 */
	serviceURL: 'index.php?option=com_awp&',
	//FusionChart: "components/com_awp/libraries/FusionCharts/FCF_MSLine.swf",
	FusionChart: "/awp/libraries/FusionCharts/FCF_MSLine.swf",
	albertawater_url: "/joomla/www/",
	defaultCenter: new OpenLayers.LonLat(-110, 54.5),
	defaultZoomLevel: 4,
	initialize: function(config) {
		config = config || {};
		
		/**
		 * AWP 相关配置
		 */
		this.AWP					= this.AWP		|| 'awp';
		this.AWP_PATH				= this.AWP_PATH	|| this.AWP;
		this.AWP_BASE				= this.AWP_BASE	|| 'http://albertawater.com/';
		
		this.AWP_URL				= this.AWP_BASE + this.AWP + '/';
		this.baseURL				= this.AWP_URL;
		
		/**
		 * SEAWA 相关配置
		 */
		this.SEAWA					= this.SEAWA		|| 'seawa';
		this.SEAWA_BASE				= this.SEAWA_BASE	|| this.AWP_BASE;
		this.SEAWA_PATH				= this.SEAWA_PATH	|| this.SEAWA;
		
		this.SEAWA_COM				= 'com_' + this.SEAWA;
		this.SEAWA_URL				= this.SEAWA_URL || (this.SEAWA_BASE + this.SEAWA_PATH + '/');
		this.SEAWA_COM_ADMIN_URL	= this.SEAWA_URL + 'administrator/components/' + this.SEAWA_COM + '/';
		this.SEAWA_ICON_URL			= this.SEAWA_COM_ADMIN_URL + 'icons/';
		
		
		this.SEAWA_INDICATOR_ARTICLE_TYPES = [
			'Historical Overview',
			'Risks and Pressures',
			'Conditions and Indicators',
			'Actions and Response',
			'Summary'
		];
		
		/**
		 * 地图数据服务端配置
		 */
		this.HOST = 'www.albertawater.com:8080';
		this.WMS_URL = 'http://' + this.HOST + '/geowebcache/service/wms';
		//this.WMS_URL = 'http://' + this.HOST + '/geoserver/wms';
		this.LAYER_GROUP = {
			namespace: this.NAMESPACE,
			url: this.WMS_URL
			//maxScale: 500,
			//minScale: 500000,
		};
		this.LAYER_GROUP2 = {
			url: 'http://' + this.HOST + '/geowebcache/service/wms'
			//url: 'http://wms.ess-ws.nrcan.gc.ca/wms/toporama_en'
		};
		this.LAYER_GROUP3 = {
			namespace: 'awp',
			url: 'http://' + this.HOST + '/geowebcache/service/wms'
			//url: 'http://' + this.HOST + '/geoserver/wms'
		};
		
		/**
		 * 第一次遍历主要寻找图层节点，完善图层属性
		 */
		var categories = {};
		for (var i = 0, config; config = this.LAYERS[i]; i++) {
			// 忽略 parentCategory 为 '' 的图层或节点，就像它们被注释了一样
			if (config.parentCategory === '') continue;
			
			config.opacity = 0.7;
			config.children = [];
			
			if (config.server == 3) {
				config.server = this.LAYER_GROUP3;
			} else if (config.server == 2) {
				config.server = this.LAYER_GROUP3;
			} else if (config.server === true) {
				config.server = this.LAYER_GROUP2;
			} else {
				config.server = this.LAYER_GROUP;
				if (config.layers) config.listable = true;
			}
			
			if (config.layerId) {// 有 layerId 属性的，认为它是图层
				if (!config.icon) config.icon = this.baseURL + 'image/layer.png';
			} else {// 没有 layerId 属性的，认为它是图层节点，默认图标为所有子图层为活跃状态
				categories[config.category] = config;
				if (!config.icon) config.icon = this.baseURL + 'image/layers-all-enabled.png';
			}
			
			// 如果 location 属性存在，且不以 http 开头，那么认为它指向本地 serviceURL
			if (config.location && config.location.indexOf('http') == -1) {
				config.location = this.serviceURL + config.location;
			}
		}
		
		/**
		 * 第二次遍历，根据 layerType 实例化图层
		 */
		for (var i = 0, config; config = this.LAYERS[i]; i++) {
			// 忽略非图层（节点）
			if (!config.layerId) continue;
			// 忽略无类别信息的图层或节点
			if (config.category == '' || config.parentCategory == '') continue;
			// 忽略无从属类别的图层或节点
			if (!categories[config.category]) continue;
			
			var layer = null;
			if (config.layerType) {
				switch (config.layerType) {
					case 'google':	layer = new AWP.Layer.Google(config);	break;
					case 'marker':	layer = new AWP.Layer.Markers(config);	break;
					case 'vector':	layer = new AWP.Layer.Vector(config);	break;
				}
			} else {
				layer = new AWP.Layer(config);
			}
			
			categories[config.category].children.push(layer);
			if (categories[config.parentCategory]) {
				categories[config.parentCategory].children.push(config);
			}
		}
		
		this.CATEGORIES = categories;
	},
	LAYER_GROUP: null,
	LAYER_GROUP2: null,
	LAYERS: [
		{	category: 'hidden',			text: 'Hidden',					expanded: false		},
		
		/*{	name: 'Helen_Edit_Project',					layerId: 'Helen_Edit_Project', 		layers: 'Helen_Edit_Project',
			category: 'topcanada_wms',			server: 2}, */
		{	category: 'bg_layers',		text: 'Background Services',			expanded: false		},
		{	category: 'bg_layers',		layerId: 'gmap',		name: "Google Map",			layerType: 'google',	checked: true			},
			
		{	category: 'PFRA',			text: 'PFRA Watershed Boundaries',		expanded: false,		checked: false},
		{	category: 'PFRA',			layerId: 'effect',		layers: 'effect2'		},
		{	category: 'PFRA',			layerId: 'gross',		layers: 'gross2'		},
		{	category: 'PFRA',			layerId: 'sub_4c',		layers: 'sub_4c2'		},
		{	category: 'PFRA',			layerId: 'sub_ec',		layers: 'sub_ec2'		},
		{	category: 'PFRA',			layerId: 'maj_sys',		layers: 'maj_sys2'		},
		{	category: 'PFRA',			layerId: 'non',			layers: 'non2'			},
		{	category: 'PFRA',			layerId: 'network',		layers: 'network2'		},
		{	category: 'PFRA',			layerId: 'helen_edit_dissolve_point',		layers: 'helen_edit_dissolve_point'		},
		
		{	category: 'topcanada_wms',			text: 'Toporama WMS',			expanded: false,		checked: false},
		{	category: 'topcanada_wms',			layerId: 'builtup_areas',		name: 'Built-up areas(1:300K)',		layers: 'builtup_areas',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'railway', 			name: 'Railway',					layers: 'railway',
				server: true	},
		{	category: 'topcanada_wms',			layerId: 'limits',				name: 'Limits', 				 	layers: 'limits',
				server: true	},
		{	category: 'topcanada_wms',			layerId: 'designated_areas',	name: 'Designated areas(1:300K)',	layers: 'designated_areas',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'hydrography',			name: 'Hydrography',  				layers: 'hydrography',
				server: true,						checked	: true	},
		{	category: 'topcanada_wms',			layerId: 'hypsography',			name: 'Hypsography(1:300K)', 		layers: 'hypsography',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'vegetation', 			name: 'Vegetation(1:300K)', 		layers: 'vegetation',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'water_saturated_soils',	name: 'Water saturated soils(1:300K)',	layers: 'water_saturated_soils',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'landforms',			name: 'Landforms(1:150K)', 			layers: 'landforms',
				server: true,						minScale: 150000	},
		{	category: 'topcanada_wms',			layerId: 'constructions',		name: 'Constructions(1:300K)', 		layers: 'constructions',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'water_features',		name: 'Water features(1:150K)',  	layers: 'water_features',
				server: true,						minScale: 150000},
		{	category: 'topcanada_wms',			layerId: 'road_network',		name: 'Road network',  				layers: 'road_network',	
				server: true	},
		{	category: 'topcanada_wms',			layerId: 'populated_places',	name: 'Populated places', 			layers: 'populated_places',
				server: true	},
		{	category: 'topcanada_wms',			layerId: 'structures',			name: 'Structures(1:150K)', 		layers: 'structures',
				server: true,						minScale: 150000	},
		{	category: 'topcanada_wms',		 	layerId: 'feature_names',		name: 'Feature names(1:20M)',		layers: 'feature_names',
				server: true,						minScale: 20000000,				checked	: true	},
		{	category: 'topcanada_wms',			layerId: 'power_network',		name: 'Power network(1:300K)', 		layers: 'power_network',
				server: true,						minScale: 300000	},
		{	category: 'topcanada_wms',			layerId: 'rocky_view_wetlands',	name: 'RVwetland', 					layers: 'rocky_view_wetlands',
				server: 2	},
		/**
		 * 注释掉的是调试数据，真实数据要动态从数据库中取得
		 * @date 2010-08-19 #82 需求：去掉右侧 Real-time 选项
		 */
		// {	category: 'real-time',				text: 'Real-time Data',			id: 'realtime',			expanded: false,		checked: false},
		/*{	category: 'real-time',				layerId: 'water_level',			name: 'Water Level',			layers: 'water_level',
				server: 3,							layerType: 'marker',			checked: false
				location: '?action=AWP.showRealtimeIndicator&format=json&layer=water_level'	},
		{	category: 'real-time',				layerId: 'flow',				name: 'Flow',					layers: 'flow',
				server: 3,							layerType: 'marker',			checked: false
				location: '?action=AWP.showRealtimeIndicator&format=json&layer=flow'		},	
		{	category: 'real-time',				layerId: 'capacity',			name: 'Capacity',				layers: 'capacity',
				server: 3,							layerType: 'marker',			checked: false
				location: '?action=AWP.showRealtimeIndicator&format=json&layer=capacity'	},*/
		
		{	category: 'search',				text: 'Search Layers',				expanded: true	},
		{	category: 'search',				layerId: 'section_project',			layers: 'section_project'	},
		{	category: 'search',				layerId: 'toponym',					layers: 'bas_ab_cvec_toponym_r01',
				name: 'AB CanVec 1:50K Place Names',
				icon: 'image/style-placename.png',
				minScale: 50000		},
		{	category: 'search',				layerId: 'sub_pf',					layers: 'sub_pf2',
				name: 'Basins',
				columns: {	gid: { width: 50 },		sub_pf: { autoExpand: true }}},
		{	category: 'search',				layerId: 'station_join2',			layers: 'station_join2',
				name: 'Realtime Data',	
				styles: [{
						text: 'No Realtime Data',
						icon: 'image/style-station-no-realtime.png'
					},{
						text: 'Realtime Data',
						icon: 'image/style-station-realtime.png'
				}],
				columns: {
					expander: [
						'<div style="text-align: left; padding: 0 2em">',
						'{textdata}',
						'</div>'
					],
					gid: { width: 80 },
					realtime_data: { width: 80, header: 'Realtime Data' },
					aenv_stati: {
						width: 100,
						sortable: true
						/*renderer: function(value, meta, record) {pre(record.data)
							if (value) {
								return '<a target="_blank" href="realtime/view_station_text.php?basin_id=' + record.data.basin_id
									+ '&infotype_id=' + record.data.infotype_id + '&station=' + value + '">' + value + '</a>';
							} else {
								return '';
							}
						}*/
					},
					stn_name: { width: 300 },
					x: { },
					y: { },
					stn_type: { width: 50 },
					primacy: { width: 50 },
					sub_4c: { width: 50 },
					sub_ec: { width: 50 },
					agency: { width: 50 },
					region: { width: 50 }
				}
		},
		
		/**
		 * 注释掉这些节点 category，同时也就等于注释掉了这些节点下的图层。
		 */
		/*{	text: 'Infratructure and Access',	category: 'infratructure_and_access',	expanded: false,	parentCategory: ''},
		{	text: 'Points of Interest',			category: 'points_of_interest',			expanded: false,	parentCategory: ''},
		{	text: 'AB CanVec Buildings',			category: 'building',					expanded: false,	parentCategory: ''},
		{	text: 'Water and Hydrology Features',	category: 'water_and_hydroloy',			expanded: false,	parentCategory: ''},
		{	text: 'Parks and Protected Areas',		category: 'park',						expanded: false,	parentCategory: ''},
		{	text: 'Geoadministrative and Land Use',category: 'geoadmin',					expanded: false,	parentCategory: ''},
		{	text: 'National Scale Features',		category: 'national',					expanded: false,	parentCategory: ''},*/
		/**
		 * Category: Infratructure and Access
		 */{
			name: 'AB CanVec Power Lines',
			layers: 'bas_ab_cvec_power_line_r01',
			layerId: 'power_line',
			category: 'infratructure_and_access',
			styles: [{
					text: 'Overhead',
					icon: 'image/style-dot-line.png'
				},{
					text: 'Submarine',
					icon: 'image/style-submarine.png'
			}]
		},{
			name: 'AB CanVec Cutlines',
			icon: 'image/style-cutline.png',
			layers: 'bas_ab_cvec_cutline_r01',
			layerId: 'cutline',
			category: 'infratructure_and_access'
		},{
			name: 'AB CanVec Trails',
			icon: 'image/style-trail.png',
			layers: 'bas_ab_cvec_trail_r01',
			layerId: 'trail',
			category: 'infratructure_and_access'
		},{
			name: 'AB CanVec 1:50K Wells',
			layers: 'bas_ab_cvec_well_r01',
			layerId: 'well',
			category: 'infratructure_and_access',
			minScale: 50000,
			styles: [{
					text: 'Oil',
					icon: 'image/style-oil.png'
				},{
					text: 'Water',
					icon: 'image/style-water.png'
			}]
		},{
			name: 'AB CanVec Pipelines',
			layers: 'bas_ab_cvec_pipeline_r01',
			layerId: 'pipeline',
			category: 'infratructure_and_access',
			styles: [{
					text: 'Aboveground',
					icon: 'image/style-pipeline-above.png'
				},{
					text: 'Underground',
					icon: 'image/style-pipeline-under.png'
			}]
		},{
			name: 'AB CanVec 1:50K Railways',
			layers: 'bas_ab_cvec_railway_r01',
			layerId: 'railway',
			category: 'infratructure_and_access',
			minScale: 50000,
			styles: [{
					text: 'Under Construction',
					icon: 'image/style-railway-construct.png'
				},{
					text: 'Non Operational',
					icon: 'image/style-railway-nonop.png'
				},{
					text: 'Operational',
					icon: 'image/style-railway-op.png'
			}]
		},
		/**
		 * Points of Interest
		 */
		{
			name: 'AB CanVec 1:50K History Site',
			icon: 'image/style-history-site.png',
			layers: 'bas_ab_cvec_historic_site_r01',
			layerId: 'historic_site',
			category: 'points_of_interest',
			minScale: 50000
		},{
			name: 'Building Points',
			icon: 'image/style-building-pt.png',
			layers: 'bdy_ab_cvec_building_pt_r01',
			layerId: 'building_pt',
			category: 'building'
		},{
			name: 'Building Polygons',
			icon: 'image/style-building-py.png',
			layers: 'bas_ab_cvec_building_py_r01',
			layerId: 'building_py',
			category: 'building'
		},{
			name: 'AB CanVec 1:50K Runways',
			icon: 'image/style-runway.png',
			layers: 'bas_ab_cvec_runway_py_r01',
			layerId: 'runway',
			category: 'points_of_interest',
			minScale: 50000
		},
		/**
		 * Category: Water and Hydroloy Features
		 */
		{
			name: 'AB CanVec 1:50K Watercourses',
			layers: 'bas_ab_cvec_watercourse_r01',
			layerId: 'watercourse',
			category: 'water_and_hydroloy',
			minScale: 50000,
			styles: [{
					text: 'Watercourse',
					icon: 'image/style-watercourse.png'
				},{
					text: 'Canal',
					icon: 'image/style-watercourse-canal.png'
				},{
					text: 'Conduit',
					icon: 'image/style-watercourse-conduit.png'
				},{
					text: 'Ditch',
					icon: 'image/style-watercourse-ditch.png'
				},{
					text: 'Tidal River',
					icon: 'image/style-watercourse-tidal.png'
				},{
					text: 'None',
					icon: 'image/style-watercourse-none.png'
				}]
		},{
			name: 'AB CanVec Intermittent Water',
			layers: 'bas_ab_cvec_intermit_water_r01',
			layerId: 'intermit_water',
			category: 'water_and_hydroloy',
			styles: [{
					text: 'Alluvium',
					icon: 'image/style-intermit-alluvium.png'
				},{
					text: 'Rocky Ledge',
					icon: 'image/style-intermit-rocky.png'
				},{
					text: 'Unknown',
					icon: 'image/style-intermit-unknown.png'
				}]
		},{
			name: 'AB CanVec 1:50K Waterbodies',
			layerId: 'waterbody',
			layers: 'bas_ab_cvec_waterbody_r01',
			category: 'water_and_hydroloy',
			minScale: 50000,
			styles: [{
					text: 'Lake, River or Pond',
					icon: 'image/style-waterbody-lakeriverpond.png'
				},{
					text: 'Canal',
					icon: 'image/style-waterbody-canal.png'
				},{
					text: 'Reservoir',
					icon: 'image/style-waterbody-reservior.png'
				},{
					text: 'Liquid Waste, indefinite; Liquid Waste, isolated_2',
					icon: 'image/style-waterbody-waste.png'
				},{
					text: 'Side Channel, non isolated_2',
					icon: 'image/style-waterbody-channel.png'
				},{
					text: 'Tidal River, non_isolated_2',
					icon: 'image/style-waterbody-tidal.png'
				},{
					text: 'None, non isolated_2',
					icon: 'image/style-waterbody-nonisolated.png'
				},{
					text: 'None, isolated_2',
					icon: 'image/style-waterbody-isolated.png'
				}]
		},{
			name: 'AB CanVec Wetlands',
			icon: 'image/style-wetland.png',
			layers: 'bas_ab_cvec_wetland_r01',
			layerId: 'wetland',
			category: 'water_and_hydroloy'
		},
		/**
		 * Category: Parks and Protected Areas
		 */{
			name: 'Urban Parks',
			icon: 'image/style-urbanpark.png',
			layers: 'bas_ab_cvec_park_r01',
			layerId: 'parks',
			category: 'park'
		},{
			name: 'Alberta Parks',
			icon: 'image/style-albertapark.png',
			layers: 'parks',
			layerId: 'cvec_park',
			category: 'park'
		},
		/**
		 * Category: Geoadministrative and Land Use
		 */
		{
			name: 'Province Boundary',
			icon: 'image/style-boundary.png',
			layers: 'bas_ca_cvec_province_bndry_r01',
			layerId: 'province_boundary',
			category: 'geoadmin'
		},{
			name: 'Residential Area',
			icon: 'image/style-residential.png',
			layers: 'bas_ab_cvec_residential_r01',
			layerId: 'residential',
			category: 'geoadmin'
		},{
			name: 'AB Agriculture Capability 1:250K (CLI)',
			layers: 'geo_ab_cli_agr_cap_250k',
			layerId: 'agr_cap',
			category: 'geoadmin',
			minScale: 250000,
			styles: [{
					text: 'Class 1',
					icon: 'image/style-agriculture-class1.png'
				},{
					text: 'Class 2',
					icon: 'image/style-agriculture-class2.png'
				},{
					text: 'Class 3',
					icon: 'image/style-agriculture-class3.png'
				},{
					text: 'Class 4',
					icon: 'image/style-agriculture-class4.png'
				},{
					text: 'Class 5',
					icon: 'image/style-agriculture-class5.png'
				},{
					text: 'Class 6',
					icon: 'image/style-agriculture-class6.png'
				},{
					text: 'Class 7',
					icon: 'image/style-agriculture-class7.png'
				},{
					text: 'Organic Soils',
					icon: 'image/style-agriculture-organic.png'
				},{
					text: 'Unclassified',
					icon: 'image/style-agriculture-unclassed.png'
				}]
		},{
			name: 'AB CanVec 1:50K Wooded Areas',
			icon: 'image/style-wooded.png', 
			layers: 'bas_ab_cvec_wood_area_r01',
			layerId: 'wood_area',
			category: 'geoadmin',
			minScale: 50000
		},
		/**
		 * Category: National Scale Features
		 */
		{
			name: 'AB National Scale Framework Islands',
			icon: 'image/style-national-island.png',
			layers: 'hyd_ab_nsf_islands_1m_2003_py',
			layerId: 'islands',
			category: 'national'
		},{
			name: 'AB National Scale Framework Rivers',
			icon: 'image/style-national-river.png',
			layers: 'hyd_ab_nsf_rivers_1m_2003_ln',
			layerId: 'rivers',
			category: 'national'
		},{
			name: 'AB National Scale Framework Lakes',
			icon: 'image/style-national-lake.png',
			layers: 'hyd_ab_nsf_lakes_1m_2003_py',
			layerId: 'lakes',
			category: 'national'
		/*},{
			name: 'simplified features',
			layers: 'temp_simplified_geom',
			layerId: 'simplified_features',
			layerType: 'vector',
			category: 'test',*/
		},{
			name: 'Water Information',
			layers: 'helen_edit',
			layerId: 'helen_edit',
			category: 'search',
			columns: {
				expander: [
					'<div style="text-align: left; padding: 0 2em">',
					'<b>ABSTRACT:</b><p style="padding-left:2em">{ABSTRACT}</p><br />',
					'<b>BODY_OF_WATER:</b><p style="padding-left:2em">{BODY_OF_WATER}</p><br />',
					'<b>LOCATION_DESC:</b><p style="padding-left:2em">{LOCATION_DESC}</p><br />',
					'</div>'
				],
				
				gid			: false,
				ABSTRACT	: false,
				LINK		: false,
				IF_TABLE	: false,
				DATE		: false,
				BODY_OF_WATER	: false,
				LOCATION_DESC	: false,
				ISSN		: false,
				ISBN		: false,
				DOI			: false,
				LAND_USE_REGION		: false,
				LOCATION_EXPLICIT	: false,
				LAND_USE_REGION		: false,
				CATALOGUE_NUMBER	: false,
				PATENT_NUMBER		: false,
				BASIN			: false,
				SUB_BASIN		: false,
				AREA			: false,
				AREA_NTS		: false,
				AREA_FMU		: false,
				Published		: false,
				geom_id			: false,
	/*			id			: { 
					width 	: 75,
					header	: '<input type="button" onclick="AWP.WaterData.compare()" value="COMPARE" />',
					renderer: function (value, meta, record) {
						meta.attr = 'style="text-align: center;"'
						return record.data.chartList;
					}
				},*/
				TITLE: {
					width	: 250,
					header	: "TITLE",
					renderer: function(value, meta, record) {
						meta.attr = 'style="white-space:normal;"';
						var title = value || 'Water Data - Title Missing';
						return title;
//						record.data.LINK ? '<a target="_blank" href="' + record.data.LINK
//							+ '" onclick="AWP.Realtime.viewPoints(' + record.data.id +')">'	+ title + '</a>'
//							: 
					}
				},
				IS_TABLE: { 
					width: 120,
					header : "Data",
					sortable: true,
					renderer: function (value, meta, record) {
						meta.attr = 'style="text-align: center; padding: 0px"';
						return record.data.chartView;
					}
				},
				category_id: {
					width	: 100,
					header	: "Category",
					renderer: function(value, meta, record) {
						return record.data.category;
					}
				},
				SOURCE: {},
				created: {
					width	: 120,
					header	: "Created Date",
					renderer: function(value, meta, record) {
						return value;
					}
				},
				system_date: {
					width	: 120,
					header	: "System Date",
					renderer: function(value, meta, record) {
						return value;
					}
				},
				SPATIAL_LINK: { width: 60, sortable: true, header: "SPATIAL" },
				id: {
					sortable: true
				}
			}
	}],
	VECTOR_STYLE: {
		'default': {
			fillColor: "#ee9900",
			fillOpacity: 0.1, 
			hoverFillColor: "white",
			hoverFillOpacity: 0.8,
			strokeColor: "#ee9900",
			strokeOpacity: 1,
			strokeWidth: 1,
			strokeLinecap: "round",
			strokeDashstyle: "solid",
			hoverStrokeColor: "red",
			hoverStrokeOpacity: 1,
			hoverStrokeWidth: 0.2,
			pointRadius: 6,
			hoverPointRadius: 1,
			hoverPointUnit: "%",
			pointerEvents: "visiblePainted",
			cursor: "inherit"
		},
		'select': {
			fillColor: "blue",
			fillOpacity: 0.1, 
			hoverFillColor: "white",
			hoverFillOpacity: 0.8,
			strokeColor: "blue",
			strokeOpacity: 1,
			strokeWidth: 1,
			strokeLinecap: "round",
			strokeDashstyle: "solid",
			hoverStrokeColor: "red",
			hoverStrokeOpacity: 1,
			hoverStrokeWidth: 0.2,
			pointRadius: 6,
			hoverPointRadius: 1,
			hoverPointUnit: "%",
			pointerEvents: "visiblePainted",
			cursor: "pointer"
		},
		'temporary': {
			fillColor: "#ee9900",
			fillOpacity: 0.1,
			hoverFillColor: "white",
			hoverFillOpacity: 0.8,
			strokeColor: "blue",
			strokeOpacity: 1,
			strokeWidth: 2,
			strokeLinecap: "round",
			strokeDashstyle: "solid",
			hoverStrokeColor: "red",
			hoverStrokeOpacity: 1,
			hoverStrokeWidth: 0.2,
			pointRadius: 6,
			hoverPointRadius: 1,
			hoverPointUnit: "%",
			pointerEvents: "visiblePainted",
			cursor: "inherit"
		}
	},
	DEFAULT_COLUMNS: [{
			id: 'fid', // id assigned so we can apply custom css (e.g. .x-grid-col-topic b { color:#333 })
			header: "Feature ID",
			dataIndex: 'id',
			width: 50,
			align: 'right',
			sortable: true
		},{
			header: "Distance (km)",
			dataIndex: 'distance',
			width: 100,
			align: 'right',
			sortable: true
		},{
			header: "Feature Area (km<sup>2</sup>)",
			dataIndex: 'feature_area',
			width: 100,
			align: 'right',
			sortable: true
		},{
			header: "Inside Area (km<sup>2</sup>)",
			dataIndex: 'inside_area',
			width: 100,
			align: 'right',
			sortable: true
		},{
			header: "Comprehensive Ranking",
			dataIndex: 'ranking',
			width: 100,
			align: 'right',
			sortable: true
	}]
});
try {
	AWP.Configuration.prototype.LAYERS = AWP.Configuration.prototype.LAYERS.concat([
		{	category: 'bg_layers',		layerId: 'gphy',		name: "Google Terrain",		layerType: 'google',	type: G_PHYSICAL_MAP	},
		{	category: 'bg_layers',		layerId: 'ghyb',		name: "Google Hybrid",		layerType: 'google',	type: G_HYBRID_MAP		},
		{	category: 'bg_layers',		layerId: 'gsat',		name: "Google Imagery",		layerType: 'google',	type: G_SATELLITE_MAP	}
	]);
} catch (e) {
	//alert('Google Map is not available')
}

