utils.map = {
		_map : null,
		_mark : null,
		_infowindow : null,
		addressInfo : null,
		/**
		 * 标记点
		 * options : 当address 和 latLng 都未填写时，默认为公司地理位置 
			 * address : 地理信息位置 for ex : 湖南省岳阳市  地图默认定位于对应地址
			 * latLng : {
			 * 				lat : 地图初始显示纬度
			 * 				lng : 地图初始显示经度			
			 * 			}
			 * width : 页面显示宽度
			 * height : 页面显示高度
			 * isDrag : 是否可以拖动 true/false
			 * showbg : 是否显示遮罩层 true/false
			 * isShowInfoWindow : 是否显示当前标记点在地图上的地理位置信息
			 * title : 窗体标题显示信息
		 * 
		 * sureCB : 确定标记地标后回调  function(addressInfo){}  返回函数中带有地理位置返回信息
		 * cancelCB : 取消回调
		 */
		signMarker : function(options ,  sureCB , cancelCB){
			tipsWindown(options.title,'text:'+utils.map.mapHtml() , options.widht , options.height , options.isDrag +'' , "" , 'true',"" , cancelCB);	
			setTimeout(function(){
				utils.map.init(options ,  sureCB , cancelCB);
			},500);
		},

		/**
		 * 地图显示页面装载
		 */
		mapHtml : function(){
			var _html = '<div class="wrap_map">' +
							'<div id="flag_wrap_map" style="height: 362px;width: 736px;">'+
							'</div>'+
						'</div>';
			return _html;
		},
		
		/**
		 * 装载地图
		 */
		init : function(options , sureCB , cancelCB){
			utils.map._map = createMap($('#flag_wrap_map')[0] , 'flag_wrap_map' , options.latLng.lat , options.latLng.lng , 15 , google.maps.MapTypeId.ROADMAP);
			utils.map._mark = drawMarker(options.latLng.lat , options.latLng.lng , '标注点' , null , utils.map._map , true);
			if(options.isShowInfoWindow){
				google.maps.event.addListener(utils.map._map, 'click', function(e) {
					utils.map._mark.setPosition(e.latLng);
					utils.map.geoAddressFromLatLng(e.latLng , e.latLng.lng() , e.latLng.lat());
	                utils.map._map.setCenter(e.latLng);
	            });
	            utils.map.geoAddressFromLatLng(new google.maps.LatLng(options.latLng.lat , options.latLng.lng) , options.latLng.lng , options.latLng.lat);
			}
		},
		
		geoAddressFromLatLng : function(myLatlng , lng , lat){
		    var geocoder = new google.maps.Geocoder();
		    geocoder.geocode({'latLng': myLatlng}, function(results, status) {
		        var _addressInfo = '';
		        if (status == google.maps.GeocoderStatus.OK) {
		            if (results[0]) {
		                _addressInfo = results[0].formatted_address;
		                utils.map.info = results[0];
		                var contentString = '<div class="pop_shareNewsContWrap" style="height:180px; width:240px;line-height:1.6;"><h2 style="font-size:14px;" class="greenFont">' + _addressInfo +
		                                    '</h2><p style="width:auto;line-height:20px;">纬度：'+lng+' 经度：'+lat+'</p></div>';
		                if(!utils.map._infowindow){
		                	utils.map._infowindow = new google.maps.InfoWindow({
			                    position: myLatlng,
			                    content: contentString,
			                    size: new google.maps.Size(230, 90)
		                    });
		                }
		                utils.map._infowindow.setContent(contentString);
		                utils.map._infowindow.setPosition(myLatlng);
		                utils.map._infowindow.open(utils.map._map);
		            }
		        }else {
		            _addressInfo = "无此地理信息描叙!";
		        }
		    });
		},
		
		geoAddressFromAddress : function(address){
		    var geocoder = new google.maps.Geocoder();
		    geocoder.geocode( { 'address': address}, function(results, status) {
		        if (status == google.maps.GeocoderStatus.OK) {
		        	_addressInfo = results[0].formatted_address;
	                utils.map.info = results[0];
	                var contentString = '<div class="pop_shareNewsContWrap" style="height:180px; width:240px;line-height:1.6;"><h2 style="font-size:14px;" class="greenFont">' + _addressInfo +
	                                    '</h2><p style="width:auto;line-height:20px;">纬度：'+lng+' 经度：'+lat+'</p></div>';
	                if(!utils.map._infowindow){
	                    infowindow = new google.maps.InfoWindow({
		                    position: myLatlng,
		                    content: contentString,
		                    size: new google.maps.Size(230, 90)
	                    });
	                }
	                utils.map._infowindow.setContent(contentString);
	                utils.map._infowindow.setPosition(myLatlng);
	                utils.map._infowindow.open(map);
		        } else {
		        	_addressInfo = "无此地理信息描叙!";
		        }
		    });
		}
};
