<div style="display: none; position: absolute; top: 70px;" id="preview_div"></div>
<?
$datecheck=date("Y-m-d H:i:s");
$feature_sql="select * from auction_details where status='Active' and selling_method!='11' and picture1!='' and (bid_starting_date <= '$datecheck') and (expire_date > '$datecheck') order by expire_date limit 0,10 ";
	$feature_res=mysql_query($feature_sql);
	$tot_count=mysql_num_rows($feature_res);
	$count=0;
	if($tot_count > 0)
	{
	 ?>
	
	<table width="980" cellpadding="0" cellspacing="0" >
	<tr>
<tr><td width="1%" height="24" valign="top"><img src=templates/<?=$tfold?>/img_files/t_header_l_or.gif></td>
<td class="tdhead_main_or" width="30%" height="24" valign="middle">

<table width="250" cellpadding="0" cellspacing="0" >
<tr><td width="1%" height="24" valign="top"><img src=templates/<?=$tfold?>/img_files/heading-left-or.gif></td>
<td class="head_main_or" width="98%" height="24" valign="middle">&nbsp;<B>ENDING AUCTIONS</b></td>
<td width="1%" height="24" valign="top"><img src=templates/<?=$tfold?>/img_files/heading-right-or.gif></td></tr>
	</table>
</td>
<td class="tdhead_main_or" width="68%" height="24" valign="middle">&nbsp;<B><?=$lang_700?></b></td>
<td width="1%" height="24" valign="top"><img src=templates/<?=$tfold?>/img_files/t_header_r_or.gif></td></tr>
	</table>
<table border="0" cellpadding="0" cellspacing="0" style="padding-left:0px;padding-right:0px;" width=980 class="ft_right_or"><tr><td align="center" valign="top">
<BR><?

//	require 'cats.php';
?>
</td><td>
<table border="0" align="center" cellpadding="0" cellspacing="0" width=950 style="padding-left:0px;padding-right:0px;">
    <?
$l=1;
$i=1;
while($feature_row=mysql_fetch_array($feature_res))
{
$i=$feature_row['productid'];
$sale_price=$feature_row['currency'];
	?>
<? if(($l==1)||($l==6))
{
echo "<tr>";
}
?>
	<td valign=middle align="center">
	<table align="center" valign="middle" cellpadding=5 cellspacing=2 style="background:url(templates/<? echo "$tfold" ?>/img_files/prod.gif) no-repeat center;">
	<tr><td valign="top" width="180" height="298" align="center" valign="middle">

	<?
$imgsize = $feature_row['picture1'];
list($widths, $heights, $types, $attrs) = getimagesize("uploads/$imgsize");
if($feature_row['picture2']==""){
$feature_row['picture2']=$feature_row['picture1'];
}
	               $img=$feature_row['picture2'];
				   list($width, $height, $type, $attr) = getimagesize("uploads/$img");
				   $h=$height;
				   $w=$width;
				   if($h>100)	
				   {
				   $nh=100;
				   $nw=($w/$h)*$nh;
				   $h=$nh;
				   $w=$nw;
				   }
				  if($w>120)
				  {
				  $nw=120;
				  $nh=($h/$w)*$nw;
				  $h=$nh;
				  $w=$nw;
				  }
$w=round($w);	
	?>
<script type="text/javascript">
<!-- hide from non JavaScript Browsers
Image<?=$i?>= new Image;
Image<?=$i?>.src = "uploads/<? echo $feature_row['picture1']; ?>"
// End Hiding -->
</script>
	<table height="49" border="0" cellpadding=0 cellspacing=0>
		<tr>
<td align="center" valign="middle" height="50" style="padding-right:5px;padding-left:5px;padding-top:5px;padding-bottom:5px;">

<a href="itechd.php?productid=<? echo $feature_row['productid']; ?>">
	<? echo $feature_row['producttitle'];?></a>
</td></tr><tr><td align="center">
		
		<table border="0" cellpadding="0" cellspacing="0" width=120 height=100 bordercolor="#000000">
		<tr valign="middle">
		<td align="center" bgcolor="#ffffff">

	<a onmouseover="showtrail('uploads/<? echo $feature_row['picture1']; ?>','',<?=$widths?>,<?=$heights?>)" onmouseout="hidetrail()" href="itechd.php?productid=<? echo $feature_row['productid']; ?>">
	 <img src="uploads/<? echo $feature_row['picture2']; ?>" width=<?= $w; ?> height=<?=$h?> border=0>
	</a>

<?
$expiry_date = $feature_row['expire_date'];
$min_bid_amount=$feature_row['min_bid_amount'];
$bidincrement=$feature_row['bidincrement'];

$bid_sql2="select * from site_bids where productid=".$feature_row['productid']." order by bidding_amount desc";
$bid_res2=mysql_query($bid_sql2);
$bid_row2=mysql_fetch_array($bid_res2);
$user_bid_amt=$bid_row2[bidding_amount];

$user_bid_amt = $user_bid_amt + $bidincrement;


$user_bid_id=$bid_row2['user_id'];
if($user_bid_amt==$bidincrement)
{
$user_bid_amt = $min_bid_amount;
}

$highest_bidder_sql="select user_name un from member_details where user_id=".$user_bid_id;
$highest_bidder_res=mysql_query($highest_bidder_sql);
$highest_bidder_res=mysql_fetch_array($highest_bidder_res);
$user_bid_name=$highest_bidder_res[un];

if($user_bid_name=="")
{
$user_bid_name = "None";
}
?>
<?
$bidnow=$_SESSION[userid];
?>
<?
$expire_date = $feature_row['expire_date']; 
$date2=strtotime($expire_date);
$date2 = date("d-m-Y H:i:s",$date2); 
$dateTo = $date2;
$date1 = mktime(date("H"),date("i"),date("s"),date("n"),date("j"),date("Y"));
$dateToElements = split(' ', $dateTo);
$dateToDateElements = split('-', $dateToElements[0]);
$dateToTimeElements = split(':', $dateToElements[1]); 
$date2 = mktime($dateToTimeElements[0], $dateToTimeElements[1], $dateToTimeElements[2], $dateToDateElements[1], $dateToDateElements[0], $dateToDateElements[2]); 
$difference = $date2 - $date1;
?>
<div id="futu<?=$feature_row['productid'];?>" style="display:none;"><?=$difference?></div>
<div id="totb<?=$feature_row['productid'];?>" style="display:none;"><?=$feature_row['totbid'];?></div>	     
<div id="pause<?=$i;?>" style="display:none;">no</div>

	</td>
		</tr>
		</table>
		</td>
		</tr>
		<tr>
<td valign=top align="center">
	<br>
<div id="Bid<?=$i?>" style="font-size:22px; font-weight:bold;">
<b>--|--|--|--</b>
</div>
<div style="border:0px; padding:0px; font-weight:bold; color:teal; font-size:12px;">
<span style="border:0px; padding:0px; font-weight:bold; color:teal; font-size:12px;" id="Amt<?=$i?>">
<? echo Trim($sale_price); ?><? echo Trim($user_bid_amt); ?></span>
</div><BR>
<div style="font-weight:bold;" id="Usr<?=$i?>"><?=$user_bid_name?>
</div><BR>
<?if(empty($_SESSION[userid])) { ?>
<a name= "link1" href="signin.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('IMG<?=$i?>','','templates/<?=$tfold?>/img_files/login.png',1);" style="text-decoration:none;">
<img NAME = "IMG<?=$i?>" src=templates/<?=$tfold?>/img_files/bidnow.png border="0"></a>
<? } ?>
<?if(!empty($_SESSION[userid])) { ?>
<a name= "link1" href="javascript:bidnow(<?=$feature_row['productid']?>,<?=$bidnow?>)" style="text-decoration:none;">
<img NAME = "IMG<?=$i?>" src=templates/<?=$tfold?>/img_files/bidnow.png border="0"></a>
<? } ?>
</td>
		</tr>
		</table>	</td></tr>
	</table></td>
<?
$l++;
 if(($l==1)||($l==6))
{
echo "<tr>";
$l=1;
}
$allpro2 = $feature_row['productid'];
$allpro1 = "$allpro2";
if($allpro!=""){
$allpro = "$allpro1|$allpro";
}
if($allpro==""){
$allpro = "$allpro1";
}
?>
	<?
	}
	?>
</table></td></tr></table>
	<table width="980" cellpadding="0" cellspacing="0" >
	<tr>
<tr><td width="1%" height="5" valign="top"><img src=templates/<?=$tfold?>/img_files/t_bot_l_or.gif></td>
<td class="tdbot_main_or" width="98%" height="5" valign="middle"></td>
<td width="1%" height="5" valign="top"><img src=templates/<?=$tfold?>/img_files/t_bot_r_or.gif></td></tr>
	</table>
	<?
	}
	?>