<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>MapServer Layer</title>
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
    <link rel="stylesheet" href="style.css" type="text/css" />
    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
    
    //CLICK LOGIC
      OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {                
                defaultHandlerOptions: {
                    'single': true,
                    'double': false,
                    'pixelTolerance': 0,
                    'stopSingle': false,
                    'stopDouble': false
                },

                initialize: function(options) {
                    this.handlerOptions = OpenLayers.Util.extend(
                        {}, this.defaultHandlerOptions
                    );
                    OpenLayers.Control.prototype.initialize.apply(
                        this, arguments
                    ); 
                    this.handler = new OpenLayers.Handler.Click(
                        this, {
                            'click': this.trigger
                        }, this.handlerOptions
                    );
                }, 

                trigger: function(e) {
                    var lonlat = map.getLonLatFromViewPortPx(e.xy);
                    alert("You clicked near " + lonlat.lat + " N, " +
                                              + lonlat.lon + " E");
                }

            });
        //END OF CLICK
       
        var map, urban,lakes,states,roads,vectors;

        function init(){
            map = new OpenLayers.Map('map',{maxResolution: 'auto'});
            map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':true}));                      
            map.addControl(new OpenLayers.Control.ScaleLine());
            map.addControl(new OpenLayers.Control.Scale());
            map.addControl(new OpenLayers.Control.MousePosition());
            map.addControl(new OpenLayers.Control.OverviewMap());
            map.addControl(new OpenLayers.Control.KeyboardDefaults());
                          
                
                
            vectors = new OpenLayers.Layer.Vector( "Vector Layer",{isBaseLayer: false,visibility:false});                         
            
            urban = new OpenLayers.Layer.WMS( "Urban Areas", 
                    "http://localhost/cgi-bin/mapserv.exe?", 
                    {map: 'C:/mapdata/third.map',layer:'urbanareas'},{isBaseLayer:false,visibility:false,singleTile: true,transparent: 'true'});
            
            lakes = new OpenLayers.Layer.WMS( "Lakes", 
                    "http://localhost/cgi-bin/mapserv.exe?", 
                    {map: 'C:/mapdata/third.map',layer:'lakes'},{isBaseLayer:false,visibility:false,singleTile: true,transparent: 'true'});
            
            states = new OpenLayers.Layer.WMS( "States", 
                    "http://localhost/cgi-bin/mapserv.exe?", 
                    {map: 'C:/mapdata/third.map',layer:'states'},{singleTile: true});
            
            roads = new OpenLayers.Layer.WMS( "Roads", 
                    "http://localhost/cgi-bin/mapserv.exe?", 
                    {map: 'C:/mapdata/third.map',layer:'roads'},{isBaseLayer:false,visibility:false,singleTile: true,transparent: 'true'}); 
                                                     
                      
            map.addLayers([urban, lakes, states,roads,vectors]);
            map.setBaseLayer(layer3);
            
            var panel = new OpenLayers.Control.EditingToolbar(vectors);
            map.addControl(panel);
           
            var click = new OpenLayers.Control.Click();
                map.addControl(click);
                click.activate();
                var panel = new OpenLayers.Control.EditingToolbar(vectors);
            map.addControl(panel);
        }
        
    </script>
  </head>
  <body onload="init()">
    
    <div id="map" class="smallmap"></div>
    
    </div>
  </body>
</html>