<%@ page language="C#" autoeventwireup="true" inherits="Message, WebApp_deploy" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>给管理员建议与留言</title>
    <link href="Skin/ProductClassStyle/Style.css" rel="stylesheet" type="text/css" />
    <script src="Skin/CommStyle/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function CheckContent() {
            var titleBox = document.getElementById("titleBox");
            var TitleError = document.getElementById("TitleError");

            if (titleBox.value == '') {
                $("#<%=titleBox.ClientID %>").addClass("error");
                TitleError.innerHTML = "标题不能为空！";
                return false;
            }
            else if (titleBox.value.length > 50) {
                $("#<%=titleBox.ClientID %>").addClass("error");
                TitleError.innerHTML = "标题不能超过50字！";
                return false;
            }
            else {
                $("#<%=titleBox.ClientID %>").removeClass("error");
                TitleError.innerHTML = "";
            }


            var ContactMenBox = document.getElementById("ContactMenBox");
            var ContactError = document.getElementById("ContactError");
            if (ContactMenBox.value == '') {
                $("#<%=ContactMenBox.ClientID %>").addClass("error");
                ContactError.innerHTML = "联系人不能为空！";
                return false;
            }
            else if (ContactMenBox.value.length > 6) {
                $("#<%=ContactMenBox.ClientID %>").addClass("error");
                ContactError.innerHTML = "联系人不能超过6字！";
                return false;
            }
            else {
                $("#<%=ContactMenBox.ClientID %>").removeClass("error");
                ContactError.innerHTML = "";
            }

            var TelPhoneBox = document.getElementById("TelPhoneBox");
            var HomeTelBox = document.getElementById("HomeTelBox");
            var ErrorTel = document.getElementById("ErrorTel");

            if (TelPhoneBox.value == '' && HomeTelBox.value == '') {
                alert('联系方式不能为空！');
                return false;
            }

            var EmailBox = document.getElementById("EmailBox");
            var ErrorEmail = document.getElementById("ErrorEmail");

            var reyx = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;

            if (EmailBox.value == '') {
                $("#<%=EmailBox.ClientID %>").addClass("error");
                ErrorEmail.innerHTML = "邮箱不能为空！";
                return false;
            }
            else if (!reyx.test(EmailBox.value)) {
                $("#<%=EmailBox.ClientID %>").addClass("error");
                ErrorEmail.innerHTML = "邮箱格式不对！";
                return false;
            }
            else {
                $("#<%=EmailBox.ClientID %>").removeClass("error");
                ErrorEmail.innerHTML = "";
            }

            var ContentBox = document.getElementById("ContentBox");
            var ErrorContent = document.getElementById("ErrorContent");
            if (ContentBox.value == '') {
                $("#<%=ContentBox.ClientID %>").addClass("error");
                ErrorContent.innerHTML = "内容不能为空！";
                return false;
            }
            else if (ContentBox.value.lenght > 500) {
                $("#<%=ContentBox.ClientID %>").addClass("error");
                ErrorContent.innerHTML = "内容长度不能超过500字！";
                return false;
            }
            else {
                $("#<%=ContentBox.ClientID %>").removeClass("error");
                ErrorContent.innerHTML = "";
            }


        }
    </script>
    <style type="text/css">
        .text
        {
            border-color: #9CA5B4 #C2C8CF #C2C8CF #9CA5B4;
        }
        .m_li li
        {
        	height:25px;
        }
        .
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <hl:Top ID="Top1" runat="server" />
    <div class="wp">
        <div class="item-publish">
            <div class="goods-attribute">
                <dl class="tit">
                    <h3>
                        给管理员建议与留言</h3>
                </dl>
                <dl>
                    <dt><span style="color: Red">*</span>标题：</dt>
                    <dd>
                        <asp:TextBox ID="titleBox" runat="server" Width="400px" CssClass="text"></asp:TextBox><label id="TitleError" class="error"></label>
                    </dd>
                </dl>
                <dl>
                    <dt><span style="color: Red">*</span>联系人：</dt>
                    <dd>
                        <asp:TextBox ID="ContactMenBox" runat="server" Width="300px" CssClass="text"></asp:TextBox>
                         <label id="ContactError" class="error"></label>
                        <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Selected="True" Value="0">男</asp:ListItem>
                            <asp:ListItem Value="1">女</asp:ListItem>
                        </asp:RadioButtonList>
                       
                    </dd>
                </dl>
                <dl>
                    <dt>公司名称：</dt>
                    <dd>
                        <asp:TextBox ID="CompanyNameBox" runat="server" Width="400px" CssClass="text"></asp:TextBox></dd>
                </dl>
                <dl>
                    <dt>地址：</dt>
                    <dd>
                        <asp:TextBox ID="AddressBox" runat="server" Width="400px" CssClass="text"></asp:TextBox></dd>
                </dl>
                <dl>
                    <dt><span style="color: Red">*</span>联系方式：</dt>
                    <dd>
                        <ul class="m_li">
                            <li>手机号码：<asp:TextBox ID="TelPhoneBox" runat="server" Width="300px" CssClass="text"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="rex1" runat="server" ControlToValidate="TelPhoneBox"
                                    ErrorMessage="手机号码格式不对" ValidationExpression="^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}|15[1234567890]\d{8}|18[1234567890]\d{8}$"
                                    CssClass="tips_wrong" Display="Dynamic" />
                            </li>
                            <li>电话号码：<asp:TextBox ID="HomeTelBox" runat="server" Width="300px" CssClass="text"></asp:TextBox>
                            </li>
                            <li><span style="color: Red">(注：两个号码必须填写一个)</span> </li>
                        </ul>
                    </dd>
                </dl>
                <dl>
                    <dt>传真：</dt>
                    <dd>
                        <asp:TextBox ID="FacsimileBox" runat="server" Width="400px" CssClass="text"></asp:TextBox></dd>
                </dl>
                <dl>
                    <dt>网址：</dt>
                    <dd>
                        <asp:TextBox ID="WebsiteBox" runat="server" Width="400px" CssClass="text"></asp:TextBox></dd>
                </dl>
                <dl>
                    <dt><span style="color: Red">*</span>邮箱：</dt>
                    <dd>
                        <asp:TextBox ID="EmailBox" runat="server" Width="400px" CssClass="text"></asp:TextBox><label id="ErrorEmail" class="error"></label>
                    </dd>
                </dl>
                <dl>
                    <dt><span style="color: Red">*</span>内容：</dt>
                    <dd>
                        <asp:TextBox ID="ContentBox" runat="server" Width="400px" Height="300px" TextMode="MultiLine" CssClass="text">
                        </asp:TextBox>
                        <label id="ErrorContent" class="error"></label>
                    </dd>
                </dl>
                <div class="clear">
                    <p>
                        &nbsp;</p>
                    <p>
                        &nbsp;</p>
                </div>
                <div class="issuance">
                    <asp:Button ID="Button1" runat="server" Text="发表" Width="100px" OnClientClick=" return CheckContent()"
                        CssClass="btn" OnClick="Button1_Click" />
                </div>
            </div>
        </div>
    </div>
    <hl:Foot ID="Foot1" runat="server" />
    </form>
</body>
</html>
