
      // == Some global variables ==
      var YSLIDERLENGTH = 100;       // maximum length that the knob can move (slide height minus knob height)
      var MAXZOOM = 10;
      var flag=1;
      var temp=0;
      var zoomlevel=10;

      // == Create a Custom GControl ==
      function YSliderControl() { }
      YSliderControl.prototype = new GControl();

      // == This function positions the slider to match the specified zoom level ==
      YSliderControl.prototype.setSlider = function(zoom,type)
       {
            if(zoom==10)
            {
                this.knob.style.top=0+"px";               
                this.slide.top = 0;
            }
            
            else if(zoom==11)
            {               
                 this.knob.style.top=25+"px";                 
                 this.slide.top = 25;
            }
            else if(zoom==12)
            {
                this.knob.style.top=50+"px";                
                this.slide.top = 50;
            }
            else if(zoom==13)
            {           
                this.knob.style.top=75+"px";                
                this.slide.top = 75;
            }
            else if(zoom==14)
            {
                this.knob.style.top=100+"px";               
                this.slide.top =100;                
            }    	    
		
      }

      // == This function reads the slider and sets the zoom level ==
      YSliderControl.prototype.setZoom = function()
      {      
            var sub=this.knob.style.top;            
            if(this.knob.style.top==100)
            at=100;
            
            var at=sub.substring(0,Math.ceil((sub.length/3)));       
	    if(sub=='100px')
            {
                at = 90;
            }            
            if(at>=0 && at<=7)
            {
                this.knob.style.top=0+"px";
                zoomlevel=10;
                this.slide.top = 0;
            }
            
            else if(at>7 && at<25)
            {               
                 this.knob.style.top=25+"px";
                  zoomlevel=11;
                  this.slide.top = 25;
            }
            else if(at>25 && at<50)
            {
                this.knob.style.top=50+"px";
                 zoomlevel=12;
                 this.slide.top = 50;
            }
            else if(at>50 && at<75)
            {           
                this.knob.style.top=75+"px";
                zoomlevel=13;
                this.slide.top = 75;
            }
            else if(at>75 && at<100)
            {
                this.knob.style.top=100+"px";
                zoomlevel=14;
                this.slide.top = 100;
            }
             this.map.setZoom(zoomlevel);
      }
	  	  
      // == This gets called bu the API when addControl(new YSlider()) is used ==
      YSliderControl.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.height="100%";
        container.setAttribute("className","sliderBg");
        container.setAttribute("class","sliderBg");
        // Handle transparent PNG files in MSIE

		// create sliderBar
        var sliderBar = document.createElement("div");
        sliderBar.setAttribute("className","sliderBar");
        sliderBar.setAttribute("class","sliderBar");
		sliderBar.innerHTML = '<img src="../Images/mapPage/slider/slider.gif" width=14 height=109 />';
		
		var zoomOutDiv = document.createElement("div");
		container.appendChild(zoomOutDiv);
		zoomOutDiv.innerHTML = '<img src="../Images/mapPage/slider/slider-minus.gif" class="sliderMinus transparentHover" />';
		GEvent.addDomListener(zoomOutDiv, "click", function() {
		map.zoomOut();
		});			
		
		container.appendChild(sliderBar);

		var zoomInDiv = document.createElement("div");
		container.appendChild(zoomInDiv);
		zoomInDiv.innerHTML = '<img src="../Images/mapPage/slider/slider-plus.gif" class="sliderPlus transparentHover" />';
		GEvent.addDomListener(zoomInDiv, "click", function() {
		if(map.getZoom()!=14)
		{
		    map.zoomIn();
		}
		});
		
		// create the knob as a GDraggableObject

		this.knob = document.createElement("img"); 
		this.knob.src = "../Images/mapPage/slider/slider-bar.gif";
		this.knob.height = "9";
		this.knob.width = "20";
		this.knob.style.marginLeft = "-3px";
		  
		  
        sliderBar.appendChild(this.knob);
        this.slide=new GDraggableObject(this.knob, {container:sliderBar});

        // 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,1)});

        // 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 ==
      YSliderControl.prototype.getDefaultPosition = function()
      {
      
		return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(0, 0));
      }

