text: (function($){
  	$(function() {
  		//定位城市
  		var currentCity = '';
  		(new BMap.LocalCity()).get(function(result){
  			currentCity = result.name || '南京';
  		});
  
  		//点击搜索框进行搜索
  		$('#search').on('click',function() {
  			if ($('#guider').css('visibility') == 'visible') {
  				$('#guider').css('visibility','hidden');
  			}
  			var addressLeft = (parseInt($('.top').width()) - parseInt($('#address').width()))/2;
  			$('#address')
  				.css({position:'absolute',top: $(this).position().top,left: addressLeft})
  				.animate({top: '0px',left: '0px'},'slow',function() {
  					$('#result').removeClass('hidden');
  					$('#bd-map').removeClass('hidden');
  					//加载地图
  					$('#bd-map').removeClass('hidden');
  					//实例化地图
  					var map = new BMap.Map("bd-map");
  					//设置result的高度与地图一致
  					$('#result').css({height:$('#bd-map').height()});
  					//获取用户输入的地址
  					var searchAddress = $('#searchKeywords').val();
  					//创建解析器
  					var myGeo = new BMap.Geocoder();
  		    		myGeo.getPoint(searchAddress, function(point) {
  		    			if (point) {
  		    				var address = new BMap.Point(point.lng, point.lat);
  		    				map.centerAndZoom(address, 15);
  		    				var marker = new BMap.Marker(address);
  				    		map.addOverlay(marker);
  				    		//同时，这个时候请求接口获取改区域附近有多少家店
  				    		$.ajax({
  						      	 type: "POST",
  						         url: _config.getNearbyCountUrl,
  						         data:{'_csrf':_config.csrf},
  						         success: function(obj) {
  						        	console.log(obj);
  						            if (parseInt(obj.errorCode) == 0) {
  						            	var sContent = $('#map-window-info').html();
  							    		var infoWindow = new BMap.InfoWindow(sContent);  //创建信息窗口对象
  							    		//绑定事件
  							    		marker.addEventListener("click", function() {
  							    			this.openInfoWindow(infoWindow);
  							    		});
  						            }else{
  						            	console.log(obj);
  						            }
  						         }
  						   	});
  		    			}
  		    		}, currentCity);			    	
  				});
  		});
  
  		//点击搜索框的相关事件
  		$('#searchKeywords').on('focus',function(){
  			$('#guider .bg').addClass('search');
  		});
  
  		//绑定百度搜索提示
  		var ac = new BMap.Autocomplete({
  			'input':'searchKeywords',
  			'location':currentCity
  		});
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  	})
  })(jQuery);