<script type="text/javascript" src="{$_config[siteurl]}include/javascript/ajax.js"></script>
<script type="text/javascript" src="{$_config[siteurl]}include/javascript/addnew.js"></script>
<div id="body">
<div class="link_path"><a href="{$_config[siteurl]}">首页</a>&nbsp;&raquo;&nbsp;<a href="index.php">我的助手</a>&nbsp;&raquo;&nbsp;编辑商铺信息</div>
<div id="my_left">
<!--{template 'menu','member','./templates/member'}-->
</div>
<div id="my_right">
    <form method="post" name="myform" action="index.php?ac=edititem" onsubmit="return checkitem(this);">
    <input type="hidden" name="shopid" value="$shopid" />
    <div class="mainrail">
        <h1>编辑商铺:$item[fullname]</h1>
        <table width="100%" cellspacing="0" cellpadding="0" class="maintable">
            <tr>
                <td align="right"><span class="font_1">*</span>分类：</td>
                <td>
                    <select name="classcode">
                        <!--{loop $_panels $key $val}-->
                            <option value="$_key" style="color:#808080;">==$val==</option>
                            <!--{loop $_classes[$key] $_key $_val}-->
                            <option value="$_key"{if $item['classcode']==$_key} selected{/if}>&nbsp;$_val</option>
                            <!--{/loop}-->
                        <!--{/loop}-->
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right" width="80"><span class="font_1">*</span>商铺名：</td>
                <td width="*"><input type="text" name="shopname" class="text" value="$item[name]"size="30" /></td>
            </tr>
            <tr>
                <td align="right">分店名：</td>
                <td><input type="text" name="subname" class="text" value="$item[subname]" size="30" /></td>
            </tr>
            <tr>
                <td align="right"><span class="font_1">*</span>地区：</td>
                <td>
                    <select name="areacode">
                        <!--{loop $_boroughs $key $val}-->
                            <option value="$key" style="color:#808080;">==$val==</option>
                            <!--{loop $_streets[$key] $_key $_val}-->
                                <option value="$_key"{if $item['areacode']==$_key} selected{elseif $item['streetcode']==$_key} selected{/if}>&nbsp;$_val</option>
                            <!--{/loop}-->
                        <!--{/loop}-->
                    </select>                
                </td>
            </tr>
            <tr>
                <td align="right"><span class="font_1">*</span>地址：</td>
                <td><input type="text" name="address" class="text" value="$item[address]" size="50" /></td>
            </tr>
            <tr>
                <td align="right">网址：</td>
                <td><input type="text" name="website" class="text" value="$item[website]" size="50" /></td>
            </tr>
            <tr>
                <td align="right">视频地址：</td>
                <td><input type="text" name="video" class="text" value="$item[video]" size="50" /></td>
            </tr>
            <tr>
                <td align="right">电话1：</td>
                <td><input type="text" name="tel1" class="text" value="$item[tel1]" size="30" /></td>
            </tr>
            <tr>
                <td align="right">电话2：</td>
                <td><input type="text" name="tel2" class="text" value="$item[tel2]" size="30" /></td>
            </tr>
            <tr>
                <td align="right">手机：</td>
                <td><input type="text" name="mobile" class="text" value="$item[mobile]" size="30" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">商铺介绍：</td>
                <td>
                    <textarea name="content" rows="10" cols="80">$item[content]</textarea><br />
                    [<a href="javascript:;" onclick="addrows(myform.content, 8);">＋增加行数</a>]&nbsp;[<a href="javascript:;" onclick="decrows(myform.content, 8);">－减少行数</a>]&nbsp;[<span class="font_2">限<span class="font_1">1000</span>个字符</span>]
                </td>
            </tr>
            <!--{if $_seccode['newshop']}--><tr>
            <td align="right">验证码：</td>
            <td><div id="seccode"></div><input type="text" name="seccode" onfocus="show_seccode();" class="t_input" /></td>
            </tr>
            <!--{/if}-->
        </table>
    </div>
    <center>
        <button type="submit" name="mysubmit" value="yes">提交编辑</button>&nbsp;&nbsp;
        <button type="reset">重置</button>&nbsp;&nbsp;
        <button type="button" onclick="history.go(-1);">返回</button>&nbsp;&nbsp;
    </center>
    </form>
</div>
</div>
<script type="text/javascript">
function checkitem(form) {
	if(form.shopname.value.trim() == '') {
		alert('请输入商铺名。');
		return false;
    } else if (form.shopname.value.length < 2 || form.shopname.value.length > 100) {
        alert('商铺名不能小于2个字符或大于200个字符。');
        return false;
    } else if (form.classcode.value.trim() == '') {
		alert('请选择商铺分类。');
		return false;
	} else if (form.areacode.value.trim() == '') {
		alert('请选择商铺所在地区。');
		return false;
	} else if (form.address.value.trim() == '') {
		alert('请输入商铺地址。');
		return false;
    } else if (form.address.value.length < 5 || form.address.value.length > 255) {
		alert('商铺地址不能小于 5 个字符或大于 255 个字符。');
		return false;
    } else if(form.content.value.length > 1000) {
		alert('商铺介绍不能大于1000个字符。');
		return false;
	}
	return true;
}
</script>