<%@ page language="C#" masterpagefile="~/Shop/ShopMasterPage/ShopMasterPage.master" autoeventwireup="true" inherits="Shop_Search_Search, HoWaveVGO" title="商品搜索" enableEventValidation="false" %>

<%@ Register Src="../UserControls/ShowProduct.ascx" TagName="ShowProduct" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True"/>
<script language="javascript" type="text/javascript" src="../Js/howave_time.js"></script> 
<div id="Category_Content">
   <!--导航栏--->
   <div id="Navigator_Bar">
   </div>
   <!--搜索栏-->
   <div id="Search_Bar">
      <div id="Search_Form">
         <div id="Search_C1" class="SearchBar_Style"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;商品搜索:&nbsp;</b>
              <asp:DropDownList ID="SercharType" runat="server">
                 <asp:ListItem Text="搜索商品" Value="Product"/>
                 <asp:ListItem Text="搜索店铺" Value="Shop" />
                 <asp:ListItem Text="搜索店长" Value="ShopOwner" />
              </asp:DropDownList>
         </div>
         <div id="Search_Text" class="SearchBar_Style">
             <asp:TextBox ID="SearchText" runat="server" Width="200px"/>
         </div>
         <div id="Search_Class_List" class="SearchBar_Style">
             <asp:DropDownList ID="SearchClass" runat="server" Width="200px" DataSourceID="ObjectDataSource6" DataTextField="ClassName" DataValueField="ClassID" AppendDataBoundItems="true">
                 <asp:ListItem Value="0">所有分类</asp:ListItem>
             </asp:DropDownList>  
         </div>
         <div id="Search_Button" class="SearchBar_Style">
             <asp:Button ID="SearchButton" runat="server" Text="搜索" Width="100px" OnClick="SearchButton_Click"/>
         </div>      
      </div>
   </div>
   <!--热门搜索，相关搜索-->
   <div id="Hot_Relative_Search">
      <div id="Hot">相关搜索：</div>
      <div id="Hot_Result">
          <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="HyperLink" EnableViewState="False" Width="98%">
          </asp:BulletedList>
      </div>   
   </div>
   <!--分类导航条-->
   <div id="Catergor_Navgitor">
       <div style="float:left"><a href="search.aspx" target='_self'>所有分类</a>&nbsp;>&nbsp;</div>
       <asp:DataList ID="DataList2" runat="server" RepeatColumns="6" DataSourceID="ObjectDataSource3">
         <ItemTemplate>
          <div style="float:left">
             <asp:HyperLink ID="HyperLink1" runat="server" Text='<%#Eval("ClassName")+" > "%>' NavigateUrl='<%#"Search.aspx?ParentID="+Eval("ClassID")%>'/>
          </div>   
         </ItemTemplate>
       </asp:DataList>
   </div>
   <!--子分类列表-->
   <div id="ChildClass_List">
     <div>您可以选择下面的详细分类：</div>
     <asp:DataList ID="ChildCategory" runat="server" DataKeyField="ClassID" DataSourceID="ObjectDataSource1"
        Height="100%" RepeatColumns="5" Width="100%">
        <ItemTemplate>
           <asp:HyperLink ID="ProName" runat="server" NavigateUrl='<%# "search.aspx?ParentID="+Eval("ClassID") %>' Text='<%# Eval("ClassName") %>'></asp:HyperLink>
           <span>(<asp:literal ID="ClassProducCount" runat="server"  Text='<%# Eval("ItemCount") %>'/>)</span>
        </ItemTemplate>
     </asp:DataList>
     <div align="center" style="margin:15px 0px 10px 0px"><input type="image" src="../Images/Show_CategoryList_All_Btn.gif"  id="Show_CategoryList_All"/></div>   
   </div> 
   <!--主栏目-->
   <div id="Main_Frame">
      <!--侧栏-->
      <div id="Side_Bar">
