<!--{if $in_dialog}-->
<script type="text/javascript">
var map_id = 'mapmark_mymap_in_dialog';
</script>
<div style="margin-bottom:5px;"><a href="javascript:mkctrl.btnClick();">我要标注</a></div>
<div id="mapmark_mymap_in_dialog"></div>
<div id="body"></div>
<!--{else}-->
<script type="text/javascript" src="{$_config[siteurl]}include/javascript/favorite.js"></script>
<script type="text/javascript">
var map_id = 'mapmark_mymap';
</script>
<div id="body">
<div class="link_path"><a href="$option[url]">首页</a>&nbsp;&raquo;&nbsp;<a href="cate.php?cd=$pcd">$_panels[$pcd]</a>&nbsp;&raquo;&nbsp;<a href="shop.php?shopid=$shop[sid]">$shop[shopname]</a>&nbsp;&raquo;&nbsp;地图标注</div>
<div id="left">
    <div class="mainrail rail-border-1">
        <h1 class="rail-h-1 rail-h-bg-1">$shop[shopname]</h1>
        <ul class="rail-list">
            <li>地址：$shop[address]</li>
            <li>电话：$shop[tel1]&nbsp;$shop[tel2]</li>
            <li><a href="post.php?action=newreview&shopid=$shop[sid]">添加点评</a></li>
            <li><a href="javascript:;" onclick="addfavorite($shop[sid]);">加入收藏</a></li>
            <li><a href="shop.php?shopid=$shop[sid]">查看更多介绍和点评</a></li>
        </ul>
    </div>
</div>
<div id="right">
    <div id="mapmark_mymap" class="rail-border-3"></div>
    <div id="mapmark_control">
        <form method="post" action="post.php?action=mapmark" name="mapmarkfrm" onsubmit="return check_mapmark();">
        <input type="hidden" name="shopid" value="$shopid" />
        <input type="hidden" name="lng" />
        <input type="hidden" name="lat" />
        <button type="button" value="yes" onclick="mkctrl.btnClick();" />我要标注</button>&nbsp;
        <button type="submit" name="mapmarksubmit" value="yes" />提交我的标注</button>&nbsp;
        <button type="button" onclick="history.go(-1);" />返回</button>
        </form>
    </div>
</div>
</div>
<script type="text/javascript" language="javascript">

function check_mapmark () {
    var form = document.mapmarkfrm;
    if(form.shopid.value.trim() == '') {
        alert('无效的标注对象。');
        return false;
    } else if(!is_numeric(form.shopid.value.trim())) {
        alert('标注对象不存在。');
        return false;
    } else if(form.shopid.value.trim() <=0 ) {
        alert('标注对象不存在。');
        return false;
    } else if(!form.lng.value.trim().match(/^[0-9a-z\.\,]+$/) || !form.lat.value.trim().match(/^[0-9a-z\.\,]+$/)) {
        alert('还未标注。');
        return false;
    }
    return true;
}
</script>

<!--{/if}-->

<script type="text/javascript" language="javascript" src=" http://api.51ditu.com/js/maps.js "></script>
<script type="text/javascript" language="javascript">

var maps = new LTMaps( map_id ); 
var smctrl=new LTStandMapControl();
maps.addControl( smctrl );

{LF}
<!--{if $_default_mappoint}-->
var point = new LTPoint($_default_mappoint[0], $_default_mappoint[1]);
maps.cityNameAndZoom( point , 2 ); 
<!--{/if}-->
{LF}

var mkctrl = new LTMarkControl();
mkctrl.setVisible( false );
maps.addControl( mkctrl );

function getPoi() {
    var poi = mkctrl.getMarkControlPoint();
    {LF}
<!--{if $in_dialog}-->
    parent.frmupshop.lng.value = poi.getLongitude();
    parent.frmupshop.lat.value = poi.getLatitude();
<!--{else}-->
    document.mapmarkfrm.lng.value = poi.getLongitude();
    document.mapmarkfrm.lat.value = poi.getLatitude();
<!--{/if}-->
    {LF}
}
LTEvent.addListener( mkctrl , "mouseup" , getPoi );
</script>