/**
 * Map地图类
 * lat 维度
 * lng 经度
 **/
var GMap = function(obj_name,map_div_id,center_info,zoom){
	var self = this;
	this._obj_name = obj_name;		// 当前对象自身的名称
	this._map_div_id = map_div_id;	// 地图载入控件名
	this._map_div_obj = null;		// 地图载入控件对象
	this._center_info = center_info;	// 地图中心点
	this._center = null;			// 中心点对象
	this._zoom = 14;				// 缩放
	this.gMap = null;				// Google地图对象
	// 处理参数
	if( zoom!=undefined&&zoom!=null&&zoom>5&&zoom<20 ){
		this._zoom = zoom;
	}
	// 初始化
	this.initialize = function(){
		var self = this;
		if( this._obj_name=="" ){
			alert("Map：未指定当前对象自身的名称");
			return false;
		}
		if( !getElementById(this._map_div_id) ){
			alert("Map：地图载入控件ID不正确");
			return false;
		}
		this._map_div_obj = getElementById(this._map_div_id);
		this._center = new GLatLng(this._center_info['lat'], this._center_info['lng']);
		// 创建地图
		var zoom = parseInt(this._zoom,10);
		this.gMap = new google.maps.Map2(this._map_div_obj);
		this.gMap.setCenter(this._center, zoom);
		this.gMap.addControl(new GLargeMapControl());
		this.gMap.addControl(new GOverviewMapControl());
		//this.gMap.addControl(new GMapTypeControl());
		this.gMap.addControl(new GLargeMapControl3D());
		GEvent.addListener(this.gMap,"infowindowopen",function(){
			changeInfoWindowStyle();
		});
	};
	
	// 新创建标记
	this.newMarker = function(center,img,img_w,img_h){
		var GSmallIcon = new GIcon(G_DEFAULT_ICON);
		GSmallIcon.image = img;
		GSmallIcon.iconSize = new GSize(img_w,img_h);
		marker = new GMarker(center, {draggable: true,icon:GSmallIcon});
		this.gMap.addOverlay(marker);
		return marker;
	};
	this.initialize();
};