<!--筛选-->
    <div style="border:1px solid #CCCCCC; padding-bottom:10px;">
      <div style="background-color:#EEEEEE; height:20px;padding-top:5px;padding-left:5px;"><b>商品筛选</b></div>
      <div style="padding-left:5px;">
      <ul>
        
          <li>
            <input name="SaleType1" type="checkbox" value="1" >
            一口价 &nbsp;&nbsp;&nbsp;
            <input name="SaleType2" type="checkbox" value="2" onClick="if(this.checked) showDriftType.style.display='';else showDriftType.style.display='none'" >
            拍 卖</li><li>
            <input name="Degree2" type="checkbox" id="Degree2" value="2" >
            二　手 &nbsp;&nbsp;&nbsp;
            <input name="Degree1" type="checkbox" value="1" >
            全 新</li><li id="showDriftType" style="display:none;">
            <input name="PriceSearchType" type="radio" value="0" checked="checked" />
            按当前价搜索
            <input name="PriceSearchType" type="radio" value="1" />
            按起始价搜索</li><li>价&nbsp;&nbsp; 格:
            <input name="BeginPrice" type="text" size="5" maxlength="10" value=""/>
            至
            <input name="EndPrice" type="text" size="5" maxlength="10" value=""/>
          </li>
          <li>所在地:
            <input name="Address" type="text" id="Address" size="14" value="">
          </li>
          <li>关键字:
            <input name="KeyWord" type="text" id="KeyWord" size="14" value="">
          </li>
          <li class="line_center">
            <input name="Submit3" type="button" value="结果中筛选" onClick="return false;">
            <input name="submit4" type="submit" value="重新搜索" >
          </li>
       
      </ul>
      </div>
    </div>
