<%@ page language="C#" autoeventwireup="true" inherits="Tuan_Default, WebApp_deploy" %>

<!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 runat="server">
    <title>威购-团购首页</title>
    <meta name="Keywords" content=" 恒浪威购商城,仿淘宝商城,仿易趣,仿拍拍,团购系统,团购网站,动易多用户,团购汽车,团购论坛,团购,动易商城,仿淘宝多用户商城,电子商务网站,B2T,仿淘宝系统,电子商务网,B2C,电子商务平台">
    <meta name="Description" content=" 恒浪威购商城,仿淘宝商城,仿易趣,仿拍拍,团购系统,团购网站,动易多用户,团购汽车,团购论坛,团购,动易商城,仿淘宝多用户商城,电子商务网站,B2T,仿淘宝系统,电子商务网,B2C,电子商务平台">
    <link href="Skin/TuanBuyCSS/TuanList.css" rel="stylesheet" type="text/css" />
    <script src="Skin/CommStyle/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script type="text/javascript">
	
        function Getmouseover(obj) {
            //alert('成功');

            $(obj).css("border", "1px solid #FF0000");

        }

        function Getmouseout(obj) {
            //alert('成功');
            $(obj).css("border", "0px solid ");

        }
        
        
   function GetTime() { 

var _flag=parseInt(<%=flag %>);
var _PageSize=parseInt(<%=PageSizeNum %>);
var now = new Date(); 
for(var i=0;i< _PageSize;i++)
{

    var EndDate=document.getElementById("EndTime"+i).value;
    var ShowTime=document.getElementById("ShowTime"+i);
   // var ProductNum=parseInt(document.getElementById("ProductNum"+i).value);
    var LiveClock1 = document.getElementById("beginTime"+i);
var EndYear=EndDate.split("-")[0];
var EndMonth=EndDate.split("-")[1];
var EndDay=EndDate.split("-")[2].split(" ")[0];

var HourMseond=EndDate.split(" ")[1].split(":");

var EndHour=HourMseond[0];
var EndMinute=HourMseond[1];
var Endsecond=HourMseond[2];
var deadline= new Date(EndMonth+"/"+EndDay+"/"+EndYear+" "+ EndHour +":" +EndMinute+":"+Endsecond); //开幕后计时 

 var intDiff=deadline-now;
 
var now2=new Date();
var diff = -480 - now.getTimezoneOffset() //是北京时间和当地时间的时间差 
var leave = (deadline.getTime() - now2.getTime())+diff*60000
var Startday = Math.floor(leave / (1000 * 60 * 60 * 24)) 
var Starthour = Math.floor(leave / (1000*3600)) - (Startday * 24) 
var Startminute = Math.floor(leave / (1000*60)) - (Startday * 24 *60) - (Starthour * 60) 
var Startsecond = Math.floor(leave / (1000)) - (Startday * 24 *60*60) - (Starthour * 60 * 60) - (Startminute*60)


if(intDiff>0)
{
  
   ShowTime.innerHTML = Startday+"天"+Starthour+"小时"+Startminute+"分"+Startsecond +"秒";
   }
      var TuanBuy=document.getElementById("TuanButton"+i);//团购
       var market=document.getElementById("marketButton"+i);//一口价
       var MallButton=document.getElementById("auctionMallButton"+i);//秒杀
       
       var hrefTodayTuan=document.getElementById("hrefTodayTuan"+i);//获取需要图片连接团购页面
       var hrefProduct=document.getElementById("hrefProduct"+i);//获取需要图片连接商品展示页面
       
       var hrefTuanName=document.getElementById("hrefTuanName"+i);//获取团购商品标题连接
       var hrefProductName=document.getElementById("hrefProductName"+i);//获取一口价、秒杀标题连接
       
       var ProductType=parseInt(document.getElementById("ProductType"+i).value);//商品类型
    if(_flag==1)
    {
        TuanBuy.style.display="none";
        market.style.display="block";
        hrefTodayTuan.style.display="none";
        hrefProduct.style.display="block";
        
        hrefTuanName.style.display="none";
        hrefProductName.style.display="block";
    }
    else if(_flag==4)
    {
        TuanBuy.style.display="none";
        MallButton.style.display="block";
        hrefTodayTuan.style.display="none";
        hrefProduct.style.display="block";
        
        hrefTuanName.style.display="none";
        hrefProductName.style.display="block";
    }
    else if(_flag==0)
    {
        if(ProductType==1)
        {
            TuanBuy.style.display="none";
            market.style.display="block";
            
             hrefTodayTuan.style.display="none";
             hrefProduct.style.display="block";
             
             hrefTuanName.style.display="none";
             hrefProductName.style.display="block";
        }
        else if(ProductType==4)
        {
            TuanBuy.style.display="none";
            MallButton.style.display="block";
            
             hrefTodayTuan.style.display="none";
             hrefProduct.style.display="block";
             
             hrefTuanName.style.display="none";
            hrefProductName.style.display="block";
            
        }
      
    }
 }
setTimeout("GetTime()",1000);
}


