<?
	include("config/connect.php");
	include("session.php");
	include("functions.php");
	$uid = $_SESSION["userid"];
	$ref_url = $_REQUEST["ref_url"];
	if($ref_url!=""){
		header("location: ".$ref_url);
		exit;
  }
	if(!$_GET['pgno'])
	{
		$PageNo = 1;
	}
	else
	{
		$PageNo = $_GET['pgno'];
	}
    $now=time();
	$qryselauc = "select *,p.".$lng_prefix."name as name,".$lng_prefix."short_desc as short_desc from bid_account ba left join auction a on ba.auction_id=a.auctionID left join products p on ba.product_id=p.productID left join auc_due_table adt on a.auctionID=adt.auction_id where a.is_close=0 and adt.auc_due_time>$now and ba.user_id=$uid group by ba.auction_id order by auc_due_time";
	$resselauc = mysql_query($qryselauc);
	$totalauc = mysql_num_rows($resselauc);
	$totalpage=ceil($totalauc/$PRODUCTSPERPAGE_MYACCOUNT);

	if($totalpage>=1)
	{
	$startrow=$PRODUCTSPERPAGE_MYACCOUNT*($PageNo-1);
	$qryselauc.=" LIMIT $startrow,$PRODUCTSPERPAGE_MYACCOUNT";
	//echo $sql;
	$resselauc=mysql_query($qryselauc);
	$totalauc=mysql_num_rows($resselauc);
	}


	$qrysel = "select *,".$lng_prefix."bidpack_name as bidpack_name,".$lng_prefix."bidpack_banner as bidpack_banner from bidpack order by id";
	$rssel = mysql_query($qrysel);
	$totalbpack = mysql_num_rows($rssel);
	if($totalbpack>0)
	{
		$selected = ceil($totalbpack/2);
	}
?>
<!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=<?=$lng_characset;?>" />
<title><?=$AllPageTitle;?></title>
<link href="css/style_youbid.css" rel="stylesheet" type="text/css" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="function.js"></script>
<script language="javascript" src="basic.js"></script>
<script language="javascript">
	function setname(name)
	{
		var temp = document.getElementById('bidpackname'+name).value;
		document.getElementById('bidpackname').innerHTML = temp;
	}
</script>
</head>


<body onload="OnloadPage();setname('<?=$selected;?>');">
<div id="main_div">
<?
	include("d1.php");