<!--搜索-->
         <div style="height:10px;"></div>
           <div style="border:1px solid #CCCCCC; padding-bottom:10px;">
           <div style="background-color:#EEEEEE; height:20px;padding-top:5px;padding-left:5px;"><b>商城推荐</b></div>
           <div>
               &nbsp;</div>
               <uc1:ShowProduct ID="ShowProduct1" runat="server" Num="10" Type="IsElite" />
         </div>
         <div id="side_recommend"></div>
         <div style="height:10px;"></div>
         <div style="border:1px solid #CCCCCC; padding-bottom:10px;">
            <div style="background-color:#EEEEEE; height:20px;padding-top:5px;padding-left:5px;"><b>您浏览过的商品</b></div>
            <div>
                <!--<iframe src="http://auction.paipai.com/commodity_viewed.html" frameborder="0" scrolling="no" width="180" height="200" allowtransparency="true"></iframe>-->
            </div>
         </div>
         <div class="side_item" id="ShowBbsPageMain" style="display:none">
            <div class="li_head">推荐热贴</div>
            <div id="ShowBbsPage"></div>
         </div>
      </div>
	     
         
      <!--商品展示主栏-->
      <div id="Product_List">
      <div id="mainSarR">
         <!--商品显示按钮栏-->
         <div id="Product_List_Title">   
            <ul>
               <li class="li_now"><a href="#" onclick="html_doAuthType(0)" title="由身份证认证的高级卖家发布的商品"><span>店铺商品</span></a></li><!--<li class=""><a href="#" onclick="html_doAuthType(1)" title="由手机认证的初级卖家发布的商品"><span style="padding:7px 7px 0;">跳蚤市场商品</span></a></li>--></ul>
            <div style="float:left;padding-top:10px;" class="font_gray"></div>
            <div class="line_right font_gray" style="padding-top:5px"></div>           
         </div>
         <!--商品显示方式选择栏-->
         <div id="Prodcut_Show_Type">
            <div class="Layout_Float_Left">显示方式：列表 图片</div>
            <div class="Layout_Float_Right">
                <div class="Layout_Float_Left">排序方式：</div>
                <div class="Layout_Float_Left">
                   <asp:DropDownList ID="Sort_Type" runat="server" Width="120px" AutoPostBack="true" OnSelectedIndexChanged="Sort_Type_SelectedIndexChanged" >
                      <asp:ListItem Text="选择排序方式" Value="-1" />
                      <asp:ListItem Text="价格从低到高" Value="1" />
                      <asp:ListItem Text="价格从高到低" Value="2" />
                      <asp:ListItem Text="时间从小到多" Value="3" />
                      <asp:ListItem Text="时间从多到小" Value="4" />
                      <asp:ListItem Text="卖家信用从高到低" Value="5" />
                      <asp:ListItem Text="卖家信用从低到高" Value="6" />
                      <asp:ListItem Text="浏览量从高到低" Value="7" />
                      <asp:ListItem Text="浏览量从低到高" Value="8" />
                   </asp:DropDownList>
                </div>
             </div>
         </div>
         <div id="show_prieview" style="position:absolute;z-index:1; border:solid 1px black; padding:10px; background:white; display:none;"></div>
         <!--商品比较上栏-->
         <div id="Product_Compare_Top">
            <div style="float:left; width:17%;padding-top:5px;">
               <asp:ImageButton runat="server" ImageUrl="../Images/Category_Compare_Btn.gif" id="ImageCompare" OnClick="ImageCompare_Click"/>
            </div>          
            <div style="float:left;width:35%;padding-top:8px;">商品名称</div>
            <div style="float:right;width:45%;">
              <div  style="float:left;width:23%;padding-top:8px; text-align: center;">价格</div>
              <div  style="float:left;width:32%;padding-top:5px; text-align: center;">
                <asp:DropDownList ID="F_ProductPlace" runat="server" DataSourceID="ObjectDataSource5" DataTextField="City" DataValueField="City" AppendDataBoundItems="True" OnSelectedIndexChanged="F_ProductPlace_SelectedIndexChanged">
                   <asp:ListItem Text="所在地" Value="-1" />
                </asp:DropDownList>
              </div>
              <div style="float:left; width:25%; padding-top:8px; text-align: center;">浏览量</div>
              <div style="float:left; width:19%; padding-top:8px; text-align: center;">剩余时间</div>
            </div>
            
         </div>
         <!--商品列表栏-->
         <div id="Porduct_List_Main">
           <asp:UpdatePanel ID="UpdatePanel1" runat="server">
             <ContentTemplate>
               <asp:DataList ID="DataList1" runat="server" Width="100%"   OnItemDataBound="DataList1_ItemDataBound" DataKeyField="ProductID"  >
                   <ItemTemplate>
                     <div class="Product_Item">
                      <div style="float:left; width:20px"><asp:CheckBox ID="Compare" runat="server" /></div>
                      <div style="float:left; width:100px;text-align:center;">
                          <asp:HyperLink ID="ProductImageUrl" NavigateUrl='<%#"../Auction/Auction.aspx?ProductID="+ Eval("ProductID") %>' runat="server" >
                             <asp:Image ID="ProductImage" runat="server"  ImageUrl='<%#"../"+Eval("ProductImageUrl") %>'  Width="100px" />
                          </asp:HyperLink>
                          
                      </div>
                      <div style="float:left; width:35%; padding-left:5px;">
                         <div style="width:100%">
                            <asp:HyperLink ID="ProductName" Text='<%#Eval("ProductName") %>' NavigateUrl='<%#"../Auction/Auction.aspx?ProductID="+ Eval("ProductID") %>' runat="server" />
                         </div>
                         <div style="width:100%">   
                           卖家:<asp:HyperLink ID="HyperLink3" Text='<%#Eval("ShopOwnerName") %>' NavigateUrl='<%# Eval("ShopID") %>' runat="server" />
                         </div>
                         <div style="width:100%">    
                          <asp:HyperLink ID="QQLink" runat="server" NavigateUrl='<%# "http://wpa.qq.com/msgrd?V=1&Uin="+Eval("OICQ")+"&amp;Site="+Eval("ShopOwnerName")+"&amp;Menu=yes" %>' Target="_blank">
                             <asp:Image  ID="QQImage" ImageUrl='<%# Eval("OICQ")%>' runat="server" />
                          </asp:HyperLink>
                          <asp:HyperLink ID="TaobaoLink" runat="server" NavigateUrl='<%# Eval("Taobaowangwang") %>' Target="_blank">
                               <asp:Image ID="TaobaoImage" ImageUrl='<%# Eval("Taobaowangwang") %>' runat="server"  AlternateText="点击此可以直接和对方交流"/>
                           </asp:HyperLink>
                           <asp:HyperLink ID="GetTomyFav" runat="server" Text="收藏" NavigateUrl='<%#"../Member/Shop_AddMyFav.aspx?ProductID="+Eval("ProductID")+"&tag=AddProFav" %>' />                        
                         </div>
                      </div>
                      <div style="float:right;width:40%;">
                      <div style="float:left; width:25%;">
                         <div style="width:100%">
                           <asp:Label ID="ProductType" Text='<%#Eval("ProductType") %>' runat="server" />
                         </div>
                          <asp:PlaceHolder ID="TeamPeopleLeft_Display" runat="server" Visible="false">
                           <asp:Label ID="TeamPeopleLeft" Text='<%#"还剩"+Eval("LeftPeople")+"人" %>' runat="server" />
                          </asp:PlaceHolder>                        
                         <div style="width:100%">   
                           <asp:Label ID="ProductPrice" Text='<%#Eval("StandPrice")+"元" %>' runat="server" ForeColor="red" />
                         </div>
                      </div>   
                      <div style="float:left; width:32%"><asp:Literal ID="ProductPlace" Text='<%#Eval("ProductPlace") %>' runat="server" /></div>
                      <div style="float:left; width:15%; padding-left:10px;"><asp:Literal ID="Hits" Text='<%# Eval("Hits") %>' runat="server" /></div>   
                      <div style="float:right; width:20%; text-align:center;"><asp:Literal ID="LeftTime" Text='<%#"<script>showlefttime("+ Eval("LeftTime")+")</script>" %>' runat="server" />
                       <asp:HiddenField ID="F_ProductID" Value='<%#Eval("ProductID") %>' runat="server" />
                     </div>
                     </div>
                     </div>
                   </ItemTemplate>                   
             </asp:DataList>
             </ContentTemplate>    
               <Triggers>
                   <asp:AsyncPostBackTrigger ControlID="Sort_Type" EventName="SelectedIndexChanged" />
               </Triggers>
           </asp:UpdatePanel>
          <%-- <div style="float:right; padding:10px;">
              <asp:Literal ID="CurrentPage" runat="server" />
              <asp:HyperLink ID="FirstPage" Text="首页" runat="server" />
              <asp:HyperLink ID="PrevPage"  runat="server"><img src="../Images/pre_page.gif" /></asp:HyperLink>
              <asp:HyperLink ID="NextPage"  runat="server"><img src="../Images/next_page.gif" /></asp:HyperLink>
              <asp:HyperLink ID="LastPage" Text="尾页" runat="server" />
              到第<asp:TextBox ID="GoToPage" Width="20px" runat="server" />页<asp:Button ID="GoPageBtn" Text="确定" runat="server" OnClick="GoToPageBtn_Click" />
           </div>   --%>
           <div style="padding:10px;" align="center">
            <asp:Literal ID="ItemCount" runat="server" />
            <asp:Literal ID="CurrentPage" runat="server" />
            <asp:HiddenField ID="H_CurrentPage" runat="server" Value="0"/>
            <asp:HiddenField ID="H_SearchType" runat="server" Value="0"/>
            <asp:LinkButton ID="First" runat="server" CommandArgument="first" OnClick="PagerButton_Click">首 页</asp:LinkButton>
            <asp:LinkButton ID="Prev" runat="server" CommandArgument="prev" OnClick="PagerButton_Click">上一页</asp:LinkButton>
            <asp:LinkButton ID="Next" runat="server" CommandArgument="next" OnClick="PagerButton_Click">下一页</asp:LinkButton>
            <asp:LinkButton ID="Last" runat="server" CommandArgument="last" OnClick="PagerButton_Click">尾 页</asp:LinkButton>
                  到第<asp:TextBox ID="GoToPage" Width="20px" runat="server" />页<asp:Button ID="GoPageBtn" Text="确定" runat="server" OnClick="GoToPageBtn_Click" />
    </div>
         </div>
         <!--商品比较下栏-->
         <div id="Product_Compare_Bottom"></div>
         <!--商品分页栏栏-->
         <div id="Product_Page"></div>
         
      
      </div> 
   </div>
   </div>
