//zoomer
function Zoomer(x,y){
	   this.left = x;
	   this.top = y;
	   this.toplimit = 34;
	   this.botlimit = 150;

	   this.k = (this.botlimit - this.toplimit)/(map.levels - 1)
	   var dk = this.k/map.edge

	   this.create = function(){
			var fragment = document.createDocumentFragment();
		   this.div =  document.createElement("div");
		   this.div.id = "zoomdiv";
		   this.div.style.left = this.left+"px";
		   this.div.style.top = this.top+"px";
		   
		   this.scale = document.createElement("img");
		   this.scale.src = "/images/scale.gif"
		   this.scale.id = "scale";
		   this.scale.width = 16;
		   this.scale.height = 135;
		   fragment.appendChild(this.scale);
	       this.zoomin = document.createElement("img");
		   this.zoomin.src = "/images/zoomin.gif"
		   this.zoomin.id = "zoomin";
		   this.zoomin.width = 18;
		   this.zoomin.height = 18;
		   this.zoomin.onclick = function(){zoom.move(1);}
		   fragment.appendChild(this.zoomin);
	       this.zoomout = document.createElement("img");
		   this.zoomout.src = "/images/zoomout.gif"
		   this.zoomout.id = "zoomout";
		    this.zoomout.width = 18;
		   this.zoomout.height = 18;
		   this.zoomout.onclick = function(){zoom.move(-1);}
		     fragment.appendChild(this.zoomout);
	
		  // this.scale.onclick = function(){zoom.handle(1);}
		   this.zoomer =  document.createElement("img");
		   this.zoomer.src = "/images/zoomer.gif"
		   this.zoomer.id = "zoomer";
		   this.zoomer.width = 26;
		   this.zoomer.height = 9;
		     fragment.appendChild(this.zoomer);
		   
		   this.div.appendChild(fragment);
		   document.getElementById("overmap").appendChild(this.div);
		   this.show();
		   this.update();
	   }
	   this.show = function(){
	       this.setParam("left",6)
   	       zoomDrag.init(this.zoomer);
	   }
	   this.update = function(){
	   		var t = Math.floor(this.toplimit - map.edge*dk + map.level*this.k);
			t = (t > this.botlimit) ? this.botlimit : t;
			t = (t < this.toplimit) ? this.toplimit : t;
			this.setParam("top",t);
          // this.top = (this.top < this.toplimit) ? this.toplimit : this.top;
	   }
       this.setParam = function(attr, value){             //параметры кусков карты
	      if (attr == "left") {
	 	        this.left = value;
	          this.zoomer.style.left = value+"px";
	      }
	 	    if (attr == "top") {
	 	        this.top = value;
	          this.zoomer.style.top = value+"px";
	      }
	   }
}