function amMapCompleted(map_id){
	// get the flash object into "flashMovie" variable   
	flashMovie = document.getElementById(map_id);
	// tell the field with id "mapfinished" that this chart was initialized
	$("body").mousemove(function(e){
		getLongLat();
	});
}
$(document).ready(function(){
	$("#stMode").click(function(){
		turnStationMode();
	})
	$("#frcMode").click(function(){
		turnForecastMode();
	})
	mapContent = $("#legend").html();
});
function turnStationMode(){
	$("#mapholder").css({"background-color":"#3d9aa2", "background-image":"url(img/corners_02.gif)"});
	$("#stMode").css({"width":"148px", "margin":"0 0 0 0"});
	$("#frcMode").css({"width":"146px", "margin":"2px 0 0 2px"});
	$(".legend_block").css({"display":"block"});
	$(".legend_block2").css({"display":"none"});
	flashMovie.reloadAll("/cgi-bin/fidel/map_xml.pl", "/ammap/ammap_settings.xml");
}
function turnForecastMode(){
	$("#mapholder").css({"background-color":"#60b0c4", "background-image":"url(img/corners_01.gif)"});
	$("#stMode").css({"width":"146px", "margin":"0 0 0 2px"});
	$("#frcMode").css({"width":"148px", "margin":"2px 0 0 0"});
	$(".legend_block").css({"display":"none"});
	$(".legend_block2").css({"display":"block"});
	flashMovie.reloadAll("/ammap/ammap_data.xml", "/ammap/ammap_settings_forecast.xml");
}
function getLongLat(){
	flashMovie.getLongLat();
}
function amSetLongLat(map_id, long, lat){
	if(long == undefined || lat == undefined)
		return;
	var longitude = Math.round(long);//toString().split('.');
	var latitude = Math.round(lat);//toString().split('.');
	if(longitude > 0){
		longitude += "\&deg; E"
	}
	else if(longitude < 0){
		longitude = Math.abs(longitude) + "\&deg; W"
	}
	else if(longitude == 0){
		longitude = longitude + "\&deg;"
	}
	if(latitude > 0){
		latitude += "\&deg; N"
	}
	else if(latitude < 0){
		latitude = Math.abs(latitude) + "\&deg; S"
	}
	else if(latitude == 0){
		latitude = latitude + "\&deg;"
	}
	$("#spanLat").html(latitude);
	$("#spanLong").html(longitude);
}
function amRegisterHover(map_id, object_id, title, value){
}           
