<%{include file='header.tpl'}%>

<div class="path">
    <ul>
        <%{$path}%>
    </ul>
</div> <!-- /path -->

<div class="banner min-banner">
    <img src="/template/default/static/images/bnr_contact.jpg" />
</div> <!-- /banner -->

<div class="main">

<%{if $state eq 1}%>

    <div class="feedback">
    <form id="feedback-form"  method="post"  action="/index.php?c=feedback">
        <ul>
            <li>
                <p><label for="username">您的昵称：</label></p>
                <input id="user_name" type="text" class="int" onfocus="inputFocus(this)" onblur="inputBlur(this)" name="feedback[user_name]" maxlength="20" value="<%{$feedback.user_name}%>"/>
            </li>
            <li>
                <p>
                <label for="email">联系Email：</label>
                <span id="msg1">为便于我们及时回复您的意见，请填入您的真实Email！</span>
                </p>
                <input id="email" type="text" class="int" onfocus="inputFocus(this)" onblur="inputBlur(this)" name="feedback[email]" maxlength="50" value="<%{$feedback.email}%>" />
            </li>
            <li>
                <p>
                <label for="email">留言主题：</label>
                <span id="msg1"> <strong style="color:#F00">*</strong></span>
                </p>
                <input id="title" type="text" class="int" onfocus="inputFocus(this)" onblur="inputBlur(this)" name="feedback[title]" maxlength="255" value="<%{$feedback.title}%>" />
            </li>
            <li>
                <p>
                <label for="content">意见及建议：</label>
                <span id="msg2">请简要描述您的意见或建议(20-300个汉字)，谢谢！ <strong style="color:#F00">*</strong></span>
                </p>
                <textarea id="content" class="int" onkeyup="displaySpareNumber(this,300)" onchange="displaySpareNumber(this,300)" onfocus="inputFocus(this)" onblur="inputBlur(this)" name="feedback[content]"><%{$feedback.content}%></textarea>
                <p class="spareNumberBox">还剩<span><input value="300" id="spareNumber" style="border:none; color:red; width:40px; text-align:center; background:none;" readonly="readonly"  /></span> 汉字</p>
            </li>
        </ul>
        <div class="messageBox">
        <%{if $error}%>
            <%{$error}%>
        <%{/if}%>
        </div>
        <div class="form-fot">
            <input id="submit-btn" type="submit" class="btn" name="button"  value="提 交" />
        </div>
    </form>
    </div> <!-- /feedback -->

<%{elseif $state eq 2}%>

    <div class="feedback">
        <div style="font:normal 20px/40px '宋体'; width:100%; height:300px; text-align:center; margin-top:100px;">
		提交成功，感谢您的反馈！ 
	</div>
    </div> <!-- /feedback -->

<%{/if}%>

</div> <!-- /main -->

<script type="text/javascript">
function inputFocus(obj){
    obj.style.border = "1px solid #6699dd"
    obj.style.background = "#FFFBE5"
}

function inputBlur(obj){
    obj.style.border = "1px solid #AEAEAE"
    obj.style.background = "#ffffff"
}

function displaySpareNumber(_this,size)
{
    var spareNumber=document.getElementById("spareNumber");    
    var len=_this.value.replace(/[^\x00-\xff]/gi,'xx').length/2;
    var snum=Math.floor(parseInt(size)-len);        
    spareNumber.value=snum;
    if(snum<0)
    {
        if(_this.value.length!=len)
        {
            if((len-_this.value.length)>(size/2))
            {
                _this.value=_this.value.substring(0,size/2);
            }
            else
            {
                _this.value=_this.value.substring(0,size-(len-_this.value.length));
            }
        }
        else
        {
            _this.value=_this.value.substring(0,size);                
        }
        spareNumber.value=0;
        return;            
    }        
}
</script>

<%{include file='footer.tpl'}%>