<%@ page language="C#" autoeventwireup="true" inherits="Web_ClassChoose, WebApp_deploy" title="商品分类选择" viewstateencryptionmode="Never" enableviewstatemac="false" validaterequest="false" enableEventValidation="false" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
  <script type="text/javascript" src="/Js/HoWave_Cookie.js"></script>
 <script type="text/javascript">

 ShowClassSelect("useful_select_class");
 function GetClassByParentID(ParentID){
  var ClassArray=new Array();
  for(var x in _class){
     var _classArray=_class[x]
	 if(_classArray[1]==ParentID){
	    var _array=new Array();
		_array[0]=_classArray[0];
		_array[1]=x;
                _array[2]=_classArray[2];
		ClassArray.push(_array);        
	 }
  } 
  return ClassArray;  

}

function GetAreaCode(Name){
  for(var x in _class){  
    if(unescape(_class[x][0])==Name){
       return x;       
    
    }
  }
  return "";
}
function changeClass(ParentID,changeSelectIDArray){
 
  var classArray=GetClassByParentID(ParentID);
  var changeSelect=changeSelectIDArray.split(',');
  for(var k=0;k<changeSelect.length;k++)
  {
     var selectObj=document.getElementById(changeSelect[k]);
     if(selectObj!=null)
     {
        selectObj.options.length=0;
        if(k==0)
        {            
            for(var i=0;i<classArray.length;i++)
            { 
               var _name=classArray[i][0];
               if(classArray[i][2]!="0")
               {
                      _name+="->";
               }    
               selectObj.options[selectObj.length]=new Option(_name,classArray[i][1]);
	
           }
        }
        
     } 

  }
}
function selectClass(ClassValue,id)
{
  
  var selectCurrentObj=document.getElementById(id);
  if(selectCurrentObj==null || selectCurrentObj.options.length==0 || selectCurrentObj.selectedIndex==-1)
  {
    return;
  }
  var selectCurrentText=selectCurrentObj.options[selectCurrentObj.selectedIndex].text;
  var selectTextObj  =document.getElementById("WhatYouChoose");
  var submitButtonObj=document.getElementById("ChooseSuccesButton");  
  var classObjArray=["ListBox1","ListBox2","ListBox3","ListBox4"];
  selectTextObj.innerHTML="";
  document.getElementById("h_c_p_classID").value=ClassValue;
  if(selectCurrentText.lastIndexOf("->")==-1)
  {
     submitButtonObj.disabled=false;
  }
  else
  {
     submitButtonObj.disabled=true;
  }
  for(var x=0;x<classObjArray.length;x++)
  {
     
     var selectObj=document.getElementById(classObjArray[x]);    
     if(selectObj!=null && selectObj.options.length>0 && selectObj.selectedIndex!=-1)
     {
         var selectText=selectObj.options[selectObj.selectedIndex].text;
         
         selectTextObj.innerHTML +=selectText;
        

     }
     
  }
  
  
}

function InitClass(){
 
  changeClass("0","ListBox1,ListBox2,ListBox3,ListBox4");
 
}  
InitClass();

  function AutoSelectClass(itemName)
  {    
     var button= document.getElementById("ChooseSuccesButton");
     var showClass=document.getElementById("WhatYouChoose");
     if(itemName!="")
     {
       // showClass.innerHTML=itemName;
        button.disabled=false;
      } 
      else
      {
        //showClass.innerHTML="";
         button.disabled=true;
      }  
        
  } 
  function checkSubmit()
  {
     var selectClassName=document.getElementById("WhatYouChoose").innerHTML;
     selectClassName=selectClassName.replace(/&nbsp;/gi,"");
     selectClassName=selectClassName.replace(/&gt;/gi,">");
     var goType=document.getElementById("h_Request");
     var goUrl="ShopSaleProduct.aspx";
     var p_id=document.getElementById("h_productID").value;
     var postClassName=document.getElementById("h_c_p_className");
     postClassName.value=selectClassName;
     if(goType.value=="1")
     {
        goUrl="shop_request_product.aspx";
     }
     else if(goType.value="2" &&  p_id!="" && parseInt(p_id)>0)
     {
        
        goUrl="ProductEdit.aspx?ProductID="+p_id;
     }     
     var select_class_id=$("h_c_p_classID").value;
     
    
     SaveClass(selectClassName,select_class_id);
      var _form=document.forms[0]; 
     _form.action=goUrl;
     _form.method="post";
     _form.target="_self";
     _form.submit();
    
  }
</script>
</head>
<body>

 
    <div style=" height:13px; line-height:13px;width:760px;  border-top:solid 3px #ff9900; background:url(/Images/graybar.gif)">&nbsp;</div>
        <form id="form1" runat="server">
           <script type="text/javascript" src="/Shop/UploadFile/HoWave_ShopClass.js"></script>
            <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
	           <tr>
	              <td width="300" align="left" scope="col">
	                  <asp:Image ID="SellProductPic" Width="243px" Height="74px" runat="server" />	      
	              </td>
	              <td scope="col">
	                  <div class="readtome">
	                     <span style="color:#D63004;font-weight:bold;">温馨提醒：</span>请核对您发布的商品是否符合最新商品发布规则；没通过实名认证的会员,发布的商品将会暂时放入仓库，认证通过后即可上架。 
                            <a href="/Credit/identify_choose.aspx">认证请这边走</a>
	                 </div>
                  </td>
	          </tr>
           </table>
          <div style="clear:both;"></div>
          <div id="select_content">
                <div id="useful_select_class"></div>
                <div class="select_style">
                       <asp:ListBox ID="ListBox1" runat="server" CssClass="select_box" onchange="changeClass(this.value,'ListBox2,ListBox3,ListBox4');"   onclick="selectClass(this.value,this.id)" />
                </div>
                 <div class="select_style">
                       <asp:ListBox ID="ListBox2" runat="server" CssClass="select_box" onchange="changeClass(this.value,'ListBox3,ListBox4');" onclick="selectClass(this.value,this.id)"/>
                </div>
                 <div class="select_style">
                      <asp:ListBox id="ListBox3" runat="server" CssClass="select_box" onchange="changeClass(this.value,'ListBox4');" onclick="selectClass(this.value,this.id)"/>
                </div>
                <div class="select_style">
                     <asp:ListBox id="ListBox4" runat="server" CssClass="select_box" onclick="selectClass(this.value,this.id)"/>
                </div>
          </div>
          <table id="select_result" style="width:760px; clear:both; ">
              <tr>
                  <td width="80px">你选择的是：</td>
                  <td style="text-align:left;">
                     <span id="WhatYouChoose"  class="SelectChooseStyle" ></span> 
                  </td> 
              </tr>
          </table> 
          <div style=" text-align:center; margin:10px 0px 15px" >      
              <input type="button" onclick="checkSubmit()" value="选好了，继续" id="ChooseSuccesButton"  />
          </div>
        </form>

</body>
</html>
    





