+ handleResize();
+ }
+
+ function getPosition() {
+ return mercatorToLonLat(map.getCenter());
+ }
+
+ function setPosition(lat, lon, zoom) {
+ var centre = lonLatToMercator(new OpenLayers.LonLat(lon, lat));
+
+ map.setCenter(centre, zoom);
+
+ if (marker)
+ removeMarkerFromMap(marker);
+
+ marker = addMarkerToMap(centre, getArrowIcon());
+ }
+
+ function updateLocation() {
+ var lonlat = mercatorToLonLat(map.getCenter());
+ var zoom = map.getZoom();
+ var layers = getMapLayers();
+
+ updatelinks(lonlat.lon, lonlat.lat, zoom, layers);
+
+ document.cookie = "location=" + lonlat.lon + "," + lonlat.lat + "," + zoom + "," + layers;
+ }
+
+ function resizeContent() {
+ var content = $("content");
+ var rightMargin = parseInt(getStyle(content, "right"));
+ var bottomMargin = parseInt(getStyle(content, "bottom"));
+
+ content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
+ content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
+ }
+
+ function resizeMap() {
+ var centre = map.getCenter();
+ var zoom = map.getZoom();
+ var sidebar_width = $("sidebar").offsetWidth;
+
+ if (sidebar_width > 0) {
+ sidebar_width = sidebar_width + 5
+ }
+
+ $("map").style.left = (sidebar_width) + "px";
+ $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
+ $("map").style.height = ($("content").offsetHeight - 2) + "px";
+
+ map.setCenter(centre, zoom);
+ }
+
+ function handleResize() {
+ if (brokenContentSize) {
+ resizeContent();
+ }