// JavaScript Document

function showResultFlag(marker, html, width)
{
	var count = String.fromCharCode(html+64);
	var html_ = '<span class="cluster_count">' + count + '</span>';	
	return addResultToMarker(marker, html_, width, 0)
}

function showCounter(marker, html, width)
{
	return addResultToMarker(marker, html, width, 3);
}

function removeResultFromMarker(marker)
{
	if (marker) {
		marker.DeleteAllShapes();
	}
}

function addResultToMarker(marker, html, width, tp) 
{
	var html_ = html;	
	var shape = marker.GetShapeByIndex(0);
	var pts = shape.GetPoints();		
	var pixelLocation = map.LatLongToPixel(pts[0]);	
	var zIndex = shape.GetZIndex();

	if (!tp) tp = 0;

	var sty = "position:absolute;left:" + pixelLocation.x + 15 + "px";
	sty = sty + ";top:" + pixelLocation.y - 20 + "px";
	sty = sty + ";background:transparent url(/findagent/img/icon_flag.png) no-repeat top right;";
	sty = sty + ";font:bold 12px/12px \"Helvetica Neue\",Helvetica, arial, sans";
	sty = sty + ";color:#d4021f";
	sty = sty + ";textAlign:center";
	sty = sty + ";padding:" + tp + "px 5px 7px 3px;margin:0 0 0 25px";
	sty = sty + ";width:auto";
	sty = sty + ";height:50px";
	sty = sty + "zIndex:" + zIndex + 1;
	sty = sty + ";display:block;";
	var div = "<div style='" + sty + "'>" + html_ + "</div>";
	
	var rf = new VEShape(VEShapeType.Pushpin, pts[0]);
	rf.SetCustomIcon(div);
	//var l = new VEShapeLayer();
	//l.AddShape(rf);
	//marker.ResultLayer = l;
	marker.AddShape(rf);
	return marker;
}
