- }
-
- function round(v,n)
- {
- n = Math.pow(10,n);
- return Math.round(v*n)/n;
- }
- function floor(v,n)
- {
- n = Math.pow(10,n);
- return Math.floor(v*n)/n;
- }
- function ceil(v,n)
- {
- n = Math.pow(10,n);
- return Math.ceil(v*n)/n;
- }
-
- function mapEventMove() {
- var proj = new OpenLayers.Projection("EPSG:4326");
- var bounds = map.getExtent();
- bounds = bounds.transform(map.getProjectionObject(), proj);
- $('viewbox').value = floor(bounds.left,2)+','+ceil(bounds.top,2)+','+ceil(bounds.right,2)+','+floor(bounds.bottom,2);
- }
-
- function init() {
- handleResize();
- map = new OpenLayers.Map ("map", {
- controls:[
- new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PanZoomBar(),
- new OpenLayers.Control.MousePosition(),
- new OpenLayers.Control.Attribution()],
- maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
- maxResolution: 156543.0399,
- numZoomLevels: 19,
- units: 'm',
- projection: new OpenLayers.Projection("EPSG:900913"),
- displayProjection: new OpenLayers.Projection("EPSG:4326"),
- eventListeners: {
- "moveend": mapEventMove
- }
- } );
- map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default"));
-
- var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
- layer_style.fillOpacity = 0.2;
- layer_style.graphicOpacity = 1;
- vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
- map.addLayer(vectorLayer);
-
-// var lonLat = new OpenLayers.LonLat(<?php echo $fLon ?>, <?php echo $fLat ?>).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
-// map.setCenter (lonLat, <?php echo $iZoom ?>);
- }
-
- function setfocus(field_id) {
- $(field_id).focus()
- }
-
- </script>
-</head>