<%@ page language="C#" autoeventwireup="true" inherits="Shop_Search_Search_Product, HoWaveVGO" title="商品搜索" enableviewstate="false" enableEventValidation="false" %>
<html>
<body>
<form id="form_1" runat="server">
<script language="javascript" type="text/javascript" src="../Js/howave_time.js"></script> 
<div id="Category_Content">
  
   <!--分类导航条-->
   <div id="Catergor_Navgitor">
      <hl:ClassMapPath id="ClassMapPath1" runat="server"/><asp:Literal runat="server" ID="SearchProudctCount" />
   </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_Product.aspx?"+ this.GetBindQuerryString("Parentid",Convert.ToString(Eval("ClassID")),true) %>' Text='<%# Eval("ClassName") %>'></asp:HyperLink>
           <span>(<asp:literal ID="ClassProducCount" runat="server"  Text='<%# Eval("ItemCount") %>'/>)</span>
        </ItemTemplate>
     </asp:DataList>    
   </div>
   <!--主栏目-->
    <div id="Main_Frame">
         
      <!--商品展示主栏-->
      <div id="Product_List">
          <div id="mainSarR">      
             <!--商品显示按钮栏-->
             <div id="MainMenu">
	             <div class="TabMenu">
		         <!--一级导航-->				
                    <ul id="M1" >
                       <li class="active"><asp:HyperLink ID="allLink" runat="server" Text="所有商品" /></li><li><asp:HyperLink ID="recommendLink" runat="server" Text="橱窗推荐" /></li><li><asp:HyperLink ID="commondLink" runat="server" Text="集市商品" /></li><li><asp:HyperLink ID="bandShopLink" runat="server" Text="品牌商城" /></li><li><asp:HyperLink ID="secondhandLink" runat="server" Text="二手/闲置" /></li></ul>
                 </div>
                 <script type="text/javascript">
                    function setButtonActive(flags)
                    {
                       var _flag=parseInt(flags);
                       var ulObj=document.getElementById("M1");
                       
                       for(var i=0;i<ulObj.childNodes.length;i++)
                         ulObj.childNodes[i].className="";
                         _flag=_flag+ulObj.childNodes.length-5;
                         ulObj.childNodes[_flag].className="active";
                    }
                    setButtonActive(<asp:Literal ID="ButtonIndex" runat="server"/>);
                </script>
                 <!--商品显示方式选择栏-->
                 <div id="Prodcut_Show_Type">
                    
                    <div class="show_num">每页显示数量：</div>
                    <div class="show_page">
                       <asp:HyperLink ID="Page20Link" runat="server"><asp:Image ImageUrl="../Images/page_20.gif" runat="server" ID="Page_20" /></asp:HyperLink>
                       <asp:HyperLink ID="Page40Link" runat="server"><asp:Image ImageUrl="../Images/page_40.gif" runat="server" ID="Page_40"/></asp:HyperLink>
                       <asp:HyperLink ID="Page80Link" runat="server"><asp:Image ImageUrl="../Images/page_80.gif" runat="server" ID="Page_80"/></asp:HyperLink>
                    </div>
                    
                    <div class="show_place">
                           <asp:DropDownList ID="F_ProductPlace" runat="server" DataSourceID="ObjectDataSource5" DataTextField="City" DataValueField="City" AppendDataBoundItems="True" >
                              <asp:ListItem Text="所在地" Value="-1" />
                           </asp:DropDownList>
                            &nbsp;&nbsp;
                           <asp:DropDownList ID="Sort_Type" runat="server" Width="120px" >
                              <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 style="clear:both"></div>           
           
              <div id="PreviewBox" onmouseout="hidePreview(event);">
	            <div class="Picture" onmouseout="hidePreview(event);">
		            <span></span>
		            <div>
			            <a id="previewUrl" href="javascript:void(0)" target="_blank"><img oncontextmenu="return(false)" id="PreviewImage" src="about:blank" border="0" onmouseout="hidePreview(event);" /></a>
		            </div>
	            </div>
             </div>
             <script type="text/javascript" src="../Js/picPreview.js"></script>
            
             
             <!--商品列表栏-->
             <div id="Porduct_List_Main">  
                  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  OnRowDataBound="GridView1_RowDataBound" DataKeyNames="ProductID" AllowPaging="True" 
                  AllowSorting="True"  EnableViewState="false" CssClass="ProductList" BorderWidth="0" OnPageIndexChanging="GridView1_PageIndexChanging" CaptionAlign="Left" >
                     <PagerSettings  Visible="False"/>
                     <Columns>             
                        <asp:TemplateField >
                           <ItemTemplate>
                              <input type="checkbox" name="cb_id" value='<%# Eval("ProductID") %>' />
                           </ItemTemplate>
                           <HeaderTemplate>
                              <img src="../Images/Category_Compare_Left.gif" onclick="doCompare()" style="cursor:pointer" />
                           </HeaderTemplate>
                         </asp:TemplateField>
                        
                        <asp:TemplateField HeaderStyle-HorizontalAlign="left">
                           <ItemTemplate>
                           <div class="PicItem">
                              <div class="Pic">
                                 <a href='<%#"../Auction/Auction.aspx?ProductID="+ Eval("ProductID") %>' Target="_blank" style="background:url(<%#"../"+Eval("ProductSmallImageUrl")%>) no-repeat" onmouseover='showPreview(event);' onmouseout='hidePreview(event);'>
                                  <asp:Image ID="ProductImage" runat="server"  ImageUrl='<%#"../"+Eval("ProductSmallImageUrl")+""%>' /></a>
                              </div> 
                            </div>
                                            
                           </ItemTemplate>
                           <HeaderTemplate>
                              <img src="../Images/Category_Compare_Btn.gif" onclick="doCompare()" style="cursor:pointer" />
                           </HeaderTemplate>
                    
                           <HeaderStyle Width="15%" />
                        </asp:TemplateField>
                        <asp:TemplateField>
                           <HeaderTemplate>商品名称/卖家</HeaderTemplate>
                           <ItemTemplate>
                                <asp:HyperLink ID="ProductName" Text='<%#Eval("ProductName") %>' NavigateUrl='<%#"../Auction/Auction.aspx?ProductID="+ Eval("ProductID") %>' runat="server"  Target="_blank"/>
                                 </div>
                                 <div style="width:100%">   
                                   卖家：<a href='<%#"../Shop1/Shop_ShopIntro.aspx?UserID="+ Eval("SalerID") %>' style="color:Gray;"><%#Eval("ShopOwnerName") %></a> &nbsp;&nbsp;<asp:Literal ID="BandShop" runat="server" Text='<%# Eval("ShopLevel") %>' />
                                 </div>
                                 <div style="width:100%">    
                                  <a href='<%# "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" />
                                 </a>
                                 <a href="http://amos1.taobao.com/msg.ww?v=2&amp;Uid=<%#Server.UrlEncode(Convert.ToString(Eval("Taobaowangwang"))) %>&s=2" target="_blank">
                                 <asp:Image ID="TaobaoImage" ImageUrl='<%# Eval("Taobaowangwang") %>' runat="server"  AlternateText="点击此可以直接和对方交流"/></a><br />
                                 <a href='<%#"../Member/Shop_AddMyFav.aspx?ProductID="+Eval("ProductID")+"&tag=AddProFav" %>'  Target="_blank"  title="收藏商品"><img src='../Images/myfav_icon.gif'/></a>   
                                  
                           </ItemTemplate>
                           <HeaderStyle Width="42%" />
                           <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>   
                        <asp:TemplateField>
                            <HeaderTemplate>价格</HeaderTemplate>
                           <ItemTemplate>
                              <asp:Label ID="ProductType" Text='<%#Eval("ProductType") %>' runat="server" /><br /> 
                               <asp:PlaceHolder ID="TeamPeopleLeft_Display" runat="server" Visible="false">
                                   <asp:Literal ID="TeamPeopleLeft" Text='<%#"还剩"+Eval("LeftPeople")+"人" %>' runat="server" />
                               </asp:PlaceHolder>
                               <span><asp:Label ID="ProductPrice" Text='<%#Eval("ProductPrice") %>' runat="server" />元</span>                                          
                           </ItemTemplate>
                           <HeaderStyle Width="10%" />
                        </asp:TemplateField>
                         <asp:TemplateField>
                            <HeaderTemplate>
                              所在地
                           </HeaderTemplate>
                           <ItemTemplate>
                              <asp:Literal ID="ProductPlace" Text='<%#Eval("ProductPlace") %>' runat="server" />                                          
                           </ItemTemplate>
                           <HeaderStyle Width="10%" />
                        </asp:TemplateField>
                         <asp:TemplateField>
                            <HeaderTemplate>浏览量</HeaderTemplate>
                           <ItemTemplate>
                              <asp:Literal ID="Hits" Text='<%# Eval("Hits") %>' runat="server" />                                          
                           </ItemTemplate>
                           <HeaderStyle Width="10%" />
                        </asp:TemplateField>
                         <asp:TemplateField>
                            <HeaderTemplate>剩余时间</HeaderTemplate>
                           <ItemTemplate>
                             <asp:Literal ID="LeftTime" Text='<%#"<script>showlefttime("+ Eval("LeftTime")+")</script>" %>' runat="server" />                                                         
                           </ItemTemplate>
                           <HeaderStyle Width="10%" />
                        </asp:TemplateField>               
                     </Columns>    
                     <AlternatingRowStyle CssClass="AltrowStyle" />    
                     <EmptyDataTemplate>很抱歉!没有你查找的商品,缩减你的关键字查找的机率会高些!</EmptyDataTemplate>
                  </asp:GridView>
                  <div class="productPageStyle" >
                     <asp:Literal ID="CurrentPage" runat="server" />页&nbsp;&nbsp;
                     
                     <asp:HyperLink ID="Pre_Page" runat="server"  Text="<img src='../Images/pre_page_1.gif' style='height:18px;width:19px' />"  ToolTip="上一页"/>
                     <asp:HyperLink ID="FirstPage" runat="server" Text="1" CssClass="pg"/>&nbsp;<asp:literal runat="server"  ID="NumberPageHolder" />&nbsp;
                     <asp:HyperLink ID="LastPage" runat="server" Text="尾页" CssClass="pg" />
                     <asp:HyperLink ID="Next_Page" runat="server"  Text="<img src='../Images/next_page_1.gif' style='height:18px;width:52px' />" ToolTip="下一页"/>
                     到 第
                     <input size="4" id="Page" />&nbsp;页&nbsp;<input type="button" value="查看"  onclick="GoPage();"/>
                     
                 </div>
                 <!--商品比较下栏-->
                 <div id="Product_Compare_Bottom"></div>
                 <!--商品分页栏栏-->
                 
         
             </div>
          </div> 
      </div>
   </div>
         <!--侧栏-->
      <div id="Side_Bar">
         <!--筛选-->
         <div class="SideBox">
              <div class="title"><b>商品筛选</b></div>
              <div style="padding-left:5px;">
              <ul style="list-style-type:none;">
                  <li>
                     <asp:CheckBox ID="s_auction" runat="server" Text="拍卖" />
                     <asp:CheckBox ID="s_teambuy" runat="server" Text="团购" /> 
                     <asp:CheckBox ID="s_standprice" runat="server" Text="一口价" />              
                  </li>
                  <li>
                     <asp:CheckBox ID="s_secondhand" runat="server" Text="二手" />
                     <asp:CheckBox ID="s_new" runat="server" Text="全新" />
                  </li>
                  <li>价格范围：<span style="padding-left:5px !important; padding-left:6px;"><asp:TextBox  ID="startprice" runat="server" Width="40px"/></span>至：<asp:TextBox ID="endprice"  runat="server" Width="40px"/>
                      <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="startprice"
                          ErrorMessage="价格必须为非负数的数字类型" MaximumValue="999999999" MinimumValue="0" Type="Double" Display="Dynamic"/>
                      <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="endprice"
                          ErrorMessage="价格必须为非负数的数字类型" MaximumValue="999999999" MinimumValue="0" Type="Double" Display="Dynamic"/>
                  </li>
                  <li style="padding-top:3px; padding-bottom:3px;">所&nbsp;在&nbsp;地：
                    <asp:TextBox ID="Address" runat="server" Width="110px"/>
                  </li>
                  <li>关&nbsp;键&nbsp;字：
                    <asp:TextBox ID="KeyWord" runat="server" Width="110px"/>
                  </li>
                  <li style="text-align:center;">             
                     <input type="button" value="确定" id="DetailSearchBtn" onclick="DetailSearchBtnClick()" />                          
                  </li>
               
              </ul>
              </div>
         </div>
         <div class="SideBox">
             <div class="title"><b>商城推荐</b></div>
            
         </div>
         <div class="SideBox">
              <div class="title"><b>热销商品</b></div>
              <div class="ListShop_E">           
               
              </div>
         </div>
        <iframe src="../Auction/LastVisited.aspx"  style="border:0" frameborder="0" width="200px" height="0px" scrolling="no" id="myTestFrameID" onload="javascript:{dyniframesize('myTestFrameID');}" ></iframe>
	 </div>
    </div> 
