<%@ page title="" language="C#" masterpagefile="~/Member/MyShopMasterPage.master" validaterequest="false" autoeventwireup="true" inherits="Member_Shop_PublishTry, WebApp_deploy" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script type="text/javascript" src="../Js/My97DatePicker/WdatePicker.js"></script>

    <script src="../Js/My97DatePicker/config.js" type="text/javascript"></script>

    <script src="Js/TryMember.js" type="text/javascript"></script>

    <script src="../Js/SaleProduct.js" type="text/javascript"></script>
    <script src="../CKEdit/ckEdit/ckeditor.js" type="text/javascript"></script>
    <script type="text/javascript">
         function getSelect() {
             var SelectBox = document.getElementsByTagName('option');
             var mm;
             for (mm = 0; mm < SelectBox.length; mm++) {
                 if (SelectBox[mm].value == '0' && SelectBox[mm].selected) {
                     SelectBox[mm + 1].selected = true;
                     SelectBox[mm].style.fontSize = "18px";
                     break;
                 }
             }
         }


         function selectCity() {
             var CityDiv = document.getElementById("CityDiv");
             var SelectSpan = document.getElementById("SelectSpan");
             CityDiv.style.display = "block";
             SelectSpan.style.display = "block";
         }

         function ClearLineCity() {
             var DivNation = document.getElementById("DivNation"); // 添加城市容器
             DivNation.innerHTML == "" 
             DivNation.innerHTML = "<div id='Divquanguo'> <input id='CheckNation' name='CheckNation' checked='checked' type='checkbox' value='全国' disabled='disabled' />全国</div>";
             
         }

         function AddCity(index) {
             var n = 0;
             var DivNation = document.getElementById("DivNation"); // 添加城市容器
             var CheckNation = document.getElementById("Divquanguo"); //获取全国
             var GetDIVProvince = document.getElementById("LineProvinceDiv"); //获取下面省份DIV
             var GetCheckProvince = document.getElementById("CheckProvince");
             var GetAllcity = document.getElementById("DivAllCityList");
             var controls = GetAllcity.getElementsByTagName('input');
            
             if (index >= 0) {
                 var GetCity = document.getElementById("CheckCity" + index); //获取城市
                 if (GetCity.checked) {
                     if (GetDIVProvince != null) {
                         DivNation.removeChild(GetDIVProvince);
                         GetCheckProvince.checked = false;
                     }
                     if (CheckNation != null) {
                         DivNation.removeChild(CheckNation);
                     }
                     DivNation.innerHTML += "<div id='City" + index + "'><ul style='float:left'><li><input type='checkBox' name='GetCity' id='LineCity" + index + "' checked='true' value=" + GetCity.value + " onclick='CancellationCity(" + index + ")'> " + GetCity.value + "</li></ul></div>";
                 }
                 else {
                     var DivCity = document.getElementById("City" + index);
                     DivNation.removeChild(DivCity);
                 }
             }
             else {

                 if (GetCheckProvince.checked) {
                     for (var i = 0; i < controls.length; i++) {
                         if (controls[i].type == 'checkbox') {
                             controls[i].checked = false;
                         }
                     }
                     DivNation.innerHTML = "<div id='LineProvinceDiv'><input type='checkBox' id='CProvince' name='CProvince' value='" + GetCheckProvince.value + "' onclick='CancellationCity(-1)' checked='true' />" + GetCheckProvince.value + "";
                 }
                 else {
                     var LineProvince = document.getElementById("LineProvinceDiv");
                     DivNation.removeChild(LineProvince);
                 }
             }

             if (DivNation.innerHTML == "") {
                 DivNation.innerHTML = "<div id='Divquanguo'> <input id='CheckNation' name='CheckNation' checked='checked' type='checkbox' value='全国' disabled='disabled' />全国</div>";
             }  
             
         }
       //下面列表的事件
         function CancellationCity(index) {
             var DivNation = document.getElementById("DivNation"); // 添加城市容器
             var DivLineCity = document.getElementById("City" + index);
             var GetCity = document.getElementById("CheckCity" + index); //获取城市
             var CheckNation = document.getElementById("spanNation"); //获取全国

             var CheckProvince = document.getElementById("CheckProvince"); //获取省份

             var CProvince = document.getElementById("LineProvinceDiv"); //获取动态生成的省份容器(在城市容器里面)
             if (index >= 0) {
                 GetCity.checked = false;
                 DivNation.removeChild(DivLineCity);
             }
             else{
                 CheckProvince.checked = false;
                 DivNation.removeChild(CProvince);
             }

             if (DivNation.innerHTML=="") {
                 DivNation.innerHTML = "<div id='Divquanguo'> <input id='CheckNation' name='CheckNation' checked='checked' type='checkbox' value='全国' disabled='disabled' />全国</div>";
             }
         }


         //确定隐藏城市列表
         function hideCityList() {
             var DivCity = document.getElementById("CityDiv");
             var SelectSpan = document.getElementById("SelectSpan");
             DivCity.style.display = "none";
             SelectSpan.style.display = "none";
         }
       
    </script>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="pageTitle">
        试用发布</div>
    <br />
    <table class="SearchTableStyle">
        <tr>
            <td colspan="2" style="text-align: center; height: 30px">
                以下所有选项都是必填或必选的，您发布的试用活动，一旦通过系统审批，您将不能对此试用活动进行修改或删除，请慎重！
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px; vertical-align:top;">
                产品名称：
            </td>
            <td>
                <asp:TextBox ID="ProductNameBox" runat="server" Width="300px" Style="margin-left: 5px"></asp:TextBox>
                <asp:Label ID="LbProError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                产品购买地址：
            </td>
            <td>
                <asp:TextBox ID="BuyOnlineBox" runat="server" Width="300px" MaxLength="150" Text=""></asp:TextBox>（说明：留空的或者输入不正确都没有实现在线购买功能）
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                产品类型：
            </td>
            <td>
                <asp:DropDownList ID="DropClass" runat="server" onclick="getSelect()">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                参与地区限制：
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            <input id="ButSelect" type="button" value="选择" onclick="selectCity()" size="20px" />
                        </td>
                        <td>
                            <span id="SelectSpan" style="display: none">请选择地区<input id="ButOK" type="button"
                                value="确定" onclick="hideCityList()" /></span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="width: 262px; height: 30px">
            </td>
            <td style="text-align: left; width: 600px">
                <div id="CityDiv" style="border: solid 1px #CCCCCC; text-align: left; display: none">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:DropDownList ID="DropProvince" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropProvince_SelectedIndexChanged"
                                onclick="ClearLineCity()">
                            </asp:DropDownList>
                            <div id="DIVProvince">
                                <input id="CheckProvince" type="checkbox" name="CheckProvince" value="<%=StrProvince %>"
                                    onclick="AddCity(-1)" /><span id="ShowProviceName"><%=StrProvince%></span></div>
                            <div id="DivAllCityList">
                                <asp:DataList ID="DataList1" runat="server" RepeatColumns="6">
                                    <ItemTemplate>
                                        <input id="CheckCity<%#Container.ItemIndex %>" type="checkbox" name="CheckCity" value="<%#Eval("City") %>"
                                            onclick="AddCity(<%#Container.ItemIndex %>)" /><%#Eval("City") %>&nbsp;&nbsp;&nbsp;&nbsp;
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <div id="DivNation">
                    <div id="Divquanguo">
                        <input id="CheckNation" name="CheckNation" checked="checked" type="checkbox" value="全国"
                            disabled="disabled" />全国</div>
                </div>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                试用品标题图片：
            </td>
            <td>
                <table>
                    <tr>
                        <td>
                            <style type="text/css">
                                #previewImage
                                {
                                    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
                                }
                            </style>

                            <script language="javascript" type="text/javascript">
                                 function PreviewImg(imgFile)
                                 {    
                                     var newPreview = document.getElementById("previewImage");
                                     newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
                                 }
                            </script>

                            <asp:FileUpload ID="FileUpload1" runat="server" onchange="PreviewImg(this)" />
                            <div style="width: 200px" id="UploadDiv">
                            </div>
                        </td>
                        <td>
                            <div id="previewImage" style="text-align: center; width: 100px; height: 100px; border: solid 1px gray;
                                float: left;">
                                缩微图
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                发货方式：
            </td>
            <td>
                <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                    <asp:ListItem>企业发货</asp:ListItem>
                    <asp:ListItem Selected="True">本站代发</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                试用品发放数量：
            </td>
            <td>
                <asp:TextBox ID="ProductNumBox" runat="server" Text="0"></asp:TextBox>
                &nbsp;&nbsp;份
                <asp:Label ID="lbNumError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                市场单价：
            </td>
            <td>
                <asp:TextBox ID="PriceBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;元  &nbsp;&nbsp;
                <asp:Label ID="lbPriceError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                折扣价：
            </td>
            <td>
                <asp:TextBox ID="DisCountBox" runat="server"></asp:TextBox>
                &nbsp;&nbsp;元   &nbsp;&nbsp;
                <asp:Label ID="lbDisError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                需付邮费：
            </td>
            <td>
                <asp:TextBox ID="PostageBox" runat="server" Text="0"></asp:TextBox>
                &nbsp;&nbsp;元    &nbsp; &nbsp; &nbsp;
                <asp:Label ID="lbPostError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                活动开始时间：
            </td>
            <td> <asp:FileUpload ID="FileUpload2"  runat="server" onchange="preview(this.value);" />
                <input id="BeginDate" style="border: #99CCFF 1px solid; background: #fff url(../Js/My97DatePicker/skin/datePicker.gif) no-repeat right;
                    height: 20px" name="BeginDate" type="text" onclick="WdatePicker()" /> &nbsp; &nbsp;
                <asp:Label ID="lbBeginError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px">
                活动结束时间：
            </td>
            <td>
                <input style="border: #99CCFF 1px solid; background: #fff url(../Js/My97DatePicker/skin/datePicker.gif) no-repeat right;
                    height: 20px" id="EndDateBox" name="EndDateBox" type="text" onclick="WdatePicker()" />  &nbsp;&nbsp;
                <asp:Label ID="lbEndError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right; width: 262px; height: 30px; font-weight: bold;vertical-align:top;">
                产品介绍：
            </td>
            <td style="color:Red; font-size:13px">请注意图片跟浏览效果的一致性，确保理想效果，若变片变形，拉动一下图片再还原，也可根据自己的要求时行修改</td>

        </tr>
        <tr>
            <td style="width: 262px;">
            </td>
            <td style="text-align: center">
                <asp:TextBox ID="FCKeditor1" TextMode="MultiLine" CssClass="ckeditor" runat="server"></asp:TextBox>
              
                <br />
                <asp:Label ID="lbInfoError" runat="server" Text="" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 262px; height: 30px">
            </td>
            <td>
                <asp:Button ID="ButIssue" runat="server" Text="发布" Width="100px" OnClick="ButIssue_Click" />
                <br />
                <asp:Label ID="lbErrorNum" runat="server" Text="" ForeColor="Red" Font-Size="16px"></asp:Label>
            </td>
        </tr>
    </table>
</asp:Content>
