Boxes Example Vector - With Drupal Method

http://openlayers.org/dev/examples/boxes-vector.html

by Mike Gifford

HTML

<script src="http://fbug.googlecode.com/svn/lite/branches/flexBox/content/firebug-lite-dev.js"></script>
<script src="openconcept.ca/sites/openconcept.ca/files/openlayers/lib/OpenLayers.js"></script>
<link rel="stylesheet" href="openconcept.ca/sites/openconcept.ca/files/openlayers/OpenLayers-default.css">
<link rel="stylesheet" href="openconcept.ca/sites/openconcept.ca/files/openlayers/OpenLayers.css">
<script src="http://openconcept.ca/misc/drupal.js"></script>
<script src="http://openconcept.ca/misc/jquery.once.js"></script>
       <h1 id="title">Boxes Example Vector - With Drupal Method</h1>

        <div id="tags">
            box, vector, annotation, light
        </div>

        <p id="shortdesc">
            Demonstrate marker and box type annotations on a map.
        </p>
       

<h1 id="title">AddLayers</h1> 
<div id="map" class="smallmap"></div> 
<div id="info"></div>

        <div id="docs"></div>

  <br />
  <p><a href="http://openlayers.org/dev/examples/boxes-vector.html">Original
  OpenLayers Example</a>.</p>

JavaScript

jQuery(function() {

    var map;

    //Attach this new method to jQuery
    jQuery.fn.extend({
        //This is where you write your plugin's name
        myMap: function() {

            var lon = 5;
            var lat = 40;
            var zoom = 2;

            OpenLayers.Lang.setCode('en');

            map = new OpenLayers.Map('map', {
                div: jQuery(this).attr('id'),
                controls: [
                    new OpenLayers.Control.Navigation()
                    ]
            }
                    );

            var wms = new OpenLayers.Layer.WMS('OpenLayers WMS', 'http://vmap0.tiles.osgeo.org/wms/vmap0', {
                layers: 'basic'
            });
            map.addLayers([wms]);

            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);

        }
    });
    jQuery('#map').myMap();

});