<%@ page language="C#" autoeventwireup="true" inherits="Diy_Diyif, WebApp_deploy" enableEventValidation="false" %>

<!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="css/diy_buy.css" type="text/css" rel="stylesheet" />
    </head>
    <body id="left_frame" style="font-size:12px;">
        <input type="hidden" name="parentid" value="0" id="parentid"/>
        <div class="left_frame_main">
            <div class="pcbox_1">
                <div class="caption">
                    <span class="left_title"><strong class="l_title">自助装机中心</strong></span></div>
            </div>
            <div class="select_type">
                    <div class="select_1">
                        <label>大类</label>
                        <select id="ListBox1" class="bigtype" onchange="changeClass(this.value,'ListBox2,ListBox3');"   onclick="selectClass(this.value,this.id)" ></select>
                        <label>小类</label>
                        <select id="ListBox2" class="smalltype" onchange="changeClass(this.value,'ListBox3');"   onclick="selectClass(this.value,this.id)"></select>
                        <label>品牌</label>
                        <select id="ListBox3" class="brand" onclick="selectClass(this.value,this.id)"></select>
                    </div>
                    <div class="select_2">
                        <input id="txtName" class="keyword" onblur="if(this.value=='') this.value='型号关键字';" onfocus="if(this.value=='型号关键字') this.value='';"
                            value="型号关键字" name="nameLike" /><input id="btnSumbit" class="submit" type="button" onclick="ajaxGetSource()" value="搜索" />
                    </div>
            </div>
            <div class="hack11px">
            </div>
            <div class="select_down_1"></div>
            <table cellspacing="0" cellpadding="0" width="95%" border="0">
                <thead>
                    <tr bgcolor="#e4eaee">
                        <td valign="middle" align="center" width="35%" height="28">商品名称</td>
                        <td valign="middle" align="center" width="15%">价格</td>
                        <td valign="middle" align="center" width="35%">所在地</td>
                        <td valign="middle" align="center" width="15%">选用</td>
                    </tr>
                </thead>
                <tbody  class="type_list" id="divContent">
                    
                </tbody>
            </table>
        </div>
<script type="text/javascript" src="../Js/jquery/jquery.js"></script>
<script type="text/javascript" src="../Js/HoWave_ShopClass.js"></script>
<script type="text/javascript">

function parentShowId(classid,parentId){
    $('#ListBox1').val(parentId);
    selectClass(parentId,'ListBox1')
    changeClass(parentId,'ListBox2,ListBox3');
    $('#ListBox2').val(classid);
    ajaxGetSource();
}

function addInPlaylist(classid,name,price){
    self.parent.addInPlaylist(classid,name,price);
}


function ajaxGetSource(){
    if($('#btnSumbit').attr('disabled')=="disabled")return;
    $('#btnSumbit').attr('disabled',"disabled");
    var parentId=$('#ListBox1').val();
    if(parentId=='')parentId=0;
    
    var t=$('#ListBox2').val();
    if(t=='')t=0;
    
    var test=$('#txtName').val();
    if(test=="型号关键字")test="";
    
    $.post("ProductList1.aspx",{"ParentId":parentId,"Classid":$('#ListBox2').val(),"title":test},function(result){
        $('#divContent').html(result);
        $('#btnSumbit').removeAttr('disabled');
    });
}

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 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;
        selectObj.options[selectObj.length]=new Option("","");
        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 classObjArray=["ListBox1","ListBox2","ListBox3"];
  get_select_class(ClassValue);
  
  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 get_select_class(id){
   if(id!=null &&  id!="")
     document.getElementById("parentid").value=id;
}

changeClass("0","ListBox1,ListBox2,ListBox3");
changeClass("0","shopclass"); 
ajaxGetSource();
</script>        
</body>


</html>
