<%@ page language="C#" autoeventwireup="true" inherits="Web_ClassChoose, WebApp_deploy" title="商品分类选择" %>

<!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>
    <title>商品分类选择</title>
    <link href="Skin/TopStyle/Basic.css" rel="stylesheet" type="text/css" />
    <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>
</head>
<body>
    <form id="form1" runat="server">
    <hl:Top ID="Top1" runat="server" />
    <div class="wp">
        <!-- S setp -->
        <ul class="flow-chart">
            <li title="选择商品所在分类" class="step a1"></li>
            <li title="填写商品详细信息" class="step b2"></li>
            <li title="商品发布成功" class="step c2"></li>
        </ul>
        <!--S 搜索商品-->
        <div class="wp_search_com">
            <span class="icon"></span><span class="txt">分类搜索：
                <input type="text" maxlength="22" id="searchKey" onkeypress="searchKeyPress('searchKey')"
                    value="请输入商品名称或分类属性名称" style="color: rgb(153, 153, 153);" />
            </span>
            <input type="button" id="searchBtn" runat="server" value="搜索" class="btn_search"
                onclick="searchClick()" />
            <%--<a id="searchBtn" href="JavaScript:void(0);" class="btn_search">搜索</a>--%>
        </div>
        <!--S 搜索结果-->
        <!--S 分类选择区域-->
        <div class="wrapper_search">
            <div style="display: none;" class="wp_search_result">
                <div class="back_to_sort">
                    <a nc_type="return_choose_sort" href="JavaScript:ShowList();">&lt;&lt;返回商品分类选择</a></div>
                <div style="display: none;" id="searchNone" class="no_result">
                    <div class="cont">
                        <p>
                            没有找到相关的商品分类。</p>
                        <p>
                            <a nc_type="return_choose_sort" href="JavaScript:ShowList();">返回商品分类选择 </a>
                        </p>
                        <p>
                        </p>
                    </div>
                </div>
                <div style="display: block;" id="searchSome" class="has_result">
                    <div id="searchEnd" style="margin-left: auto; margin-right: auto;">
                        数据努力加载中，请稍后......
                    </div>
                    <div id="searchList" class="result_list">
                        <ul>
                        </ul>
                    </div>
                </div>
            </div>
            <div style="position: relative; display: block;" class="wp_sort">
                <div class="sort_selector">
                    <div class="sort_title">
                        <div class="txt">
                            您常用的商品分类：</div>
                        <input type="text" value="请选择" id="commSelect" class="select_box"/>
                    </div>
                </div>
                <div style="cursor: pointer; height: 280; overflow: auto; display: none;" id="commListArea"
                    class="select_list">
                    <ul>
                        <li id="select_list_no"><span class="title">您还没有添加过常用的分类</span></li>
                    </ul>
                </div>
                <div class="wp_sort_block" id="class_div">
                    <div class="sort_list">
                        <div class="wp_category_list">
                            <asp:HiddenField ID="Class_ParenID" runat="server" />
                            <div class="category_list" id="class_div_1">
                                <ul>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="sort_list">
                        <div class="wp_category_list blank">
                            <div class="category_list" id="class_div_2">
                                <ul>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="sort_list">
                        <div class="wp_category_list blank">
                            <div class="category_list" id="class_div_3">
                                <ul>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="sort_list sort_list_last">
                        <div class="wp_category_list blank">
                            <div class="category_list " id="class_div_4">
                                <ul>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div style="display: block; clear: both;" class="tips_choice">
                <span class="tips_zt"></span>
                <dl class="hover_tips_cont">
                    <dt id="commodityspan" style="display: none;"><span style="color: #F00;">请选择商品类别</span></dt>
                    <dt class="current_sort" style="display: block;" id="commoditydt">您当前选择的商品类别是：</dt>
                    <dd id="commoditydd" style="color: Red;">
                    </dd>
                    <dd style="display: none;" id="commoditya">
                        &nbsp;&nbsp;<a href="JavaScript:void(0);">
                            <asp:HiddenField ID="hidenClass" runat="server" />
                            [添加到常用分类]</a></dd>
                </dl>
            </div>
            <div class="wp_confirm">
                <span class="btn_confirm">
                    <asp:Button ID="button_next_step" runat="server" Text="下一步" OnClick="Button1_Click"
                        Enabled="false" Style="cursor: pointer;" />
                </span>
            </div>
        </div>
    </div>
    <hl:Foot ID="Foot1" runat="server" />
    </form>
    <script type="text/javascript">
    /****************************** 常用分类的下拉列表中的项begin *****************************************/
     function _GetFirstClass(id){
        $("#class_div_1 ul").html("");//new add
             //一级目录
            $.post("WebService/ShopService.ashx", { 'Action': 'GetRootClass' }, function (data, state) {
                if (state == "success") {
                    var d = eval( data);
                    var $class_div_1_ul = $("#class_div_1 ul");
                    $.each(d.table1, function (i) {
                        $class_div_1_ul.append(" <li class='' id='item_" + d.table1[i].ClassID + "' > <a class='' href='javascript:SelClass(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a> </li>");
                    });
                    $("#class_div_1 ul li").each(function(){
                    if($(this).attr("id")=="item_"+id){
                        $(this).children("a").addClass("classDivClick");
                    }
                    });
                }
            });
        }
        function _SelClass(id,currID) {
            var a = 1;
            $("#class_div_2 ul").html("");
            $("#class_div_1 ul li").find("a").removeClass("classDivClick");
            $("#item_" + id).find("a").attr("class", "classDivClick");
            ajaxMethod("GetProductClassByParentID", function (d) {
                var _ii=false;
                $.each(d.table1, function (i) {
                    _ii=true;
                    $("#class_div_2 ul").append("<li id='item_2_" + d.table1[i].ClassID + "'><a href='javascript:SelClass2(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a></li>");
                });
                if(!_ii){
                    $("#class_div_1 ul li").each(function(){
                        var _t = $(this).attr("id");
                        if(("item_1"+id.toString())==_t){
                            $(this).children("a").click();
                        }
                    });
                }
                $("#<%=button_next_step.ClientID %>").attr("disabled", "disabled");
                $("#class_div .sort_list .wp_category_list").eq(1).removeClass("blank");
                $("#commoditya").attr("style", "display:none");
                $("#hidenClass").val("");
                a = 2;
                $("#class_div_2 ul li").each(function(){
                    if($(this).attr("id")=="item_2_"+currID){
                        $(this).children("a").addClass("classDivClick");
                    }
               });
            }, "{ 'ParentID': '" + id + "' }");
            ShowCommodit();
            //没有数据
            if (a == 1) {
                $("#class_div .sort_list .wp_category_list").eq(1).addClass("blank");
                $("#class_div .sort_list .wp_category_list").eq(2).addClass("blank");
                $("#class_div .sort_list .wp_category_list").eq(3).addClass("blank");
                $("#button_next_step").attr("disabled", "");
                $("#class_div_3 ul").html("");
                $("#class_div_4 ul").html("");
                $("#commoditya").attr("style", "display:block");
                //$("#hidenClass").val(id);
            }
        }

         function _SelClass2(id,currID) {
            var a = 1;
            $("#class_div_3 ul").html("");
            $("#class_div_2 ul li").find("a").removeClass("classDivClick");
            $("#item_2_" + id).find("a").attr("class", "classDivClick");
            ajaxMethod("GetProductClassByParentID", function (d) {
                var _ii=false;
                $.each(d.table1, function (i) {
                    _ii=true;
                    $("#class_div_3 ul").append("<li id='item_3_" + d.table1[i].ClassID + "'><a href='javascript:SelClass3(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a></li>");
                });
                if(!_ii){
                    $("#class_div_2 ul li").each(function(){
                        var _t = $(this).attr("id");
                        if(("item_2"+id.toString())==_t){
                            $(this).children("a").click();
                        }
                    });
                }
                a = 2;
                $("#<%=button_next_step.ClientID %>").attr("disabled", "disabled");
                $("#class_div .sort_list .wp_category_list").eq(2).removeClass("blank");
                $("#commoditya").attr("style", "display:none");
                $("#hidenClass").val("");
                $("#class_div_3 ul li").each(function(){
                    if($(this).attr("id")=="item_3_"+currID){
                        $(this).children("a").addClass("classDivClick");
                    }
               });
            }, "{ 'ParentID': '" + id + "' }");
            ShowCommodit();
            //没有数据
            if (a == 1) {
                $("#class_div .sort_list .wp_category_list").eq(2).addClass("blank");
                $("#class_div .sort_list .wp_category_list").eq(3).addClass("blank");
                $("#<%=button_next_step.ClientID %>").attr("disabled", "");
                $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
                $("#class_div_4 ul").html("");
                $("#commoditya").attr("style", "display:block");
                //$("#hidenClass").val(id);
            }
        }

         function _SelClass3(id,currID) {
            var a = 1;
            $("#class_div_4 ul").html("");
            $("#class_div_3 ul li").find("a").removeClass("classDivClick");
            $("#item_3_" + id).find("a").attr("class", "classDivClick");
            ajaxMethod("GetProductClassByParentID", function (d) {
                var _ii=false;
                $.each(d.table1, function (i) {
                    _ii=true;
                    $("#class_div_4 ul").append("<li id='item_4_" + d.table1[i].ClassID + "'><a href='javascript:SelClass4(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a></li>");
                });
                if(!_ii){
                    $("#class_div_3 ul li").each(function(){
                        var _t = $(this).attr("id");
                        if((id.toString()+"item_3")==_t){
                            $(this).children("a").click();
                        }
                    });
                }
                a = 2;
                $("#<%=button_next_step.ClientID %>").attr("disabled", "disabled");
                $("#class_div .sort_list .wp_category_list").eq(3).removeClass("blank");
                $("#commoditya").attr("style", "display:none");
                $("#class_div_4 ul li").each(function(){
                    if($(this).attr("id")=="item_4_"+currID){
                        $(this).children("a").addClass("classDivClick");
                        $(this).children("a").click();
                    }
               });
                $("#hidenClass").val("");
            }, "{ 'ParentID': '" + id + "' }");
            ShowCommodit();
            //没有数据
            if (a == 1) {
                $("#<%=button_next_step.ClientID %>").attr("disabled", "");
                $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
                $("#class_div .sort_list .wp_category_list").eq(3).addClass("blank");
                $("#commoditya").attr("style", "display:block");
                //$("#hidenClass").val(id);
            }
        }
        /****************************** 常用分类的下拉列表中的项end *****************************************/

        var hfClassID;//商品分类ID最后一级
        //选择常用分类的下拉列表中的项
        function ViewClassByID(id){
            if(id<=0){
                return;
            }
           //var namm = document.getElementById("");
            //GetPathByChildID
             $.post("WebService/ShopService.ashx", { 'Action': 'GetPathByChildID','ChildID':id }, function (data, state) {
                if (state == "success") {
                    if(data.length>2){
                        var dd=data.substr(0,data.length-1).split(",");
                        switch(dd.length)
                        {
                            case 4:
                                 _GetFirstClass(dd[0]);
                                 _SelClass(dd[0],dd[1]);
                                 _SelClass2(dd[1],dd[2]);
                                 _SelClass3(dd[2],dd[3]);
                                 //$("#hidenClass").val(dd[3]);                        
                                 break;
                            case 3:
                                _GetFirstClass(dd[0]);
                                _SelClass(dd[0],dd[1]);
                                _SelClass2(dd[1],dd[2]);
                                //$("#hidenClass").val(dd[2]); 
                                break;
                            case 2:
                                
                                _SelClass(dd[0],dd[1]);
                                //$("#hidenClass").val(dd[1]); 
                            case 1://new add 2012-10-19
                                _GetFirstClass(dd[0]);
                                break;
                        }
                        if(dd.length>0){
                            ShowCommodit();//new add
                            $("#<%=Class_ParenID.ClientID %>").val(dd[0]);
                            $("#<%=hidenClass.ClientID %>").val(dd[dd.length-1]);
                            $("#<%=button_next_step.ClientID %>").attr("disabled","");
                            $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
                            //new add 2012-10-19
                            hfClassID=dd[dd.length-1];
                            setTimeout("ShowCommodit()",1000);//当前选择的商品类别
                            setTimeout("next_step()",1000);//下一步按钮可用、商品分类ID最后一级
                        }                        
                    }
                }
            });
        }
        //下一步按钮可用、商品分类ID最后一级
        function next_step(){
            $("#<%=button_next_step.ClientID %>").attr("disabled","");
            $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
            $("#<%=hidenClass.ClientID %>").val(hfClassID);
        }

        //页面加载时添加
        function GetFirstClass(){        
            $("#class_div_1 ul").html("");//new add
             //一级目录
            $.post("WebService/ShopService.ashx", { 'Action': 'GetRootClass',d:new Date() }, function (data, state) {
            //alert(state);
                if (state == "success") {
                //alert(data);
                    var d = eval( data);
                    var $class_div_1_ul = $("#class_div_1 ul");                    
                    $.each(d.table1, function (i) {
                    if(!(d.table1[i].ClassName=="服务商品"||d.table1[i].ClassName=="创美商品")){
                        $class_div_1_ul.append(" <li class='' id='item_" + d.table1[i].ClassID + "' > <a class='' href='javascript:SelClass(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a> </li>");
                        }
                        else
                        {
                        //alert("加载失败！");
                        }
                    });
                }
            });
        }

        function RSelClass(sen,id){
                $("#commoditydd").html($(sen).html());
                 $("#<%=button_next_step.ClientID %>").attr("disabled", "");
                 $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
                $("#hidenClass").val(id);
                  ajaxMethod("GetProductIDBySearch", function (d) {
                        $.each(d.table1, function (i) {
                        $("#<%=Class_ParenID.ClientID %>").val(d.table1[i].ClassID);
                        });
                    }, "{ 'ID': '" + id + "' }");
           
        }


        //搜索
        function searchClick(){        
        if ($("#searchKey").val() == "请输入商品名称或分类属性名称" || $("#searchKey").val() == "") {
            alert("请输入商品名称或分类属性名称");
            return;
            } else {
                var a = 1;
                $("#searchList ul").html("");
                $(".wp_sort").hide();
                $(".wp_search_result").show();
                $("#searchSome").attr("style", "display:block");
                $("#searchNone").attr("style", "display:none");
                ajaxMethod("GetProductClassBySearch", function (d) {
                    $("#searchEnd").hide();
                    $.each(d.table1, function (i) {
                        a = 2;
                        if(!(d.table1[i].ClassName.indexOf("服务商品")>=0||d.table1[i].ClassName.indexOf("创美商品")>=0)){
                        $("#searchList ul").append(" <li onclick='RSelClass(this," + d.table1[i].ClassID + ")' id='item_sear_" + d.table1[i].ClassID + "' nc_type='searchList_name'>" + d.table1[i].ClassName + "</li>");
                        }
                    });
                    if (a == 1) {
                        $("#searchNone").attr("style", "display:block");
                        $("#searchSome").attr("style", "display:none");
                    }                       
                }, "{ 'ClassName': '" + $("#searchKey").val() + "' }");                    
            }
          }


        //ajax开始
        $(function () {
            //一级目录
            GetFirstClass();

            //常用的商品分类
            $.post("WebService/ShopService.ashx", { 'Action': 'GetAddProductClassUser','UserID':<%=user.UserID %>}, function (data, state) {
                if (state == "success") {
                    var d = eval(data);
                    $("#commListArea ul").html("");
                    $.each(d.table1, function (i) {
                        $("#commListArea ul").append("<li nc_type='" + d.table1[i].ClassID + "' id='item_type_" + d.table1[i].ClassID + "'><span  onclick='ViewClassByID(" + d.table1[i].ClassID + ")' class='title'>" + d.table1[i].ClassName + "</span><a class='del_unavailable' title='删除' href='JavaScript:DeleteStr(" + d.table1[i].ClassID + ");'></a></li>");
                    });
                }
            });

            //搜索
//            $("#searchBtn").click(function () {
//                if ($("#searchKey").val() == "请输入商品名称或分类属性名称" || $("#searchKey").val() == "") {
//                    alert("请输入商品名称或分类属性名称");
//                    return;
//                } else {
//                    var a = 1;
//                    $("#searchList ul").html("");
//                    $(".wp_sort").hide();
//                    $(".wp_search_result").show();
//                    $("#searchSome").attr("style", "display:block");
//                    $("#searchNone").attr("style", "display:none");
//                    ajaxMethod("GetProductClassBySearch", function (d) {
//                        $("#searchEnd").hide();
//                        $.each(d.table1, function (i) {
//                            a = 2;
//                            if(!(d.table1[i].ClassName.indexOf("服务商品")>=0||d.table1[i].ClassName.indexOf("创美商品")>=0)){
//                            $("#searchList ul").append(" <li onclick='RSelClass(this," + d.table1[i].ClassID + ")' id='item_sear_" + d.table1[i].ClassID + "' nc_type='searchList_name'>" + d.table1[i].ClassName + "</li>");
//                            }
//                        });
//                        if (a == 1) {
//                           $("#searchNone").attr("style", "display:block");
//                           $("#searchSome").attr("style", "display:none");
//                        }
//                       
//                    }, "{ 'ClassName': '" + $("#searchKey").val() + "' }");
//                    
//                }
//            });



            //添加数据
            $("#commoditya a").click(function () {
                var p = $("#<%=hidenClass.ClientID %>").val();
                $.post("WebService/ShopService.ashx", { 'Action': 'GetAddProductClass', 'ClassID': p }, function (data, state) {
                    if (state == "success") {
                        if(data=="1"){
                            alert("添加成功!");
                        }
                        else{
                            alert("请稍后再试!");
                        }
                    }
                }, true);
            });

            //请选择
            $("#commSelect").click(function () {
                if ($("#commListArea").css("display") == "none") {
                    $("#commListArea").attr("style", "cursor: pointer; overflow: auto; display: block");
                } else {
                    $("#commListArea").attr("style", "cursor: pointer; overflow: auto; display: none");
                }
            });
            $("#commListArea").mouseleave(function(){
                $(this).hide();
            });
        });
        function ShowList() {
            $(".wp_sort").attr("style", "display:block");
            $(".wp_search_result").attr("style", "display:none");
        }

        function ShowCommodit() {
            $("#commodityspan").hide();
            $("#commoditydt").show();
            var $Class = $("#class_div ul li[id^=item_]").find(".classDivClick span");   //#FFFAEA
            var arrClass = '';
            $Class.each(function () {
                arrClass += $(this).html() + ">";
            });
            arrClass = arrClass.substr(0, arrClass.lastIndexOf(">"));
            $("#commoditydd").html(arrClass);//您当前选择的商品类别项
        }
       
        /**************************** 选择类别块的项begin ***********************************/
        function SelClass(id) {
            var a = 1;
            $("#class_div_2 ul").html("");
            $("#class_div_1 ul li").find("a").removeClass("classDivClick");
            $("#item_" + id).find("a").attr("class", "classDivClick");
            
            $("#class_div_2 ul li").find("a").removeClass("classDivClick");//new add 2012-10-19
            $("#class_div_3 ul li").find("a").removeClass("classDivClick");//new add 2012-10-19
            $("#class_div_4 ul li").find("a").removeClass("classDivClick");//new add 2012-10-19

            ajaxMethod("GetProductClassByParentID", function (d) {
                $.each(d.table1, function (i) {

                    $("#class_div_2 ul").append("<li id='item_2_" + d.table1[i].ClassID + "'><a href='javascript:SelClass2(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a></li>");
                });
                $("#<%=button_next_step.ClientID %>").attr("disabled", "disabled");
                $("#class_div .sort_list .wp_category_list").eq(1).removeClass("blank");
                $("#commoditya").attr("style", "display:none");
                $("#<%=Class_ParenID.ClientID %>").val(id);
                $("#<%=hidenClass.ClientID %>").val("");
                a = 2;
                
            }, "{ 'ParentID': '" + id + "' }");
            ShowCommodit();
            //没有数据
            if (a == 1) {
                $("#class_div .sort_list .wp_category_list").eq(1).addClass("blank");
                $("#class_div .sort_list .wp_category_list").eq(2).addClass("blank");
                $("#class_div .sort_list .wp_category_list").eq(3).addClass("blank");
                $("#<%=button_next_step.ClientID %>").attr("disabled", "");
                $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
                $("#class_div_3 ul").html("");
                $("#class_div_4 ul").html("");
                $("#commoditya").attr("style", "display:block");
                $("#<%=hidenClass.ClientID %>").val(id);
            }
        }

        function SelClass2(id) {
            var a = 1;
            $("#class_div_3 ul").html("");
            $("#class_div_2 ul li").find("a").removeClass("classDivClick");
            $("#item_2_" + id).find("a").attr("class", "classDivClick");
            
            $("#class_div_3 ul li").find("a").removeClass("classDivClick");//new add 2012-10-19
            $("#class_div_4 ul li").find("a").removeClass("classDivClick");//new add 2012-10-19

            ajaxMethod("GetProductClassByParentID", function (d) {
                $.each(d.table1, function (i) {

                    $("#class_div_3 ul").append("<li id='item_3_" + d.table1[i].ClassID + "'><a href='javascript:SelClass3(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a></li>");
                });
                a = 2;
                $("#<%=button_next_step.ClientID %>").attr("disabled", "disabled");
                $("#class_div .sort_list .wp_category_list").eq(2).removeClass("blank");
                $("#commoditya").attr("style", "display:none");
                $("#<%=hidenClass.ClientID %>").val("");
            }, "{ 'ParentID': '" + id + "' }");
            ShowCommodit();
            //没有数据
            if (a == 1) {
                $("#class_div .sort_list .wp_category_list").eq(2).addClass("blank");
                $("#class_div .sort_list .wp_category_list").eq(3).addClass("blank");
                $("#<%=button_next_step.ClientID %>").attr("disabled", "");
                $("#<%=button_next_step.ClientID %>").removeAttr("disabled");//
                $("#class_div_4 ul").html("");
                $("#commoditya").attr("style", "display:block");
                $("#<%=hidenClass.ClientID %>").val(id);
            }
        }
        function SelClass3(id) {
            var a = 1;
            $("#class_div_4 ul").html("");
            $("#class_div_3 ul li").find("a").removeClass("classDivClick");
            $("#item_3_" + id).find("a").attr("class", "classDivClick");
            
            $("#class_div_4 ul li").find("a").removeClass("classDivClick");//new add 2012-10-19

            ajaxMethod("GetProductClassByParentID", function (d) {
                $.each(d.table1, function (i) {
                    $("#class_div_4 ul").append("<li id='item_4_" + d.table1[i].ClassID + "'><a href='javascript:SelClass4(" + d.table1[i].ClassID + ");'><span class='has_leaf'>" + d.table1[i].ClassName + "</span></a></li>");
                });
                a = 2;
                $("#<%=button_next_step.ClientID %>").attr("disabled", "disabled");
                $("#class_div .sort_list .wp_category_list").eq(3).removeClass("blank");
                $("#commoditya").attr("style", "display:none");
                $("#<%=hidenClass.ClientID %>").val("");
            }, "{ 'ParentID': '" + id + "' }");
            ShowCommodit();
            //没有数据
            if (a == 1) {
                $("#<%=button_next_step.ClientID %>").attr("disabled", "");
                $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
                $("#class_div .sort_list .wp_category_list").eq(3).addClass("blank");
                $("#commoditya").attr("style", "display:block");
                $("#<%=hidenClass.ClientID %>").val(id);
            }
        }

        function SelClass4(id) {
            $("#class_div_4 ul li").find("a").removeClass("classDivClick");
            $("#item_4_" + id).find("a").attr("class", "classDivClick");
            ShowCommodit();
            $("#button_next_step").attr("disabled", "");
            $("#<%=button_next_step.ClientID %>").removeAttr("disabled");
            $("#commoditya").attr("style", "display:block");
            $("#<%=hidenClass.ClientID %>").val(id);
        }
        /**************************** 选择类别块的项end ***********************************/
        //删除数据
        function DeleteStr(id) {
            $.post("WebService/ShopService.ashx", { 'Action': 'GetDeleteProductClass', 'ClassID': id }, function (data, state) {
                if (state == "success") {
                    $("#item_type_" + id).remove();
                }
            }, true);
        }


        function ajaxMethod(method, callback, d) {
            var json = {};
            $.ajax({
                type: 'POST',
                url: "WebService/WebService.asmx/" + method,
                data: d || {},
                contentType: "application/json",
                success: function (data) {
                    if (data.d == null) {
                        return;
                    } else {
                        callback(eval('(' + data.d + ')'));
                    }
                },
                dataType: "json"
            });
            return json;
        }
        //ajax结束

        //验证
        $(function () {
            $("#searchKey").focus(function () {
                if ($("#searchKey").val() == "请输入商品名称或分类属性名称") {
                    $("#searchKey").val("");
                }
            });
            $("#searchKey").blur(function () {
                if ($("#searchKey").val() == "") {
                    $("#searchKey").val("请输入商品名称或分类属性名称");
                }
            });
        });
        //
        //搜索——回车键
        function searchKeyPress(obj) {
            if (event.keyCode == 13) {
            if(obj=="searchKey"){
                $("#searchBtn").click();
            }
            }
        }
    </script>
</body>
</html>
