var mapSelector = "#nz_map";
var urlBase = "";


// Hide elements until the flash is loaded.
document.write('<style type="text/css">');
document.write(mapSelector + " {visibility: hidden;}");
document.write('</style>');


function doMapReplace(flashPath){
	var map = getElementsBySelector(mapSelector)[0];

	var width = 400;//map.offsetWidth;
	var height = map.offsetHeight;
		
	if(!document.getElementById("regions")){
		map.style.visibility = "";
		return;
	}
	
	map.style.right = "-150px";
	var xml = getInnerHtml(document.getElementById("regions"));

	writeFlash(map, "map_revC/map.swf", width, height, "urlBase=" + escape(urlBase) + "&xmldata=" + encodeURIComponent(xml) );
}

EventUtils.addEventListener(window,'load',doMapReplace);