function PassAddress(strType,value)
{
    //共四个参数：Type,pageindex,Classification,Price,Sorting
    
    var PassType1="";
    var PassType2="";
    var PassType3="";
    var PassType4="";
    var PassType5="";
    
    var GetAddress=window.location.href;
    
    var SubAddress=GetAddress.split('?');
    if(SubAddress.length>1)
    {
         var SubParater=SubAddress[1].split('&');
         
         switch(SubParater[0].split('=')[0])
         {
             case "Type":
                 if(strType=="Type")
                 {
                    PassType1="?Type="+value;
                 }
                 else
                 {
                     PassType1="?Type="+request("Type");
                 }
                 if(strType=="pageindex")
                 {
                     PassType2="&pageindex="+value;
                 }
                 else if(request("pageindex")!="")
                 {
                     PassType2="&pageindex="+request("pageindex");
                 }
                 if(strType=="Classification")
                 {
                     PassType3="&Classification="+value;
                 }
                 else if(request("Classification")!="")
                 {
                     PassType3="&Classification="+request("Classification");
                 }
                 if(strType=="Price")
                 {
                     PassType4="&Price="+value;
                 }
                 else if(request("Price")!="")
                 {
                     PassType4="&Price="+request("Price");
                 }
                 
                 if(strType=="Sorting")
                 {
                     PassType5="&Sorting="+value;
                 }
                 else if(request("Sorting")!="")
                 {
                     PassType5="&Sorting="+request("Sorting");
                 }
                 break;
            case "pageindex":
                 
                 if(strType=="pageindex")
                 {
                    PassType2="?pageindex="+value
                 }
                 else
                 {
                     PassType2="?pageindex"+request("pageindex");
                 }
                 
                 if(strType=="Type")
                 {
                    PassType1="&Type="+value;
                 }
                 else if(request("Type")!="")
                 {
                     PassType1="&Type="+request("Type");
                 }
                 
                 if(strType=="Classification")
                 {
                     PassType3="&Classification="+value;
                 }
                 else if(request("Classification")!="")
                 {
                     PassType3="&Classification="+request("Classification");
                 }
                 if(strType=="Price")
                 {
                     PassType4="&Price="+value;
                 }
                 else if(request("Price")!="")
                 {
                     PassType4="&Price="+request("Price");
                 }
                 if(strType=="Sorting")
                 {
                     PassType5="&Sorting="+value;
                 }
                 else if(request("Sorting")!="")
                 {
                     PassType5="&Sorting="+request("Sorting");
                 }
                 break;
             case "Classification":
                 if(strType=="Classification")
                 {
                     PassType3="?Classification="+value;
                 }
                 else
                 {
                     PassType3="?Classification="+request("Classification");
                 }
                 
                 if(strType=="Type")
                 {
                     PassType1="&Type="+value;
                 }
                 else if(request("Type")!="")
                 {
                     PassType1="&Type="+request("Type");
                 }
                 
                 if(strType=="pageindex")
                 {
                     PassType2="&pageindex="+value;
                 }
                 else if(request("pageindex")!="")
                 {
                     PassType2="&pageindex="+request("pageindex");
                 }
                 
                 if(strType=="Price")
                 {
                     PassType4="&Price="+value;
                 }
                 else if(request("Price")!="")
                 {
                     PassType4="&Price="+request("Price");
                 }
                  if(strType=="Sorting")
                 {
                     PassType5="&Sorting="+value;
                 }
                 else if(request("Sorting")!="")
                 {
                     PassType5="&Sorting="+request("Sorting");
                 }
                 break;
              case "Price":
                 
                 if(strType=="Price")
                 {
                     PassType4="?Price="+value;
                 }
                 else
                 {
                     PassType4="?Price="+request("Price");
                 }
                  
                 if(strType=="Classification")
                 {
                     PassType3="&Classification="+value;
                 }
                 else if(request("Classification")!="")
                 {
                     PassType3="&Classification="+request("Classification");
                 }
                 
                 if(strType=="Type")
                 {
                     PassType1="&Type="+value;
                 }
                 else if(request("Type")!="")
                 {
                     PassType1="&Type="+request("Type");
                 }
                 
                 if(strType=="pageindex")
                 {
                     PassType2="&pageindex="+value;
                 }
                 else if(request("pageindex")!="")
                 {
                     PassType2="&pageindex="+request("pageindex");
                 }
                 if(strType=="Sorting")
                 {
                     PassType5="&Sorting="+value;
                 }
                 else if(request("Sorting")!="")
                 {
                     PassType5="&Sorting="+request("Sorting");
                 }
                 break;
             case "Sorting":
                  if(strType=="Sorting")
                 {
                     PassType5="?Sorting="+value;
                 }
                 else
                 {
                     PassType5="?Sorting="+request("Sorting");
                 }
                 if(strType=="Classification")
                 {
                     PassType3="&Classification="+value;
                 }
                 else if(request("Classification")!="")
                 {
                     PassType3="&Classification="+request("Classification");
                 }
                 
                 if(strType=="Type")
                 {
                     PassType1="&Type="+value;
                 }
                 else if(request("Type")!="")
                 {
                     PassType1="&Type="+request("Type");
                 }
                 
                 if(strType=="pageindex")
                 {
                     PassType2="&pageindex="+value;
                 }
                 else if(request("pageindex")!="")
                 {
                     PassType2="&pageindex="+request("pageindex");
                 }
                  if(strType=="Price")
                 {
                     PassType4="&Price="+value;
                 }
                 else if(request("Price")!="")
                 {
                     PassType4="&Price="+request("Price");
                 }
                 break;
         }
    }
    else
    {
        switch(strType)
        {
             case "Type":
                PassType1="?Type="+value;
                break;
             case "pageindex":
                 PassType2="?pageindex="+value;
                 break;
              case "Classification":
                 PassType3="?Classification="+value;
                 break;
              case "Price":
                 PassType4="?Price="+value;
                 break;
              case "Sorting":
                 PassType5="?Sorting="+value;
                 break;
                
        }
    }
    
    if(PassType1.indexOf("?")==0)
    {
       window.location.href="/Default.aspx"+PassType1+PassType2+PassType3+PassType4+PassType5;
    }
     else if(PassType2.indexOf("?")==0)
     {
        
         window.location.href="/Default.aspx"+PassType2+PassType1+PassType3+PassType4+PassType5;
     }
     else if(PassType3.indexOf("?")==0)
     {
         window.location.href="/Default.aspx"+PassType3+PassType1+PassType2+PassType4+PassType5;
     }
     else if(PassType4.indexOf("?")==0)
     {
           window.location.href="/Default.aspx"+PassType4+PassType1+PassType2+PassType3+PassType5;
     }
     else if(PassType5.indexOf("?")==0)
     {
          window.location.href="/Default.aspx"+PassType5+PassType1+PassType2+PassType3+PassType4;
     }
     else
     {
     
         window.location.href="/Default.aspx"+PassType1+PassType2+PassType3+PassType4+PassType5;
     }
}