</div>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetCategoryListByParentID" TypeName="Shop_Class" OldValuesParameterFormatString="original_{0}">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="ParentID" QueryStringField="ParentID"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
   
   
    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="GetClassMapPathByParentID"
        TypeName="Shop_Class">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="ParentID" QueryStringField="ParentID"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
     <asp:HiddenField ID="H_PageCount" runat="server" />
      <asp:HiddenField ID="H_PageSize" runat="server"  />
      <asp:HiddenField ID="H_SearchName" runat="server"  />
    &nbsp;
    <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" SelectMethod="GetImportantCityByFlag" TypeName="Shop_City"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource6" runat="server" SelectMethod="GetAllParentClass"
        TypeName="Shop_Class"></asp:ObjectDataSource>
    <asp:HiddenField ID="H_title" runat="server" />
    <asp:HiddenField ID="H_class" runat="server" />   
    <script type="text/javascript">
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0 
function dyniframesize(iframename) {
  var pTar = null;
  if (document.getElementById){
    pTar = document.getElementById(iframename);
  }
  else{
    eval('pTar = ' + iframename + ';');
  }
  if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
    
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
      //ns6 syntax
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
      //ie5+ syntax
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
}

function GoPage()
{
   var _Gopage=document.getElementById("Page").value;
   if(_Gopage!="")
   {
      if(isNaN(_Gopage))
      {
           alert("你输入的页码包含其它字符，请重新输入！");
      }
      else if(parseInt(_Gopage)<1)
      {
         alert("输入页码过小，请输入正确页面！");
      }
      else
      {
        location.href="Search_Product.aspx?"+BindSearchParam("page",_Gopage,false);
      }      
      
   }
   else
   {
      alert("输入页码过小，请输入正确页面！");
   }
}


