<%@ page language="C#" autoeventwireup="true" inherits="Shop_Auction_ShopClassChoose, WebApp_deploy" title="商品分类选择" viewstateencryptionmode="Never" enableviewstatemac="false" validaterequest="false" %>
<html>
<head>

</head>
<body>
<div id="warp"  style=" margin:0 auto;width:760px;">
    <div id="head" style=" height:30px;">
        <div id="menu">
		    <ul id="menu_head"> 
		      <li><img src="../Images/Step_01_End.gif" align="absMiddle" hspace="10" />选择出售方式</li>
		      <li class="li_now"><img src="../Images/Step_02_Begin.gif" align="absMiddle" hspace="10" />选择商品分类</li>
		      <li><img src="../Images/Step_03_End.gif" align="absMiddle" hspace="10" />填写商品详情</li>
		    </ul>
	    </div>    
    </div>
    <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="js/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"  disabled="disabled"/>
          </div>
<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 CheckChooseEnd(ctlname){ 
//   var rowIndex=document.getElementById(ctlname).selectedIndex;
//   var selectname=document.getElementById(ctlname).options[rowIndex].innerText;
//   var _button=document.getElementById("ChooseSuccesButton");
//   if(selectname.indexOf("->") == -1 )
//    { 
//       _button.disabled=false;
//    }
//    else
//    {
//       _button.disabled=true;
//    }     
//   
// }
  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>
   
    <asp:HiddenField ID="h_c_p_changeclass" runat="server" Value=""/>
    <asp:HiddenField ID="h_c_p_name" runat="server" />
    <asp:HiddenField ID="h_c_p_type" runat="server" />
    <asp:HiddenField ID="h_c_p_desc" runat="server" />
    <asp:HiddenField ID="h_c_p_auction_price" runat="server" />
    <asp:HiddenField ID="h_c_p_auction_standprice" runat="server" />
    <asp:HiddenField ID="h_c_p_standprice" runat="server" />
    <asp:HiddenField ID="h_c_p_teamprice1" runat="server" />
    <asp:HiddenField ID="h_c_p_teamprice2" runat="server" />
    <asp:HiddenField ID="h_c_p_teamprice3" runat="server" />
    <asp:HiddenField ID="h_c_p_teamprice4" runat="server" />
    <asp:HiddenField ID="h_c_p_teamprice5" runat="server" />
    <asp:HiddenField ID="h_c_p_teamtype" runat="server" />
    <asp:HiddenField ID="h_c_p_stocks" runat="server" />
    <asp:HiddenField ID="h_c_p_province" runat="server" />
    <asp:HiddenField ID="h_c_p_city" runat="server" />
    <asp:HiddenField ID="h_c_p_className" runat="server" />
    <asp:HiddenField ID="h_c_p_classID" runat="server" />
    <asp:HiddenField ID="h_productID" runat="server" />
    <asp:HiddenField ID="h_Request" runat="server" />
        </form>
           
   </div>
</body>
</html>
    





