<!--<?php
require($this->getSegmentFile('manage.nav'));
print <<<EOT
-->
<script type="text/javascript">
function searchHoseByKeywords() {
	var cityName = mapframe.Trim($('cityName').value); 
	var cityCode = mapframe.city.ctn2c(cityName);
	var keyword = mapframe.Trim($('search_keyword').value); 
	if (cityName == null || cityName == '' || cityName == 'undefined') {
		alert("城市不能为空");
		return;
	}
	if (keyword == null || keyword == '' || keyword == 'undefined') {
		var xy = new Array();
		xy = mapframe.city.ctxy(cityCode);
		mapframe.mapObj.setZoomAndCenter(11,new mapframe.MLngLat(xy[0],xy[1]));
		return;
	}
	mapframe.mapSearcherObj.keyword = keyword;
	mapframe.mapSearcherObj.cityname = cityName;
	mapframe.mapSearcherObj.citycode = cityCode
	mapframe.mapSearcherObj.searchPointBykeywords();
}

function clearSearchResult () {
	var arr = mapframe.mapObj.getOverlaysByType(mapframe.MOverlay.TYPE_MARKER);
	for(var i = 0; i < arr.length; i++){
		var markerObjId = arr[i].id;
		if(markerObjId.match(mapframe.searchPointsTag)){
			mapframe.mapObj.removeOverlay(arr[i]);
		}
	}
}

function startTracePoint(obj){
	 mapObj = mapframe.mapObj
	 if (mapObj != null && mapObj != 'undefined' && mapObj != '') {
		 var value = obj.value;
		 if(value=='点击开启标注点'){
			 mapObj.addEventListener(mapObj,mapframe.MOUSE_CLICK,clickMouse);
			 obj.innerHTML = "点击关闭标注点";
			 obj.value = '点击关闭标注点';
		 }else{
			 mapObj.removeEventListener(mapObj,mapframe.MOUSE_CLICK,clickMouse);
			 obj.innerHTML = "点击开启标注点";
			 obj.value = '点击开启标注点';
		 }
	 }
}

function clickMouse(param){
	/* 设置描点坐标 */
	getPointPosition(param);
	
	/* 删除其他描点 */
	mapframe.clearPointsByIds(mapframe.clickPointIds);
	
	/* 创建point对象 */
	var mapPointObj = new mapframe.mapPoint();
	mapPointObj.point_x = param.eventX;
	mapPointObj.point_y = param.eventY;
	mapPointObj.showTip = false;
	mapPointObj.canMove = true;
	mapPointObj.pointId = 'clickpoint';
	mapPointObj.pointMoveEventCallBack = getPointPosition;

	mapframe.drawPointOnMap(mapPointObj);
	/* 记录点信息 */
	mapframe.clickPointIds.push(marker.id);
}

function getPointPosition(param) {
	var point_x = document.getElementById("point_x");
	var point_y = document.getElementById("point_y");
	var mapZoom = document.getElementById("mapZoom");
	point_x.value =  param.eventX;
	point_y.value =  param.eventY;
	mapZoom.value = mapObj.getZoomLevel();
};

</script>
<div id="contentC" class="fl">
<div class="p15">
<div class="nav3 mb10">
<ul class="cc">
	<li><a href="{$_viewer->baseUrl}&dianpuid={$_viewer->dianpuid}">基本信息</a></li>
	<li class="current"><a
		href="{$_viewer->baseUrl}&a=map&dianpuid={$_viewer->dianpuid}">地理位置</a></li>
	<li><a
		href="{$_viewer->baseUrl}&a=style&dianpuid={$_viewer->dianpuid}">风格设置</a></li>
</ul>
</div>
<h2 class="h1">地理位置</h2>
<div class="admin_table">
<form action="{$_viewer->baseUrl}&a=mapedit" method="post"><input
	type="hidden" value="{$_viewer->dianpu->dianpuid}" name="dianpuid" />
<table width="100%">
	<tr class="tr1 vt">
		<td class="td1" style="width: 170px;">
		<div class="s4 f14 b mb5">城市搜索</div>
		<ul class="list_B mb20">
			<li><span class="mr10">城　市</span><input id="cityName"
				name="cityName" value="{$_viewer->cityName}" type="text"
				class="input input_wc"></li>
			<li><span class="mr10">关键词</span><input id="search_keyword"
				name="keyword" type="text" class="input input_wc"></li>
			<li><span class="btn2"><span>
			<button onfocus="blur();" onclick="searchHoseByKeywords()"
				type="button">搜 索</button>
			</span></span> <span class="bt2"><span>
			<button onfocus="blur();" type="button" onclick="clearSearchResult()">清除结果</button>
			</span></span></li>
		</ul>
		<div class="mb20"><span class="bt"><span>
		<button type="button" onclick="startTracePoint(this)" onfocus="blur()"
			value="点击开启标注点">点击开启标注点</button>
		</span></span></div>
		<div class="s4 f14 b mb5">鼠标点击地图获取坐标</div>
		<ul class="list_B mb20">
			<li><span class="mr10">X　　&nbsp;</span><input id="point_x"
				value="{$_viewer->dianpu->map_x}" name="mapx" type="text"
				class="input input_wc mr20" readonly="readonly"></li>
			<li><span class="mr10">Y　　&nbsp;</span><input id="point_y"
				value="{$_viewer->dianpu->map_y}" name="mapy" type="text"
				class="input input_wc mr20" readonly="readonly"></li>
			<li><a href="javascript:;" class="helpA fr" style="margin:5px 30px 0 0;"><i>地图zoom级别，范围为从3到17，数值越大，地图内容越详细</i></a><span class="mr10">Zoom </span><input id="mapZoom"
				value="{$_viewer->dianpu->map_z}" name="mapz" type="text"
				class="input input_wc" readonly="readonly"></li>
			<li><span class="btn2"><span>
			<button type="submit">保 存</button>
			</span></span> <span class="bt2"><span>
			<button type="reset">重 置</button>
			</span></span></li>
		</ul>
		</td>
		<td class="td2" style="padding: 0;"><iframe id="mapframe" name="mapframe" height="500px" scrolling="no" width="100%" style="border: 0pt none; display: '';" src="{$_viewer->baseUrl}&a=showmap&dianpuid={$_viewer->dianpu->dianpuid}" frameborder="0"></iframe></td>
	</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var mapframe = document.getElementById('mapframe').contentWindow;
mapframe.searchPointsTag = 'admin';
</script>
<!--
EOT;
?>