<%@ page language="C#" enableeventvalidation="true" validaterequest="false" autoeventwireup="true" inherits="ad_Search, WebApp_deploy" enableviewstate="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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>高级搜索</title>
    <style type="text/css">
    body{font-size:12px; color:#333;}
	form{margin:0; padding:0;}
    table{background:#ddd;width:100%;margin:0 auto;}
    table th{ text-align:right;padding:5px;width:150px;font-weight:normal;background:#f0f0f0}
    table td{ text-align:left;padding:5px; background:#f9f9f9;}

#MainMenu { width:700px; margin:0 auto; text-align:center}
#MainMenu .TabMenu { WIDTH: 100%; HEIGHT:26px; overflow:hidden;}
#MainMenu .TabMenu UL#M1 { margin:0; padding:0;}
#MainMenu UL#M1 LI { FLOAT: left; MARGIN: 0 2px 0 0px;}
#MainMenu UL#M1 LI A { DISPLAY: block; COLOR: #333333; BACKGROUND: url(images/shop_navBtn_b.gif) no-repeat center top;  WIDTH: 77px; HEIGHT: 30px; LINE-HEIGHT: 28px; TEXT-ALIGN: center; TEXT-DECORATION: none;}
#MainMenu UL#M1 LI A:hover { COLOR: #ff0000;}
#MainMenu UL#M1 LI.active { BACKGROUND: none transparent scroll repeat 0% 0%;  HEIGHT: 30px}
#MainMenu UL#M1 LI.active A { COLOR: #ff0000; BACKGROUND: url(images/shop_navBtn_b2.gif) no-repeat center top; }
    </style>
</head>
<body>
<script type="text/javascript" src="Js/HoWave_ShopClass.js"></script>
<script type="text/javascript">

//http://localhost/ProductList.aspx?parentid=551&title=&parentid=555&parentid=&saler_name=&place=&startprice=&endprice=&enddate=
//http://localhost/ProductList.aspx?parentid=129&title=&saler_name=&place=&startprice=&endprice=&enddate=
function show_search(showtype){
   var search_array=["search_product","search_shop"];
   for(var i=0;i<search_array.length;i++){
     if(document.getElementById(search_array[i])){
        document.getElementById(search_array[i]).style.display=search_array[i]==showtype?'block':'none';
     }
   }

}

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;
        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;
}
function InitClass(){
 
  changeClass("0","ListBox1,ListBox2,ListBox3");
  changeClass("0","shopclass"); 
 
}  

</script>
<div id="MainMenu">
<h3>高级搜索</h3>
<div class="TabMenu">
    <ul id="M1">
       <li class="active"><a href="javascript:show_search('search_product')">搜索商品</a></li>
       <%if(ShowShop) %>
       <%{ %>
       <li><a href="javascript:show_search('search_shop')">搜索店铺</a></li>
       <%} %>
       
    </ul>
</div>
<form method="get" action="ProductList.aspx">
<input type="hidden" name="parentid" value="0" id="parentid"/>
<table cellpadding="0" cellspacing="1" id="search_product">
    <tr>
       <th>关键字:</th>
       <td><input type="text" name="title" /></td>
    </tr>
      <tr>
       <th>类别:</th>
       <td><select  id="ListBox1" onchange="changeClass(this.value,'ListBox2,ListBox3');"   onclick="selectClass(this.value,this.id)"  style="width:150px"></select>
<select id="ListBox2" name="ClassID" onchange="changeClass(this.value,'ListBox3');"   onclick="selectClass(this.value,this.id)" style="width:150px"></select>
<select id="ListBox3" onclick="selectClass(this.value,this.id)" style="width:150px"></select></td>
    </tr>
    <%if(ShowShop) %>
    <%{ %><tr><%} %>
    <%else %><%{ %><tr style="display:none"><%} %>
       <th>卖家会员名</th>
       <td><input name="saler_name" /></td>
    </tr>
      <tr>
       <th>商品类型</th>
       <td><input type="checkbox" name="stanprice" value="1" />一口价
           <input type="checkbox" name="auction" value="1" />拍卖
           <input type="checkbox" name="teambuy" value="1" />团购
       </td>
    </tr>
     <tr>
       <th>所在地</th>
       <td><input type="text" name="place" /></td>
    </tr>
      <tr>
       <th>价格:</th>
       <td><input type="text" name="startprice" />至<input type="text" name="endprice" /></td>
    </tr>
    <tr>
       <th>属性</th>
       <td><input type="checkbox" name="isnew" value="1" />全新<input type="checkbox" name="secondhand" value="1" />二手</td>
    </tr>
    <tr>
       <th>结束时间:</th>
       <td><input type="text" name="enddate" value="" />天之内</td>
    </tr>
    <tr>
       <td colspan="2" style="text-align:center;background:#f5f5f5">
	<input type="submit" value="搜索" />
	<input type="button" value="返回" onclick="history.back()" />
       </td>
    </tr>
</table>
</form>


<form method="get" action="Search_Shop.aspx">
<table cellpadding="0" cellspacing="1" id="search_shop" style="display:none">
    <tr>
       <th>店铺名称:</th>
       <td><input type="text" name="shopname" /></td>
    </tr>
   
      <tr>
       <th>店长名称</th>
       <td><input type="text" name="shopsaler" /></td>
    </tr>
    <tr>
       <th>店铺分类:</th>
       <td><select id="shopclass"  name="classid" > </select>
       </td>
    </tr>
    <tr>
       <th>店铺主营:</th>
       <td><input type="text" name="mainitem" /></td>
    </tr>
     <tr>
       <th>店铺等级:</th>
       <td><select  name="shoplevel" >
              <option value="">不限</option>
              <option value="">普通店铺</option>
              <option value="">高级店铺</option>
              <option value="">品牌店铺</option>
           </select>
       </td>
    </tr>
    <tr>
       <th>所在地</th>
       <td><input type="text" name="shopplace" /></td>
    </tr>     
    <tr>
       <td colspan="2" style="text-align:center;background:#f5f5f5">
	<input type="submit" value="搜索" />
	<input type="button" value="返回" onclick="history.back()" />
       </td>
    </tr>
</table>
<script type="text/javascript" >
InitClass();

</script>
</form>
</div>
</body>
</html>