</div>
<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 j_pageIndex=document.getElementById("H_Page").value;
   var j_othertype=document.getElementById("H_OtherType").value; 
   var j_sorttype=document.getElementById("H_sortType").value; 
   var j_classid=document.getElementById("H_parentid").value;
   var j_pageSize=document.getElementById("H_PageSize").value;   
   var j_standprice=(document.getElementById("s_standprice").checked==true)?"1":"0";
   var j_auction=(document.getElementById("s_auction").checked==true)?"1":"0";
   var j_teambuy=(document.getElementById("s_teambuy").checked==true)?"1":"0";
   var j_startprice=document.getElementById("startprice").value;
   var j_endprice=document.getElementById("endprice").value;
   var j_place=escape(document.getElementById("Address").value);
   var j_title=document.getElementById("KeyWord").value;
   var j_isnew=(document.getElementById("s_new").checked==true)?"1":"0";
   var j_second=(document.getElementById("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=" +escape(j_place) + "&title=" + escape(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: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:HiddenField ID="H_PageCount" runat="server" Value="" />
      <asp:HiddenField ID="H_Page" runat="server" Value="" />
      <asp:HiddenField ID="H_PageSize" runat="server" Value=""  />
      <asp:HiddenField ID="H_SearchName" runat="server"  Value="" />
      <asp:HiddenField ID="H_OtherType" runat="server" Value=""  />
      <asp:HiddenField ID="H_title" runat="server" Value="" />
      <asp:HiddenField ID="H_class" runat="server" Value="" />
      <asp:HiddenField ID="H_productPlace" runat="server" Value="" />
      <asp:HiddenField ID="H_sortType" runat="server" Value="" />
      <asp:HiddenField ID="H_standprice" runat="server" Value="" />
      <asp:HiddenField ID="H_teambuy" runat="server" Value="" />
      <asp:HiddenField ID="H_auction" runat="server" Value="" />
      <asp:HiddenField ID="H_isnew" runat="server" Value="" />
      <asp:HiddenField ID="H_secondhand" runat="server" Value=""  />
      <asp:HiddenField ID="H_startprice" runat="server" Value="" />
      <asp:HiddenField ID="H_endprice" runat="server" Value=""  />
      <asp:HiddenField ID="H_parentid" runat="server" Value="" />
   
    
    <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" SelectMethod="GetImportantCityByFlag" TypeName="Shop_City"/>
    <asp:ObjectDataSource ID="ObjectDataSource6" runat="server" SelectMethod="GetAllParentClass" TypeName="Shop_Class"/>
</form>
</body>
</html>

   
