var mapObj = null;
function mapInit(latitude, longitude) {
	var mapoption = new MMapOptions();
	if (latitude == '108.889159' && longitude == '34.172726') {
		mapoption.zoom = 4;// 设置地图zoom级别
	} else {
		mapoption.zoom = 11;// 设置地图zoom级别
	}
	mapoption.center = new MLngLat(latitude, longitude);
	mapoption.toolbar = DEFAULT; // 设置工具条
	mapoption.toolbarPos = new MPoint(0, 0);
	mapoption.overviewMap = SHOW; // 设置鹰眼
	mapoption.returnCoordType = COORD_TYPE_OFFSET;
	mapoption.isCongruence = true;
	mapoption.hasDefaultMenu = true;
	mapObj = new MMap("map", mapoption); // 地图初始化

}

function addMarker(longitude, latitude, title, content, id) { // 画点

	var content = content;
	var title = title;

	var tipOption = new MTipOptions();
	tipOption.title = title;
	tipOption.content = content;// tip内容

	var markerOption = new MMarkerOptions();
	markerOption.imageUrl = "http://code.mapabc.com/images/lan_1.png";

	var labelOption = new MLabelOptions();
	labelOption.content = id;

	markerOption.labelOption = labelOption; // 标注
	markerOption.imageAlign = MIDDLE_CENTER;// 设置图片锚点相对于图片的位置
	markerOption.tipOption = tipOption;
	markerOption.isDimorphic = true;// 可选项，是否具有二态，默认为false即没有二态
	markerOption.dimorphicColor = 0x046788;
	markerOption.canShowTip = true;
	var MLngLatXY = new MLngLat(longitude, latitude);
	var Mmarker = new MMarker(MLngLatXY, markerOption);
	Mmarker.id = "mark" + id;// mark必须存在否则IE不兼容
	mapObj.addOverlay(Mmarker, true);
	var Mstyle = new MLabelOptions();
	Mstyle.borderColor = '0x000000';
	Mstyle.backgroundColor = '0xff0000';
}

function addMarkers() {
	var i = 0;
	mapObj.removeAllOverlays();
	$(".agent_list_box").each(
			function(i) {
				var xyindex = $(this).children("span").attr("title");
				var xy = xyindex.split("|");
				id = i + 1;
				addMarker(xy[0], xy[1], $(this).children("a").text(), $(this).children("span").text(), id);
			});
}