      // == Some global variables ==
      var CUSTOMSLIDERLENGTH = 300;       // maximum length that the knob can move (slide height minus knob height)
      var MAXZOOM = 15

      // == Create a Custom GControl ==
      function CustomSliderControl() { }
      CustomSliderControl.prototype = new GControl();

      // == This function positions the slider to match the specified zoom level ==
      CustomSliderControl.prototype.setSlider = function(zoom) {
        var top = Math.round(CUSTOMSLIDERLENGTH-(CUSTOMSLIDERLENGTH/MAXZOOM*zoom));
        this.slide.top = top;
        this.knob.style.top = top+"px";
        //GLog.write("Map was zoomed to:"+zoom+" new Knob position:"+top);
      }

      // == This function reads the slider and sets the zoom level ==
      CustomSliderControl.prototype.setZoom = function() {
        var z=Math.round((CUSTOMSLIDERLENGTH-this.slide.top*MAXZOOM)/CUSTOMSLIDERLENGTH);
        this.map.setZoom(z);
        //GLog.write("New knob position:"+this.slide.top+" new zoom: "+z);
      }


      // == This gets called bu the API when addControl(new CustomSlider()) is used ==
      CustomSliderControl.prototype.initialize = function(map) {
        // obtain Function Closure on a reference to "this"
        var that=this;
        // store a reference to the map so that we can call setZoom() on it
        this.map = map;

        // create the background graphic as a <div> containing an image
        var container = document.createElement("div");
        container.style.width="25px";
        container.style.height="300px";
        container.style.backgroundImage = "URL('http://www.whereables.co.uk/graphics/zoomslide.png')"

        // create the knob as a GDraggableObject
        this.knob = document.createElement("img"); 
        this.knob.src = "http://www.whereables.co.uk/graphics/zoomknob.png";
        container.appendChild(this.knob);
        this.slide=new GDraggableObject(this.knob, {container:container});

        // attach the control to the map
        map.getContainer().appendChild(container);

        // Listen for other things changing the zoom level and move the slider
        GEvent.addListener(map, "zoomend", function(a,b) {that.setSlider(b)});

        // Listen for the slider being moved and set the zoom level
        GEvent.addListener(this.slide, "dragend", function() {that.setZoom()});

        return container;
      }

      // == Set the default position for the control ==
      CustomSliderControl.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
      }


