
// Array mit worldMapSection-Objects
var worldMapSections = new Array(); 


var worldMapSectionObjs = new Object();

//var worldMapDistricts = new Object();
var worldMapDistrictObjs = new Object();


function worldMapSection (ID, districtID)
{
	this.ID = ID; // ID hat präfix: WorldMapSection_
	this.districtID = 'WorldMapDistrict_' + districtID; // hat kein präfix 
}

function worldMapSectionInit(worldMapSectionCont)
{
	if (!worldMapSectionObjs[worldMapSectionCont.ID])
	{
		worldMapSectionObjs[worldMapSectionCont.ID] = MM_findObj( worldMapSectionCont.ID );
	}
	
	if (worldMapSectionObjs[worldMapSectionCont.ID])
	{
		worldMapSectionObjs[worldMapSectionCont.ID].className = "worldMapPageSectionHidden";
	}
	
	
	if (!worldMapDistrictObjs[worldMapSectionCont.districtID])
	{
		worldMapDistrictObjs[worldMapSectionCont.districtID] = MM_findObj( worldMapSectionCont.districtID );
	}
	
	if (worldMapDistrictObjs[worldMapSectionCont.districtID])
	{
		worldMapDistrictObjs[worldMapSectionCont.districtID].className = "worldMapPageDistrictHidden";
	}
	
}

function worldMapSectionShow(worldMapSectionID, focusAnchorHash)
{
	currSection = null;
	
	for (x in worldMapSections)
	{
		if (worldMapSections[x].ID != worldMapSectionID)
		{
			worldMapSectionInit( worldMapSections[x] );
		} else {
			currSection = worldMapSections[x];
		}
	}
		
	if (worldMapSectionObjs[currSection.ID])
	{
		worldMapSectionObjs[currSection.ID].className = "worldMapPageSectionVisible";
	}

	if (worldMapDistrictObjs[currSection.districtID])
	{
		worldMapDistrictObjs[currSection.districtID].className = "worldMapPageDistrictVisible";
	}

	if (focusAnchorHash)
	{
		location.hash = worldMapSectionID.replace(/WorldMapSection/, "#wM");
	}
}

function worldMapInitByAnchor(anchorHash)
{
	if (anchorHash)
	{
		worldMapSectionShow(anchorHash.replace(/\#wM/, "WorldMapSection"), true);
	}
}

