var defaultZoom = 17;
var map,infoWin=null;
var defaultSize = [20,34];

function initHome() {
	createMap();
}
function createMap() {
	map = new SE_Maps("mapDiv");
	map.centerAndZoom("北京",11);
	// 添加标准控件，骨头棒
	map.addControl(new SE_StandMapControl());
    // 比例尺
	var scale = new SE_ScaleControl();
	scale.setLeft(10);
	scale.setBottom(10);
	map.addControl(scale);
	// 添加 卫图和矢量控件
	var control1 = new SE_SwitchControl();
	map.addControl(control1);
	map.removeMapType(SE_Traffic_MAP);
	map.setMapType(SE_NORMAL_MAP);
	control1.setRight(5);
	
	map.removeControl(map.logoControl);
	
	// 绑定事件，在双击的时候先执行放大操作
	SE_Event.bind(map, "dblclick", map, function(point,config) { if (config&&!config.isStop) this.zoomIn(); });
	// 鼠标滚动
	map.handleMouseScroll(true);
	// 键盘事件
	map.handleKeyboard();
	
	var defaultSize = [20,34];
//	var markIcon = new SE_Icon("/web/img/poi.png", defaultSize);
	var markIcon = new SE_Icon();
    var marker = new SE_Marker(map.getCenterPoint(), markIcon);
    marker.setBackgroundColor("");
	marker.setBorderLine(0);
	marker.iconSize = defaultSize;
	map.addOverLay(marker);
	showInfoWin(marker.getPoint());
	SE_Event.bind(marker, "click", marker, function(point){showInfoWin(this.getPoint());});
//	SE_Event.bind(marker, "click", marker, function(point){showInfoWin(map.fromContainerPixelToLatLng(point));});
}
function showInfoWin(point) {
	if (infoWin!=null){map.removeOverLay(infoWin,true);}
	infoWin = new SE_InfoWindow(point,[0,-35]);
	infoWin.setHeight(40);
	infoWin.setTitle("<div class='meta-info'>MapEnjoy 地图 API</div>");
//	infoWin.setLabel('<div class="hidden"><a href="/web/index.shtml?apikey">申请</a> 使用MapEnjoy地图API密钥。</div>');
	infoWin.setLabel('<div>欢迎使用国内唯一一家拥有高分辨率影像的BSEI地图API！</div>');
	map.addOverLay(infoWin);
	infoWin.moveToShow();
}
