<?	ob_start();
	session_start();
	
		if($_SESSION['lang']=='')
		{
		$_SESSION['lang'] = "en";
		}	
	include 'languages/lang_indexframe_'.$_SESSION['lang'].'.php';
	include 'languages/lang_common_'.$_SESSION['lang'].'.php';
	
 	include("include/db.inc.php"); 
 	include("include/bit_functions.inc.php");
	include("include/functions.php"); 
   $db1=new db;
   $db1->open();
    mysql_query("SET NAMES 'utf8'");
	$currency_symbol_new=symbol_currency();
  
   $uid=$_SESSION['uid'];

 
 
   $myres=remainbid1();	
   $order=$_GET['order'];
		$timeasd=$_GET['timeasd'];
		$priceasd=$_GET['priceasd'];
		
	if($order=='price')
	{
	$str=" order by bid_price";
	  if($priceasd=='a')
	  $str.=" asc";
	  else
	  $str.=" desc";
	}
	else
	{
	$str=" order by end_time";
		if($timeasd=='d')
		$str.=" desc";
		else
		$str.=" asc";
	}
	
	
  // Query start for Hot featured product //	
	 $sql="select * from t123go_product where featured='1' and status='1' and start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and end_time >
	 DATE_SUB(now(), INTERVAL 2 MINUTE) order by end_time limit 1";
 	 $rs=mysql_query($sql);
  	 $data=mysql_fetch_array($rs);
  // Query ended for Hot featured product //	
	
	
   $jsres=mysql_query("SELECT pid,bid_price FROM t123go_product where  start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and end_time >
	 DATE_SUB(now(), INTERVAL 2 MINUTE) and pid!='$data[pid]' and status='1' $str  limit 8,10");	
	$pids="";
	while($jsrec=mysql_fetch_array($jsres))
	{
	$pids.=$jsrec['pid'].",";
	$_SESSION['framenew'][$jsrec['pid']]=$jsrec['bid_price'];	
	}
	
	$sql_qry="SELECT pid,pname,price,bid_price,thumbnail,bider_id,description,type1,cid,brand FROM t123go_product where start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and end_time > DATE_SUB(now(), INTERVAL 2 MINUTE) and pid!='$data[pid]' and status='1' $str limit 8,10";
	$homeres=mysql_query($sql_qry);
	
	
	
?>
<!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=utf-8" />
<title>
<?=_INDEX_FRM_?>
</title>
<base href="<?=_BASEURL_?>/" />
<link href="css/english/index.css" rel="stylesheet" type="text/css" />
<link href="css/english/specialindex.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(<?=_BASEURLCSSNEW_?>/ie6.css?0:102290); /* ]]> */</style><![endif]-->
<!--[if gte IE 7]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(<?=_BASEURLCSSNEW_?>/ie7.css?0:99961); /* ]]> */</style><![endif]-->

<script src="<?=_BASEURL_?>/js/home_counter.js" type="text/javascript"></script>
<? include("indexframe.js.php");?>
</head>
<body onload="home_detail();" bgcolor="#FFFFFF">
<div id="indexframe">
  <div id="show_bar_greenfair">
    <div class="tl">
      <div class="tc">
        <div>More Live Auctions</div>
      </div>
    </div>
    <div class="tr"></div>
    <div class="clb"></div>
    <div id="product_detail" style="background-color:#FFFFFF">
      <?
  $parr=explode(",",$pids);
  echo "<form name='frm'>";
      for($y=0; $y < count($parr)-1; $y++)
   {
   
      $pid=$parr[$y];
	  $diff=mysql_fetch_array(mysql_query("SELECT TIME_TO_SEC( TIMEDIFF( end_time, now( ))),
	  bid_price,bider_id FROM t123go_product where pid='$pid'")) ;
	  $curr_bid=get_uname($diff[bider_id]);
	  if($curr_bid=='')
	  $curr_bid="No Bidder Yet";
	  else
	  $curr_bid="<span class='normaltextredbold13_profile'>$curr_bid</span>";
	  ?>
      <input type="hidden" name="price_<?=$pid?>" value="<?=$diff[bid_price]?>" />
      <input type="hidden" name="bider_<?=$pid?>" value="<?=$curr_bid?>" />
      <input type="hidden" name="diff_<?=$pid?>" value="<?=$diff[0]?>" />
      <input type="hidden" name="new_<?=$pid?>" value="0" />
      <?
   }	
	echo "</form>";  
 ?>
    </div>
    <?
	
	  if($priceasd=='a')
		  $priceasd='d';
		  else
		  $priceasd='a';
		  
		  if($timeasd=='d')
		  $timeasd='a';
		  else
		  $timeasd='d';
	
	

	   $i=1;							
         while($myrow=mysql_fetch_array($homeres)){  ?>
    <div <? if($i%2==1) {echo 'class="showup"';}else{echo 'class="showupnot"';}?>>
      <table width="730px" cellpadding="0" cellspacing="0">
        <tr height="100px">
          <td align="center" valign="middle" width="110px"><div class="imagex"> 
 
          <a href="<?=get_cat_name($myrow['cid']);?>/<?=str_replace(" ","-",trim($myrow['pname']));?>/auction/<?=$myrow['pid']?>"  target="_parent">
              <?=image_90($myrow['pid']); ?>
              </a></div></td>
          <td align="center" valign="middle"><div class="text"> <a href="<?=get_cat_name($myrow['cid']);?>/<?=str_replace(" ","-",trim($myrow['pname']));?>/auction/<?=$myrow['pid']?>"  target="_parent" class="mainptitleframe">
              <?=substr($myrow['pname'],0,37);?>
              </a>
              <div>
                <?=substr($myrow['brand'],0,250);?>
                ...</div>
            </div></td>
          <td align="center" valign="middle" width="110px">          <? if($myrow['type1']=='1'){?>
                  <div class="fixed_price1if"></div>
                  <? }else if($myrow['type1']=='2'){?>
                  <div class="penny_prd1if"></div>
                  <? }else if($myrow['type1']=='3'){?>
                  <div class="s100_off1if"></div>
                  <? }?><div class="tac ttc">
              <div id="winner_index_page_<?=$myrow['pid']?>"></div>
            </div></td>
          <td align="center" valign="middle" class="normaltextblackbold13 fsb" width="130px">
		 <div style="display:none" id="maximumbid_<?=$myrow['pid']?>" class="highestbid"></div>
            <div class="tac" id="button_finished_index_page_<?=$myrow['pid']?>" style="display:none"  >
              <?  if($uid==''){?>
              <a href="<?=_BASEURL_?>/login/index.html">
              <input type="button" name="bid"  value="   " class="button" /></a>
              <? } 
			  else {?>
              <input type="button" name="bid" onclick="product_bid('<?=$myrow[pid]?>'); return false;" value="   " class="button" />
              <? }?>
               </div>
           
            <div id="productprice_<?=$myrow[pid]?>" class="normaltextorangebold19c tac"><?=$currency_symbol_new?> 
            <span id="price_index_page_<?=$myrow['pid']?>"> <? echo $myrow['bid_price'];?></span>
            </div>
            <div class="normaltextblackbold19c" id="productcounter_<?=$myrow[pid]?>"><span id="counter_index_page_<?=$myrow['pid']?>"></span></div>
            <div id="winner_index_page_<?=$myrow['pid']?>"></div></td>
        </tr>
      </table>
    </div>
    <?
				$i++;
			}	// end of while loop
		
			?>
  </div>
</div>
</body>
</html>