function BindSearchParam(RequestName,sValue,PageFirst)
{
   var str_font="ctl00_ContentPlaceHolder1_";
   
   var j_pageIndex=document.getElementById(str_font+"H_Page").value;
   var j_othertype=document.getElementById(str_font+"H_OtherType").value; 
   var j_sorttype=document.getElementById(str_font+"H_sortType").value; 
   var j_classid=document.getElementById(str_font+"H_parentid").value;
   var j_pageSize=document.getElementById(str_font+"H_PageSize").value;   
   var j_standprice=(document.getElementById(str_font+"s_standprice").checked==true)?"1":"0";
   var j_auction=(document.getElementById(str_font+"s_auction").checked==true)?"1":"0";
   var j_teambuy=(document.getElementById(str_font+"s_teambuy").checked==true)?"1":"0";
   var j_startprice=document.getElementById(str_font+"startprice").value;
   var j_endprice=document.getElementById(str_font+"endprice").value;
   var j_place=escape(document.getElementById(str_font+"Address").value);
   var j_title=document.getElementById(str_font+"KeyWord").value;
   var j_isnew=(document.getElementById(str_font+"s_new").checked==true)?"1":"0";
   var j_second=(document.getElementById(str_font+"s_secondhand").checked==true)?"1":"0";
   switch(RequestName)
    {
        case "stanprice":
            j_standprice=sValue;
            break;
        case "page":
            j_pageIndex = sValue;
            break;
        case "pagesize":
            j_pageSize = sValue;
            break;
        case "sorttype":
            j_sorttype=sValue;
            break;
        case "othertype":
            j_othertype = sValue;
            break;
        case "Parentid":
            j_classid=sValue;
            break;
        case "place":
            j_place=sValue;
            break;
        case "title":
            j_title=sValue;
            break;
        case "endprice":
            j_endprice=sValue;
            break;
        case "startprice":
            j_startprice=sValue;
            break;
        case "secondhand":
            j_second = sValue;
            break;
        case "isnew":
            j_stanprice=sValue;
            break;
        case "teambuy":
            j_teambuy=sValue;
            break;
        case "auction":
            j_auction=sValue;
            break;           
            break;

    }
    if (PageFirst==true)
        j_pageIndex = "1";
    var QuerryString = "page=" + j_pageIndex + "&pagesize=" + j_pageSize + "&sorttype=" + j_sorttype + "&othertype=" + j_othertype + "&Parentid=" + j_classid + "&place=" + j_place + "&title=" + j_title + "&endprice=" + j_endprice + "&startprice=" + j_startprice + "&secondhand=" + j_second + "&isnew=" + j_isnew + "&teambuy=" + j_teambuy + "&auction=" + j_auction + "&stanprice=" + j_standprice;
    return QuerryString;
  
   
}
function ChangeSelect(RequesetName,sValue)
{ 
   location.href="Search_Product.aspx?"+BindSearchParam(RequesetName,sValue,true);
}

function DetailSearchBtnClick()
{
   location.href="Search_Product.aspx?"+BindSearchParam("","",true);   
  
}

</script> 
</asp:Content>


