var TileMap = new Object();
TileMap = {};

TileMap.resizeMap = function()
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   	
		TileMap.setDimensions();				
				
		var mapContent = YAHOO.util.Dom.get("mapContent");
		mapContent.style.width =  TileMap.Width + "px";
		mapContent.style.height = TileMap.Height + "px";		
	}
}

TileMap.toggleLayer = function(layerID)
{

	var flashInstance = TileMap.getMovie();	
	if (flashInstance != null) {   		
		flashInstance.toggleLayer(layerID);
	}
}

TileMap.toggleVanpoolLayer = function()
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   	
		flashInstance.toggleVanpoolLayer();		
	}
}

TileMap.filterVanpoolLayer = function(vanpoolList)
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   	
		flashInstance.filterVanpoolLayer(vanpoolList);		
	}
}

TileMap.highlightVanpool = function(vanpoolID, show, type)
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   	
		flashInstance.highlightVanpool(vanpoolID, show, type);		
	}
}

TileMap.mapAddress = function(lat, lon, type)
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   
		flashInstance.mapAddress(lat, lon, type);			
	}
}

TileMap.setCenter = function(lat, lon)
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   
		flashInstance.setCenter(lat, lon);			
	}
}

TileMap.clearMarkers = function()
{
	var flashInstance = TileMap.getMovie();
	
	if (flashInstance != null) {   	
		flashInstance.clearMarkers();	
	}
}

TileMap.setDimensions = function() 
{
	var overallWidth = YAHOO.util.Dom.getViewportWidth();
	var overallHeight = YAHOO.util.Dom.getViewportHeight();
		
	var headerRegion = YAHOO.util.Dom.getRegion("header");
	var footerRegion = YAHOO.util.Dom.getRegion("footer");
	var leftRegion = YAHOO.util.Dom.getRegion("leftContent");

	TileMap.Width = overallWidth - leftRegion.right;		
	TileMap.Height = overallHeight - (headerRegion.bottom - headerRegion.top) - (footerRegion.bottom - footerRegion.top);		
}

TileMap.getMovie = function()
{
	return YAHOO.util.Dom.get("map");
}


TileMap.initLoad = function() {
	// Resize div area	
	TileMap.resizeMap();	
}

TileMap.onMapInitialized = function() {
}



// Wait for the page to fully load before initializing
YAHOO.util.Event.addListener(window, "load", TileMap.initLoad);
YAHOO.util.Event.addListener(window, "resize", TileMap.resizeMap);

