<%@ page language="C#" autoeventwireup="true" validaterequest="false" inherits="WebAdmin_Commodity_up, LebiMall" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!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>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
     <link href="css/css.css" rel="stylesheet" type="text/css" />      
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="../images/js/Ajax.js"></script>
    <script type="text/javascript" src="js/upload_img.js"></script>
    <script type="text/javascript" src="js/checked.js"></script> 
    <script type="text/javascript" language="javascript" src="js/Common.js"></script>
    <link href="../images/css/type.css" rel="stylesheet" type="text/css" />
    <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script src="js/topHead.js" type="text/javascript"></script>
    <script type="text/javascript">
    var $=jQuery;
        function resizeEditor(name,size) {   
	        var newheight = parseInt(document.getElementById(name +"___Frame").style.height, 10) + size;   
	        if(newheight >= 150) {   
		        document.getElementById(name +"___Frame").style.height = newheight + 'px';   
	        }   
         } 
         
         
		function _init(id){
		    var brand = document.getElementById("hi_brand").value;
            doRequest("Handler.ashx?typeId="+id+"&brand="+brand);
        }
        

	
	function validate(){
        var flag = true;
       if(!validateBrand()){
            flag = false;
       } 
       if(!validateTitle()){
            flag = false;
       }
       if(!validatePrice()){
           flag = false;
       }
       if(!validateNum()){
           flag = false;
       } if(!validateNum()){
           flag = false;
       }
       if(!validataType()){
        flag = false;
       }
       return flag;
    } 
    
    function resizeEditor2(id,size){
         var newheight = parseInt(document.getElementById(id).style.height, 10)+size;   
	        if(newheight >= 60) {   
		        document.getElementById(id).style.height = newheight + 'px';   
	        }  
    }
     function picEdit(){
        if(document.getElementById("cpic").value!=""){
            tipsWindown("编辑图片","iframe:PicEdit.aspx?pic="+document.getElementById("cpic").value,"350","200","true","","true","");
        }
    }
    
    //验证品牌
    function validateBrand(){
        if(document.getElementById("brand").value==""){
            document.getElementById("msg_brand").innerHTML="<span class='msg_submit'>品牌名称不能为空！</span>";   
            return false;
        }else{
           document.getElementById("msg_brand").innerHTML="";
            return true;
        }
    }
    
    //验证标题
    function validateTitle(){
        if(document.getElementById("txt_title").value==""){
            document.getElementById("title_msg").innerHTML="<span class='msg_submit'>标题不能为空！</span>";
            return false;
        }else
        {
           document.getElementById("title_msg").innerHTML=""; 
           return true;
        }
    }
    
     //验证价格
    function validatePrice(){
        if(document.getElementById("txt_price").value==""){
            document.getElementById("price_msg").innerHTML="<span class='msg_submit'>价格不能为空！</span>";
            return false;
        }else
        {
           document.getElementById("price_msg").innerHTML=""; 
           return true;
        }
    }
    
    //验证数量
    function validateNum(){
        if(document.getElementById("txt_num").value==""){
            document.getElementById("num_msg").innerHTML="<span class='msg_submit'>数量不能为空！</span>";
            return false;
        }else
        {
           document.getElementById("num_msg").innerHTML=""; 
           return true;
        }
    }
    
     //验证描述
    function validateNum(){
        if(document.getElementById("fck").Value==""){
            document.getElementById("inc_msg").innerHTML="<span class='msg_submit'>描述不能为空！</span>";
            return false;
        }else
        {
           document.getElementById("inc_msg").innerHTML=""; 
           return true;
        }
    }
    
    function validataType(){
        if(document.getElementById("txt_type").value==""){
           document.getElementById("msg_type").innerHTML = "<span class='msg_submit'>类别不能留空！</span>";
           return false; 
        }
        else
        {
            document.getElementById("msg_type").innerHTML="";
            return true;
        }
    }
    
    function selectShopId(){
        document.getElementById("hid_shopId").value = document.getElementById("shopId").value;
    }
    
    </script>
    <style>
