// *******************************************
// **  Flashmaps AreaSelector Counties 1.0  **
// **        JavaScript Functions           **
// *******************************************
// **    (c)2005 Flashmaps Geospatial       **
// **      http://www.flashmaps.com         **
// *******************************************

// *********************
// ** THEME functions **
// *********************

function fmThemeLoad(theme_xml) {
//do: load a new theme into the AS

	fmEngine.SetVariable("_root.outsideTheme", theme_xml);
	fmEngine.SetVariable("_root.outsideAction", "themeLoad");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

// *******************
// ** MAP functions **
// *******************

function fmInitialView() {
//do: return the map to initial view

	fmEngine.SetVariable("_root.outsideAction", "themeInitialView");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

// ************************
// ** MAP MODE functions **
// ************************

function fmMapModeZoom() {
//do: change the map mode to zoom mode

	fmEngine.SetVariable("_root.outsideAction", "modeZoom");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

function fmMapModeSelect() {
//do: change the map mode to select mode

	fmEngine.SetVariable("_root.outsideAction", "modeSelect");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

function fmMapModeExportListAreas() {
//do: return the list of areas selected

	fmEngine.SetVariable("_root.outsideAction", "modeExport");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
	return fmEngine.GetVariable("_root.outsideAreasSelected");
}

function fmMapModeCleanAreas() {
//do: clean the list of areas selected

	fmEngine.SetVariable("_root.outsideAction", "modeClean");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

// *********************
// ** AREAS functions **
// *********************

function fmAreaCenter(area_str) {
//do: center the map into an area

	fmEngine.SetVariable("_root.outsideArea", area_str);
	fmEngine.SetVariable("_root.outsideAction", "areaCenter");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

function fmAreaEnabled(area_str, enabled_str) {
//do: enabled / disabled an area

	fmEngine.SetVariable("_root.outsideArea", area_str);
	fmEngine.SetVariable("_root.outsideEnabled", enabled_str);
	fmEngine.SetVariable("_root.outsideAction", "areaEnabled");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

function fmAreaColor(area_str, colorNormal, colorOver, colorPress, colorText) {
//do: change the color of an area

	fmEngine.SetVariable("_root.outsideArea", area_str);
	fmEngine.SetVariable("_root.outsideColorNormal", colorNormal);
	fmEngine.SetVariable("_root.outsideColorOver", colorOver);
	fmEngine.SetVariable("_root.outsideColorPress", colorPress);
	fmEngine.SetVariable("_root.outsideColorText", colorText);
	fmEngine.SetVariable("_root.outsideAction", "areaColor");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

// ****************************
// ** AREA SELECTOR FUNCTION **
// ****************************

function fmAreaSelectorShow() {
//do: show the area selector window with the list of areas to select

	fmEngine.SetVariable("_root.outsideAction", "areaselectorShow");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

function fmAreaSelectorHide() {
//do: hide the area selector window

	fmEngine.SetVariable("_root.outsideAction", "areaselectorHide");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

//********************
//** POIS FUNCTIONS **
//********************

function fmPOIsShowCategory(category_str) {
//do: show all pois of a category (* for all categories)
	
	fmEngine.SetVariable("_root.outsideCategory", category_str);
	fmEngine.SetVariable("_root.outsideAction", "POIsShowCategory");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}

function fmPOIsHideCategory(category_str) {
//do: hide all pois of a category (* for all categories)
	
	fmEngine.SetVariable("_root.outsideCategory", category_str);
	fmEngine.SetVariable("_root.outsideAction", "POIsHideCategory");
	fmEngine.TCallLabel("_root.outside_mc", "doAction");
}