  function ClusterControl() { }
  ClusterControl.prototype = new GControl();

  var control_width=104;
  var clusterControlContainer;

  ClusterControl.prototype.initialize = function(map) {
  	clusterControlContainer = document.createElement("div");

  	var padding=10;
  	var size_of_direction_label = 25;
  	var width = map.getSize().width;
  	var middle_w = 0;
  	if (width > 0) middle_w = width/2 - size_of_direction_label;

  	var height = map.getSize().height;
  	var middle_height = 0;
  	if (height > 0) middle_height = height/2;

  	clusterControlContainer.id = "cluster-control";

	var x=0;
	var y=0;

	clusterControlContainer.style.position="absolute";
	clusterControlContainer.style.left=x+"px";
	clusterControlContainer.style.top=y+"px";

	var img_cluster_slide = document.createElement('img');
	img_cluster_slide.id = "cluster-control-slide";
  	img_cluster_slide.src = imagesPrefix + "cluster_slide.png";
  	//this.setButtonStyle(img_cluster_slide, 22, 7);
  	clusterControlContainer.appendChild(img_cluster_slide);
  	GEvent.addDomListener(img_cluster_slide, "click", function() {
  		
  		log("click slide cluster");
  		startWaitDisplay();
		nextZoom=maxZoomLevel;
		log("click avatar");
		freeze();
		var content;
		//focusedMarker.setImage("/style/felicity/carto/people/cluster/cluster_M.png");
		GDownloadUrl("/geo/item.avatar-set.jsp?avatars="+focusedAvatars+"&offset=0", function(content, responseCode) {
			focusedMarker.openExtInfoWindow(gmap,"simple_example_window",content,{beakOffset: 3, paddingX: 0, paddingX: 0});
			initMM("/geo/item.avatar-set.jsp?avatars="+focusedAvatars,gmap.getExtInfoWindow().infoWindowId_ + '_contents');
			unfreeze();
		});
		$('#map-control').hide();
	 });
  	var img_cluster_zoomin = document.createElement('img');
  	img_cluster_zoomin.id = "cluster-control-zoom";
  	img_cluster_zoomin.src = imagesPrefix + "cluster_zoom.png";
  	//this.setButtonStyle(img_cluster_zoomin, 63, 7);
  	clusterControlContainer.appendChild(img_cluster_zoomin);
  	GEvent.addDomListener(img_cluster_zoomin, "click", function() { 
  		//clusterControl.hide();
  		setZoom('+');
  	});
  	  	
  	map.getContainer().appendChild(clusterControlContainer);

  	GEvent.addDomListener(clusterControlContainer, "mouseover", function() {
  		overCluster();
	});
  	GEvent.addDomListener(img_cluster_slide, "mouseover", function() {
  		overCluster();
	});
	GEvent.addDomListener(img_cluster_zoomin, "mouseover", function() {
  		overCluster();
	});

  	GEvent.addDomListener(clusterControlContainer, "mouseout", function() {
  		outOfCluster();
	});
  	GEvent.addDomListener(img_cluster_slide, "mouseout", function() {
  		outOfCluster();
	});
	GEvent.addDomListener(img_cluster_zoomin, "mouseout", function() {
  		outOfCluster();
	});

  	return clusterControlContainer;
  }

  ClusterControl.prototype.getDefaultPosition = function() {
  	var x=-1000;
	var y=-1000;
  	if(focusedPixel!=null){
	  	x=parseInt(focusedPixel.x)-(control_width/2);
	  	y=parseInt(focusedPixel.y);
	}

  	return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x, y));
  }

  ClusterControl.prototype.show = function() {
	var x=parseInt(focusedPixel.x)-(control_width/2);
	var y=parseInt(focusedPixel.y)+8;
  	clusterControlContainer.style.left=x+"px";
	clusterControlContainer.style.top=y+"px";
     $('#cluster-control').show();
	$('#map-control').hide();
  }

  ClusterControl.prototype.hide = function() {
     $('#cluster-control').hide();
	  $('#map-control').show();
  }

  // Sets the proper CSS for the given button element.
  ClusterControl.prototype.setButtonStyle = function(button, top_pos, left_pos) {
  	button.style.top = top_pos + "px";
  	button.style.left = left_pos + "px";
  	button.style.position = "absolute";
  	button.style.cursor = "pointer";
  }