#preview_wrapper
{
	display: inline-block;
	width: 90px;
	height: 90px;
	border: solid 1px #ccc;
}
#preview_fake
{
	/* 该对象用户在IE下显示预览图片 */
	filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
#preview_size_fake
{
	/* 该对象只用来在IE下获得图片的原始尺寸，无其它用途 */
	filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);
	visibility: hidden;
}
#preview
{
	/* 该对象用户在FF下显示预览图片 */
	width: 90px;
	height: 90px;
}
</style>
</head>
<body>
    <form id="form1" runat="server">
        <script>header(2,0,"images/");</script>
   
    <!--面包屑-->
    <div class="blank clearfix"></div>
    
    <!--功能区-->
   <div class="tabmenus mainwidth">
            <ul>
                <li><a href="Commodity_List.aspx"><span>商品管理</span></a></li>
                <li><a href="Commodity_Add.aspx"><span>商品添加</span></a></li>
                <li><a href="Commodity_sort.aspx"><span>商品推荐</span></a></li>
                <li><a href="Commodity_Search.aspx"><span>商品高级搜索</span></a></li>
                <li class="current"><a href="#"><span>商品编辑</span></a></li>
            </ul>
        </div>
    <div class="tab-mainbody">
        <div class="tab-mainbody2">
        <div class="functionHandleArea clearfix">
            <input type="image" border="0" title=" 保存 " runat="server" id="btnSave" onclick="return validate();"
                src="images/bt_app.gif" align="absmiddle" onserverclick="btnSave_ServerClick">
            <input type="image" name="Submit" title=" 重填 " onclick="reset();return false;" src="images/bt_res.gif"
                align="absmiddle">
            <input type="image" border="0" title=" 返回 " runat="server" src="images/bt_bak.gif"
                align="absmiddle" onclick="history.back();return false;" id="Image2">
        </div>
        <div id="datalist">
                <table cellpadding="0" cellspacing="0" width="100%" id="list">
                    <tr>
                        <th>
                            商品修改</th>
                        <th>
                            <span class="title_r" id="msg_sub"></span>

                            <script type="text/javascript">
                             var $=jQuery;
                                var i = 2;
                                var f="<%=Session["returnValue"] %>";
                                if(f=="true"){
                                    tipsWindown('操作结果','text:操作成功！','250','60','true','2000','true','text');
                                    <% Session["returnValue"]= null; %>
                                    setInterval("fun()", 1000);
                                }
                                if(f=="false"){
                                    tipsWindown('操作结果','text:操作失败！','250','60','true','2000','true','text');
                                    <% Session["returnValue"]= null; %>
                                }
                                function fun() {
                                    if (i == 1) {
                                        window.location.href="Commodity_List.aspx";
                                    }
                                    i--;
                                }
                            </script>

                        </th>
                    </tr>
                     <tr>
                        <td >
                            产品标题：
                        </td>
                        <td >
                            <input id="txt_title" type="text" class="input" runat="server"  size="50" onblur="validateTitle()" />
                            <span class="red">*</span><span id="title_msg" class="red"></span>
                        </td>
                    </tr>
                    <tr>
                        <td >
                            店铺</td>
                        <td >
                        <select id="shopId"  onchange="selectShopId();" >
                        <option value="0">请选择</option>
                        <% for (int i = 0; i < shopDs.Tables[0].Rows.Count;i++ )
                           {
                                %>
                                <option value="<%=shopDs.Tables[0].Rows[i]["id"] %>" <%if (model.Cshop_id == int.Parse(shopDs.Tables[0].Rows[i]["id"].ToString())){ %> selected <%} %>><%=shopDs.Tables[0].Rows[i]["sname"] %></option>
                               <%
                           } %>
                        </select>
                        </td>
                    </tr>
                    <tr>
                        <td >
                            选择类别</td>
                        <td >
                            <input type="text" id="txt_type" value="<%=typeName %>" class="input" onblur="validataType()" onfocus="javascript:OpenDialogArticleCategory('txt_type');"/>
                            <input type="hidden" id="hftxt_type" runat="server"/> <span id="msg_type"></span>
                        </td>
                    </tr>
                    <tr>
                        <td >
                            品 牌：
                        </td>
                        <td  >
                            <div id="serverResponse" style="float:left;"><input type="text" class="input" runat="server" id="brand" onblur="validateBrand()"  /></div>
                            <span class="red">*</span>
                            <span id="msg_brand"></span>
                        </td>
                    </tr>
                   
                    <tr>
                        <td >
                            价 格：
                        </td>
                        <td >
                            <input id="txt_price" class="input" type="text" runat="server" size="5" onblur="validatePrice()" />&nbsp;元<span
                                    class="red">*</span><span id="price_msg"></span>
                        </td>
                    </tr>
                    <tr>
                        <td  style="height: 24px">
                            减 款：
                        </td>
                        <td  style="height: 24px">
                            <input id="txt_jk" class="input" size="5" type="text" runat="server" value="0" />&nbsp;元
                        </td>
                    </tr>
                    <tr>
                        <td >
                            商家编码：
                        </td>
                        <td >
                            <input id="txt_no"  type="text" class="input" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td >
                            数 量：
                        </td>
                        <td >
                            <input id="txt_num" class="input" type="text" value="1" style="width: 25px;" onblur="validateNum()"
                                onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
                                runat="server" />
                            <select id="Select2" runat="server" onchange='document.getElementById("hidden_u").value=this.value;'>
                            </select>
                            <span class="red">*</span> <span id="num_msg" class="red"></span>
                            <input type="hidden" id="hidden_u" runat="server" value="1" />
                        </td>
                    </tr>
                    <tr>
                        <td >
                            产品小图：
                        </td>
                        <td >
                            <div id="preview_wrapper" style="float: left;">
                                <div id="preview_fake">
                                    <img id="preview" onload="onPreviewLoad(this)" src="../images/imgbj2.jpg" />
                                    <script type="text/javascript">
                                        document.getElementById("preview").src="../Upload/commodity/<%=model.Cmin_img %>";
                                    </script>
                                    <input type="hidden" id="proviewSrc" runat="server"/>
                                </div>
                            </div>
                            <div >
                                <input id="upload_img" type="file" onchange="onUploadImgChange(this)" class="input" runat="server" /><br />
                                图片应小于200k，jpg或gif格式。建议为500x500像素
                            </div>
                        </td>
                    </tr>
                     <tr>
                        <td >
                            产品大图：
                        </td>
                        <td >
                            <textarea id="cpic" name="cpic" disabled="disabled" class="input" runat="server" style="height:60px; width:300px;" ></textarea>
                            <input type="hidden" id="hidcpic" runat="server"/>
                            <iframe src="upload1.aspx" frameBorder=0 width="290" height="70px" scrolling=no allowtransparency="true"></iframe>&nbsp;<label style="color:Red;">*</label><span id="txt_maxpic"></span>
                            <br />
                            <input type="image" src="images/bt_close.gif" onclick="javascript:resizeEditor2('cpic',-50);return false;" />
                            <input type=image src="images/bt_open.gif" onclick="javascript:resizeEditor2('cpic',50);return false;" />
                            <input type=image src="images/bt_up.gif" onclick="javascript:picEdit();return false;" />
                        </td>
                    </tr>
                    <tr>
                        <td >
                            规 格：
                        </td>
                        <td >
                            <textarea id="txt_guige" class="input-textarea" cols="30" rows="3" runat="server"></textarea><br />
                            <input type="image" src="images/bt_close.gif" onclick="javascript:resizeEditor2('txt_guige',-50);return false;" />
                            <input type=image src="images/bt_open.gif" onclick="javascript:resizeEditor2('txt_guige',50);return false;" />
                        </td>
                    </tr>
                    <tr>                         
                        <td >
                            描 述：                                    
                        </td>
                        <td >
                            <div style="float: left;">
                                <fckeditorv2:fckeditor id="fck" runat="server" basepath="~/images/js/fckeditor/"
                                    height="250px" width="650px">
                                </fckeditorv2:fckeditor>
                                <a href="javascript:resizeEditor('fck',-100)">
                                    <img src="images/bt_close.gif" border='0'></a>&nbsp;<a href="javascript:resizeEditor('fck',150)"><img
                                        src="images/bt_open.gif" border='0'></a>
                            </div>
                            <div class="red" style="float: left;">
                                *</div>
                            <br />
                            <div class="both">
                            </div>
                            <span id="inc_msg" class="red"></span>
                        </td>
                    </tr>
                    <tr>
                        <td >
                            备 注：
                        </td>
                        <td >
                            <textarea id="txt_remark" class="input-textarea" cols="30" rows="3" runat="server"></textarea><br />
                            <input type="image" src="images/bt_close.gif" onclick="javascript:resizeEditor2('txt_remark',-50);return false;" />
                            <input type=image src="images/bt_open.gif" onclick="javascript:resizeEditor2('txt_remark',50);return false;" />

                        </td>
                    </tr>
               
                    <tr>
                        <th colspan="2">
                            2. 其他信息</th>
                    </tr>
                    <tr>
                        <td  style="width: 10%;">
                            运 费：</td>
                        <td >
                            <input id="Radio1" name="yfradio" type="radio"  onclick="document.getElementById('yf').style.display='none';"
                                runat="server" checked/>卖家承担运费 &nbsp;
                            <input id="Radio2" name="yfradio" type="radio" onclick="document.getElementById('yf').style.display='block';"
                                runat="server"  />买家承担运费
                        </td>
                    </tr>
                    <tr id="yf" runat="server">
                        <td >
                        </td>
                        <td >
                            平 邮：<input id="txt_py" class="input" size="5" type="text" runat="server" />
                            元&nbsp;&nbsp; 快 递：<input id="txt_kd" class="input" size="5" type="text" runat="server" />
                            元&nbsp;&nbsp; EMS：<input id="txt_ems" class="input" size="5" type="text" runat="server" />
                            元 <span id="youfei" class="red"></span>
                            <script type="text/javascript" >
                                if(<%=model.Cfreight.ToString().Trim() %> == "0"){
                                      document.getElementById('yf').style.display='none';
                                }
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td >
                            排 序：</td>
                        <td >
                            <input id="txt_sort" type="text" class="input" value="0" size="5" runat="server"
                                onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
                        </td>
                    </tr>
                    <tr>
                        <td >
                            橱窗推荐：</td>
                        <td >
                            <input id="Checkbox1" type="checkbox" runat="server" />是
                        </td>
                    </tr>
                    <tr>
                        <td >
                            放入仓库：</td>
                        <td >
                            <input id="Checkbox2" type="checkbox" runat="server" />是
                        </td>
                    </tr>
                    <tr>
                        <td  style="height: 20px">
                            发 票：</td>
                        <td  style="height: 20px">
                            <input id="Radio3" name="fradio" type="radio" checked runat="server" />无<input runat="server"
                                name="fradio" id="Radio4" type="radio" />有
                        </td>
                    </tr>
                    <tr>
                        <td >
                            保 修：</td>
                        <td >
                            <input id="Radio5" name="bradio" type="radio" checked runat="server" />无<input runat="server"
                                name="bradio" id="Radio6" type="radio" />有
                        </td>
                    </tr>
                    <tr>
                        <td >
                            货到付款：</td>
                        <td >
                            <input id="Radio7" name="hradio" type="radio" checked runat="server" />无<input runat="server"
                                name="hradio" id="Radio8" type="radio" />有
                        </td>
                    </tr>
                    <tr>
                        <td class="list-foot" colspan="2" style="height: 27px">
                            <input type="image" onclick="return validate()" border="0" title=" 保存 " runat="server"
                                id="btnSub" onserverclick="btnSave_ServerClick" src="images/bt_app.gif" align="absmiddle"></td>
                    </tr>
                </table>

                <script type="text/javascript">tdshowm("list");</script>
                                                    <input type="hidden" id="hid_shopId" runat=server />
                <!--提示层部分开始-->
                <span id="hintdivup" style="display:none; position:absolute;z-index:500;">
                <div style="position:absolute; visibility: visible; width: 271px;z-index:501;">
                <p><img src="images/commandbg.gif" /></p>
                <div class="messagetext"><img src="images/dot.gif" /><span id="hintinfoup" ></span></div>
                <p><img src="images/commandbg2.gif" /></p>
                </div>
                <iframe id="hintiframeup" style="position:absolute;z-index:100;width:266px;scrolling:no;" frameborder="0"></iframe>
                </span>
                <span id="hintdivdown" style="display:none; position:absolute;z-index:500;">
                <div style="position:absolute; visibility: visible; width: 271px;z-index:501;">
                <p><img src="images/commandbg3.gif" /></p>
                <div class="messagetext"><img src="images/dot.gif" /><span id="hintinfodown" ></span></div>
                <p><img src="images/commandbg4.gif" /></p>
                </div>
                <iframe id="hintiframedown" style="position:absolute;z-index:100;width:266px;scrolling:no;" frameborder="0"></iframe>
                </span>
                <!--提示层部分结束-->
        </div>
        </div>
        </div>
    </form>
</body>
</html>
     