?>
		<div id="middle_div">
			<? include("leftside.php"); ?>
			<div class="inner-container">
				<div class="titlebar">
					<div class="leftbar"></div>
					<div class="middlebar"><div style="float: left;" class="page_title_font"><?=$lng_myauctionsavenue;?> - 您可以做以下事情</div></div>
					<div class="rightbar"></div>
				</div>
				<div class="bodypart">	
					<div style="height: 15px;">&nbsp;</div>
				</div>
				<div style="margin-left: 40px; margin-top: 20px; text-align: left;"><h4 class="grayboldfont">1、<a href="mydetails.html">补充您的个人资料</a>&nbsp;&nbsp;2、<a href="addresses.html">完善您的送货地址</a>&nbsp;&nbsp;3、<a href="affiliate.html">邀请好友赚取积分</a></h4></div>
				<div class="bodypart">	
					<div style="height: 15px;">&nbsp;</div>
				</div>
				
				
				<div class="titlebar">
					<div class="leftbar"></div>
					<div class="middlebar"><div style="float: left;" class="page_title_font"><?=$lng_myauctionsavenue;?> - <?=$lng_aucbiddingon;?></div></div>
					<div class="rightbar"></div>
				</div>
				<div class="bodypart">	
					<div style="height: 15px;">&nbsp;</div>
					<?
					if($totalauc>0)
					{
					?>
					<?
						$counter = 1;
						while($obj = mysql_fetch_array($resselauc))
						{
							if($counter==1)
							{
								$arr = $obj["auctionID"];
								$prr = $obj["auc_due_price"];
							}
							else
							{
								$arr .= ",".$obj["auctionID"];
								$prr .= ",".$obj["auc_due_price"];
							}
					 ?>	
					 <? if($counter==1){ ?>
						<div class="strip">
							<div class="imagetext"><?=$lng_image;?></div>
							<div class="descriptiontext"><?=$lng_description;?></div>
							<div class="pricetext"><?=$lng_pricebidder;?></div>
							<div class="biddertext" style="width: 105px; text-align: right;"><?=$lng_countdown;?></div>
							<div class="countdowntext" style="width: 120px; text-align: center; padding-left: 8px;"><?=$lng_placebid;?></div>
						</div>
						<div style="height: 15px;">&nbsp;</div>
					<? } ?>
					  <div class="auction-item" style="display: none" title="<?=$obj["auctionID"];?>" id="auction_<?=$obj["auctionID"];?>"></div>
						<div class="even-row">
							<div class="evenproductimage"><a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj["name"])));?>_<?=$obj["auctionID"];?>.html"><img src="uploads/products/thumbs_big/thumbbig_<?=$obj["picture1"];?>" border="0"></a></div>
							<div class="evenproductdesc"><div class="auction_decription"><a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj["name"])));?>_<?=$obj["auctionID"];?>.html" class="black_link"><?=stripslashes($obj["name"]);?></a><br /><br /><?=stripslashes(choose_short_desc($obj["short_desc"],160));?><a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj["name"])));?>_<?=$obj["auctionID"];?>.html" class="black_link"><?=$lng_linkmore;?></a></div></div>
							<div class="evenproductprice">
								<span class="body_inner_box_price">
									<span style="font-size:15px; font-weight: bold;" id="currencysymbol_<?=$obj["auctionID"]?>"></span><span style="font-size:15px; font-weight: bold;" id="price_index_page_<?=$obj["auctionID"];?>">---</span><br />
									<div style="padding-top: 5px;" class="bidderfont">
										<span id="product_bidder_<?=$obj["auctionID"];?>"></span>
									</div>
								</span>
							</div>
							<div class="evenproductbidder">
								<span id="counter_index_page_<?=$obj["auctionID"];?>">
									<?
										echo "<script language=javascript>
											  document.getElementById('counter_index_page_".$obj["auctionID"]."').innerHTML = calc_counter_from_time('".$obj["auc_due_time"]."');
											 </script>";
									?>
								</span>					
							</div>
							<div class="evenproductcountdown">
						    <?
						       if(getWonCount()<8)
						       {
						    ?> 
								<img src="<?=$lng_imagepath;?>BID_btn_hover2.png" border="0" class="bid-button-link" name="getbid.php?prid=<?=$obj["productID"];?>&aid=<?=$obj["auctionID"];?>&uid=<?=$uid;?>" alt="BID" onmouseover="this.src='<?=$lng_imagepath;?>BID_btn2.png'" onmouseout="this.src='<?=$lng_imagepath;?>BID_btn_hover2.png'" id="image_main_<?=$obj["auctionID"];?>"  style="cursor: pointer"/>
						  	<? }else{ ?>
								<img src="<?=$lng_imagepath;?>BID_btn_hover2.png" border="0" name="" alt="BID" onclick="alert('<?=$lng_notice_maxbidnum;?>');" onmouseover="this.src='<?=$lng_imagepath;?>BID_btn2.png'" onmouseout="this.src='<?=$lng_imagepath;?>BID_btn_hover2.png'" id="image_main_<?=$obj["auctionID"];?>"  style="cursor: pointer"/>
						  	<?	 } ?>
							</div>							
						</div>
					
					<?
							$counter++;	
						}
					?>
					<div style="height: 10px;"></div>
					<div class="strip">
						<div style="padding-top: 2px;">
					<?
					if($PageNo>1)
					{
					  $PrevPageNo = $PageNo-1;
					?>
						  <A class="alink" href="myaccount_<?=$PrevPageNo; ?>.html">&lt; <?=$lng_previouspage;?></A>
					<?
						if($totalpage>2 && $totalpage!=$PageNo)
						{
					 ?>
						<span class="paging">&nbsp;|</span>
					 <?
						}
					  }
				     ?>&nbsp;
				     <?php
			 		  if($PageNo<$totalpage)
					  {
						 $NextPageNo = 	$PageNo + 1;
					  ?>
						  <A class="alink" id="next" href="myaccount_<?=$NextPageNo;?>.html"><?=$lng_nextpage;?> &gt;</A>
					  <?
					   }
					  ?>
					     </div>
					</div>	
					<?
					}
					else
					{
					?>		
					<div>&nbsp;</div>
					<div class="noauction_message" align="center"><?=$lng_notbiddingany;?></div>
					<div>&nbsp;</div>
					<?
					}
					?>
				</div>
				<div class="bottomline">
					<div class="leftsidecorner"></div>
					<div class="middlecorner"></div>
					<div class="rightsidecorner"></div>
				</div>
			</div>
			<div class="inner-container" id="inner-buybids-lmargin">
				<div class="titlebar">
					<div class="leftbar"></div>
					<div class="middlebar"><div class="page_title_font"><?=$lng_myauctionsavenue;?> - <?=$lng_tabbuybids;?></div></div>
					<div class="rightbar"></div>
				</div>
				<div class="bodypart">	
						<div class="strip"><div style="text-align: left; padding-left: 20px; padding-top: 3px; color: #000000;"><?=$lng_choosebidpack;?></div></div>
						<div class="sub-strip"><div style="padding-left: 20px;"><?=$lng_currentselect;?><span class="red-text-12-b" id="bidpackname"></span></div></div>
						<div style="height: 15px;">&nbsp;</div>
						<?
							$i = 1;
							$a = 1;
							while($obj = mysql_fetch_array($rssel))
							{
								$bname = $obj["bidpack_name"];
						?>
						<div class="even-row-buybid">
							<div class="redio"><input <?=$obj["id"]==$selected?"checked":"";?> name="bidpack" type="radio" value="<?=$obj["id"]?>" onclick="javascript: setname('<?=$i?>');" /></div>
							<div class="bidpackimage"><a href='buybids.html?pkg=<?=$obj["id"];?>'><img src="uploads/bidpack/<?=$obj["bidpack_banner"];?>" border="0" /></a></div>
							<div class="bidpackdiscription">
								<h4><?=$obj["bidpack_name"];?></h4>
								<?=$obj["bid_size"];?> <?=$lng_bidsfor;?> <?=$Currency;?><?=$obj["bid_price"];?>
							</div>
							<div class="bidpackbutton"><img src="<?=$lng_imagepath;?>buy bids_hover.png" onclick="javascript: window.location.href='buybids.html?pkg=<?=$obj["id"]?>'" style="cursor: pointer" onmouseover="this.src='<?=$lng_imagepath;?>buy bids-1.png'" onmouseout="this.src='<?=$lng_imagepath;?>buy bids_hover.png';" /></div>
							<div class="cleaner"></div>
						<input type="hidden" value="<?=$obj["bidpack_name"];?>" name="bidpackname<?=$i;?>" id="bidpackname<?=$i;?>" />					
						</div>
						<?
								$i++;
								$a++;
							}
						?>
				</div>
				<div class="bottomline">
					<div class="leftsidecorner"></div>
					<div class="middlecorner"></div>
					<div class="rightsidecorner"></div>
				</div>
			</div>			
		</div>
<?
	include("footer2.php");
?>		
</div>
<script language="javascript" src="jquery.js"></script>
<script language="javascript" src="effect.js"></script>
<script language="javascript" src="default.js"></script>
<script language="javascript" src="jqModal.js"></script>
</body>
</html>