function request(paras) {
    var url = location.href;
    var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
    var paraObj = {}
    for (i = 0; j = paraString[i]; i++) {
        paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
    }
    var returnValue = paraObj[paras.toLowerCase()];
    if (typeof (returnValue) == "undefined") {
        return "";
    } else {
        return returnValue;
    }

    
}

//收藏夹

function AddFavorite(sURL, sTitle) {   
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            alert("加入收藏失败，请使用Ctrl+D进行添加");   
        }   
    }   
} 


//设置首页
function SetHome(obj, vrl) {   
    try {   
        obj.style.behavior = 'url(#default#homepage)';   
        obj.setHomePage(vrl);   
    } catch (e) {   
        if (window.netscape) {   
            try {   
                netscape.security.PrivilegeManager   
                        .enablePrivilege("UniversalXPConnect");   
            } catch (e) {   
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");   
            }   
            var prefs = Components.classes['@mozilla.org/preferences-service;1']   
                    .getService(Components.interfaces.nsIPrefBranch);   
            prefs.setCharPref('browser.startup.homepage', vrl);   
        }   
    }   
}
        
    </script>
    
</head>
<body onload="GetTime()">
    <form id="form1" runat="server">
    <hl:Top ID="Top1" runat="server" />
    <div id="main" class="main">
    <!--  <div id="nav">
          <ul>
             <li style=" font-size">
                <a title="今日团购" href="/Tuan/">今日团购</a>
             </li>
             <li class="nav_sm"></li>
             <li><a href="/Tuan/Tuanlist.aspx?tag=Now">进行中团购</a></li>
             
             <li class="nav_sm" ></li>
             <li>
                <a href="/Tuan/Tuanlist.aspx?tag=History">往期团购</a>
             </li>
             
             <li class="nav_sm" ></li>
             
              <li>
                <a href="/member/Index.aspx?mainurl=Shop_buyTeam.aspx">我的团购</a>
             </li>
             <li class="nav_sm"></li>
             <li><a href="javascript:;"onclick="PassAddress('Type','teamBuy')">团购</a></li>
			 
             <li class="nav_sm"></li>
             <li><a href="javascript:;"onclick="PassAddress('Type','market')">一口价</a></li>
             
             <li class="nav_sm"></li>
             <li><a href="javascript:;"onclick="PassAddress('Type','auctionMall')">秒杀</a></li>
             
              <li class="nav_sm"></li>
          </ul>
          
      </div> -->
      
      <div id="class">
         <div class="top_buy_img">
         </div>
         <div class="class_list">
             <div class="red_title"></div>
             <div class="class_list_1">
                <ul class="fenlei">
                   <li style=" color: rgb(255, 0, 0);">
                       <img src="Images/TeamImage/class_sm_1.gif" />
                      <span style="font-weight: normal;" onclick="PassAddress('Classification','0')">所有</span>
                   </li>
                   
                  <li>
                     <img src="Images/TeamImage/class_sm_29.gif" />
                     <span onclick="PassAddress('Classification','<%=ParentID1 %>')"> <%=ClassName1%></span>
                     
                 </li>
                  <li>
                       <img src="Images/TeamImage/class_sm_32.gif" />
                      <span onclick="PassAddress('Classification',<%=ParentID2 %>)"><%=ClassName2 %></span>
                    
                   </li>
                   
                   <li>
                       <img src="Images/TeamImage/class_sm_33.gif" />
                      <span onclick="PassAddress('Classification',<%=ParentID3 %>)"><%=ClassName3 %></span>
                      
                   </li>
                   <li>
                       <img src="Images/TeamImage/class_sm_34.gif" />
                      <span onclick="PassAddress('Classification',<%=ParentID4 %>)"><%=ClassName4 %></span>
                      
                   </li>
                   <li>
                       <img src="Images/TeamImage/class_sm_35.gif" />
                      <span onclick="PassAddress('Classification',<%=ParentID5 %>)"><%=ClassName5 %></span>
                      
                   </li>
                   
                   <li style="color: rgb(255, 0, 0);">
                       <img src="Images/TeamImage/class_sm_36.gif" />
                       <span style="font-weight: normal;" onclick="PassAddress('Classification','-1')">其他</span>
                   </li>
                   
                </ul>
                <ul id="price_1" class="price_list" style="float: left;">
                    <li id="allprice" class="img_1">
                        <img src="/Images/TeamImage/class_sm_1.gif" />
                        <a href="#" style="text-decoration: none;">
                           <span onclick="PassAddress('Price','0')">所有</span>
                        </a>
                    </li>
                    <li onclick="PassAddress('Price','1')">0-50元</li>
                    <li onclick="PassAddress('Price','2')">50-100元</li>
                    <li onclick="PassAddress('Price','3')">100-200元</li>
                    <li onclick="PassAddress('Price','4')">200-300元</li>
                    <li onclick="PassAddress('Price','5')">300元以上</li>
                </ul>
             </div>
         </div>
         <div class="class_right">
             <div class="search">
                 <asp:TextBox ID="KeyBox" runat="server" CssClass="input_1"></asp:TextBox>
                 <asp:Button ID="SearchButton" CssClass="input_2" runat="server" Text="" 
                     onclick="SearchButton_Click" />
             </div>
             <div id="paixu" class="taxis">
                <ul>
                   <li onclick="PassAddress('Sorting','0')">
                       <a style="text-decoration: none; color: rgb(150, 69, 84);" onclick="PassAddress('Sorting','1')">默认排序</a>
                   </li>
                   <li onclick="PassAddress('Sorting','2')">时间排序</li>
                   <li onclick="PassAddress('Sorting','3')">价格排序</li>
                   <li onclick="PassAddress('Sorting','4')">人气排序</li>
                </ul>
             </div>
         </div>
      </div>
      <div style=" text-align:left">
        <asp:DataList ID="DataList1" runat="server" RepeatColumns="3" 
             RepeatDirection="Horizontal">
            <ItemTemplate>
                <div id="good">
                <ul class="good_list">
                   <li>
                       <div class="group_name"><%#ShowProductType(Eval("ProductID").ToString())%></div>
                        <div class="good_title">
                            <div id="hrefTuanName<%#Container.ItemIndex %>">
                                 <a target="_blank" href="/Tuan/index.aspx?ProductID=<%#Eval("ProductID") %>"><%#Eval("ProductName") %></a></div>
                             <div id="hrefProductName<%#Container.ItemIndex %>" style=" display:none">
                                 <a target="_blank" href="/ShowProduct.aspx?ProductID=<%#Eval("ProductID") %>"><%#Eval("ProductName") %></a>
                             </div>
                             <input type="hidden" id="ProductType<%#Container.ItemIndex %>" value="<%#Eval("ProductType") %>" />
                       </div>
                   
                   <div class="good_img">
                     <div id="hrefTodayTuan<%#Container.ItemIndex %>">
                       <a href="/Tuan/index.aspx?ProductID=<%#Eval("ProductID") %>">
                          <img alt="<%#Eval("ProductName") %>" src="<%#Eval("ProductSmallImageUrl") %>" />
                       </a>
                   </div> 
                   
                   <div id="hrefProduct<%#Container.ItemIndex %>" style=" display:none">
                       <a href="/ShowProduct.aspx?ProductID=<%#Eval("ProductID") %>">
                          <img alt="<%#Eval("ProductName") %>" src="<%#Eval("ProductSmallImageUrl") %>" />
                       </a>
                   </div>
                   
                   
                    <div class="price">
                       <div class="now_price">
                           <%#ShowProductType(Eval("ProductID").ToString())%>：
                           <span>￥<%#ShowNowPrice(Eval("ProductID").ToString())%></span>
                       </div>
                       <div class="zhekou">
                           折扣：
                           <span><%#ShowRebate(Eval("ProductID").ToString())%>折</span>
                       </div>
                       <div class="yuan_price">
                           原价：
                           <span>￥<%#ShowYuanPrice(Eval("ProductID").ToString())%></span>
                       </div>
                   </div>
                      <div class="good_over_time">
                         <input type="hidden" id="EndTime<%#Container.ItemIndex %>" value="<%#Eval("EndDate")%>" />
                         <img src="/Images/TeamImage/time_img.gif" />
                         

                       <div id="ShowTime<%#Container.ItemIndex %>" style="font-size: 12px; color: rgb(0, 0, 0);">

                      </div>
                      </div>
                      
                      <div id="TuanButton<%#Container.ItemIndex %>" class="buy_button">
                          <a target="_blank" href="Buy.aspx?ProductID=<%#Eval("ProductID") %>"></a>
                      </div>
                      
                      <div id="marketButton<%#Container.ItemIndex %>" style=" display:none" class="market_button">
                          <a target="_blank" href="Buy.aspx?ProductID=<%#Eval("ProductID") %>"></a>
                      </div>
                      
                      <div id="auctionMallButton<%#Container.ItemIndex %>" style=" display:none" class="auctionMall_button">
                            <a target="_blank" href="Buy.aspx?ProductID=<%#Eval("ProductID") %>"></a>
                      </div>
                   </li>
                </ul>
                  </div>
            </ItemTemplate>
        </asp:DataList>
        <div style=" text-align:center; width:100%">
               <asp:Label ID="LbPage" runat="server" Text=""></asp:Label>
      </div>
    </div>
   </div>
     <hl:Foot ID="Foot1" runat="server" />
    </form>
</body>
</html>
