<? 
ob_start();session_start();
if($_SESSION['lang']=='')
{
	$_SESSION['lang'] = "en";
}	
include 'languages/lang_allauctions_'.$_SESSION['lang'].'.php';
include 'languages/lang_common_'.$_SESSION['lang'].'.php';
include("include/meta_functions.php");		
		include("include/db.inc.php");
		include("include/bit_functions.inc.php");
		include("include/functions.php"); 
	    include("include/pager.php");	include("include/banner_inc.php");
 		$db1=new db;
   $db1->open();
  mysql_query("SET NAMES 'utf8'");  $currency_symbol_new=symbol_currency();
		 $uid=$_SESSION['uid'];
		
		 $myres=remainbid1();	
		$catid=$_GET['cat'];
		$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";
	}
	
	if($_GET['cat']<>'')
	{
		if($catid >0)
		$auction=" where cid='$catid'";
		else
		$auction=" where 1=1";
	
   	$qqry="SELECT * FROM t123go_product $auction and start_time <= now() and end_time >
	 DATE_SUB(now(), INTERVAL 30 MINUTE) and start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and status='1' $str ";
	 $jsres=mysql_query(dopaging($qqry,10));
	$pids="";
	if(mysql_num_rows($jsres)>0)
	{
		while($jsrec=mysql_fetch_array($jsres))
		{
		$pids.=$jsrec['pid'].",";
		$_SESSION['new'][$jsrec['pid']]=$jsrec['bid_price'];	
		}
	}

	 $sql_qry="SELECT pid,pname,price,bid_price,thumbnail,bider_id,description,type1,brand,cid FROM t123go_product $auction and start_time <= now() and end_time > DATE_SUB(now(), INTERVAL 30 MINUTE) and start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and status='1' $str ";
	
	
	}

?>
<!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>
<base href="<?=_BASEURL_?>/" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<?=_TITLE_?>
High Discount on
<?=meta_title($pids)?>
</title>
<meta name="description" content="<?=meta_description($pids)?>" />
<meta name="keywords" content="<?=meta_keyword($pids)?>" />
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
<meta name="author" content="Info-Tech Ltd.">
<meta name="publisher" content="Info-Tech Ltd.">
<meta name="copyright" content="Money Auctions | Powered by Money Auctions">
<meta name="page-topic" content="Service">
<meta name="audience" content="all">
<meta http-equiv="content-language" content="us">
<meta name="Language" content="english">
<meta name="robots" content="index,follow">
<meta name="revisit-after" content="3">
<link href="<?=_BASEURLCSSNEW_?>/index.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/index_sec.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/all.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 6]><style type="text/css" media="screen">/* <![CDATA[ */ @import url(<?=_BASEURLCSSNEW_?>/ie6c.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("timer.js.php");?>
</head>
<body onload="home_detail();">
<div id="container"> 
  <? include("header.php");?>
  
  <div class="lm10px normaltextgreenbold13 tm5px">
    <h3> <a href='allcategories/index.html' class="anywherecate">
      Categories
      </a>
      <?
            $tree=get_cat_tree($catid); 
			$trarr=explode(",",$tree);
			$newtree=array_reverse($trarr);
			
			for($a=0; $a<count($newtree); $a++)
			{			
			?>
      &nbsp;/&nbsp; <a href="subcat/<?=get_cat_name($newtree[$a]); ?>/<?=$newtree[$a];?>/"  class="anywherecate">
      <?=get_category($newtree[$a])?>
      </a>
      <? } ?>
    </h3>
  </div>
  <div id="product_detail">
    <?
  $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 $auction and pid='$pid'")) ;
	  
	  ?>
    <input type="hidden" name="price_<?=$pid?>" value="<?=$diff[bid_price]?>" />
    <input type="hidden" name="bider_<?=$pid?>" value="<?=get_uname($diff[bider_id])?>" />
    <input type="hidden" name="diff_<?=$pid?>" value="<?=$diff[0]?>" />
    <input type="hidden" name="new_<?=$pid?>" value="0" />
    <?
   }	
	echo "</form>";  
 ?>
  </div>
  
  <div id="wrapper_index">
<div class="lefty">
<div id="auction_pro">
<div class="yellow_top"><div class="corner_l"><div > CATEGORIES</div></div><div class="corner_r"></div></div>
<div class="main">
<div class="boringauc"> 
 <?			
          $rs=mysql_query(dopaging($sql_qry,10));
		  $num=mysql_num_rows($rs);
		  if($num)
		  {
		   $i=1;
		  while($myrowl=mysql_fetch_array($rs))
		  		{

?>
<div class="clbeat">
          <div class="imagex">
            
                <div class="wid"><a href="<?=get_cat_name($myrowl['cid']);?>/<?=str_replace(" ","-",$myrowl['pname']);?>/auction/<?=$myrowl['pid']?>/"  target="_parent">
                  <?=image_90($myrowl['pid']); ?>
                  </a></div>
                <div class="productx">
                  <div class="wider"><a href="<?=get_cat_name($myrowl['cid']);?>/<?=str_replace(" ","-",$myrowl['pname']);?>/auction/<?=$myrowl['pid']?>/" class="mainptitleframe" title="<?=$myrowl['pname'];?>">
                    <?=$myrowl['pname'];?>
                    </a>
                    <p><?=$myrowl['brand'];?></p>
                    </div>
					<div class="pricex">
                    <div class="demo">
                      <div class="tac ttc normaltextredbold13_profile sfl lm10px">
					
              <div id="winner_index_page_<?=$myrowl['pid']?>"></div>
            </div>
                    </div>
                     
                 
					
                
                     <div class="detailx sfl lm10px">
                    <div style="display:none" id="maximumbid_<?=$myrowl['pid']?>" class="highestbid"></div>
            <div class="tm-10px tac" id="button_finished_index_page_<?=$myrowl['pid']?>"  style="display:none" >
              <?  if($uid==''){?>
              <a href="<?=_BASEURL_?>/login/index.html">
              <input type="button" name="bid"  value=" " class="button"/>
              <? } else if($myres<=0){?>
              <input type="button" name="bid" onclick="alert('<?=_UR_NTABL_BDH_?>')" value=" " class="button" />
              <?  } else {?>
              <input type="button" name="bid"   onclick="product_bid('<?=$myrowl[pid]?>'); return false;" value=" " class="button" />
              <? }?>
              </a> </div>
            <div id="productprice_<?=$myrowl[pid]?>" class="normaltextorangebold19c tac"><?=$currency_symbol_new?> <span id="price_index_page_<?=$myrowl['pid']?>">
              <? 
		  echo $myrowl['bid_price'];
		?>
              </span> </div>
            <div class="normaltextblackbold19c" id="productcounter_<?=$myrowl[pid]?>"> <span class="normaltextblackbold19c" id="counter_index_page_<?=$myrowl['pid']?>"></span> </div>
                   </div> </div>
                    </div>
                  </div>
              
             
     </div>
              <?
			$i++;	
			}
				
				if(rightpaging())
				{		
				?>
    <div class="page"><br>
          <? echo rightpaging(); ?></div>
    <?
				}
			}
			 else
			 {			
			echo " <div class='error_message_show'>"._HAVING_AUCTIONS_FOR_THIS_SOON_."</div>";
			}
			?>

</div>
</div></div>
</div>
<div class="righty">
        <div id="green_form">
		   <div class="green_top_st"> <div class="green_top_ct tac"><img src="<?=_BASEURLMEDIA_?>/categories_categories.gif" alt="categories" /></div>
		   <div class="green_top_en"></div></div>
 <div class="boringcon"><div class="allp5px">
<table border="0" width="100%" align="center" cellpadding="2" cellspacing="2" class="clb">

            
              <tr>
<?
				    $sqlcat="select * from add_category where top=0 order by name";
   					$rscat=mysql_query($sqlcat);
					$x=0;
					while($cate=mysql_fetch_array($rscat))
					{
						
					$tree=get_child_tree($cate[id]);
					$child=substr($tree,1);
					$rec=mysql_fetch_array(mysql_query("select pid,thumbnail from t123go_product where cid in ($child) and status='1' order by rand() limit 1"));
					$numpro=mysql_num_rows(mysql_query("select pid from t123go_product where cid in ($child) and status='1'"));
					
					  if($x%1==0 && $x!=0)
					  echo"</tr><tr>";
					 
					 
					  $res=mysql_query("select id from add_category where top='".$cate[id]."'");
					  if(mysql_num_rows($res)>0)
					   {
					   ?>
                       
	       <td align="left" valign="top" class='tal  amazing_showr' ><div ><a href="subcat/<?=get_cat_name($cate['id']); ?>/<?=$cate[id];?>/" title="<?=get_cat_name($cate['id']); ?>/<?=$cate[id];?>/" style="text-transform:capitalize"><?=$cate['name'] ?></a> <span class="normaltextgreybold11">( <?=$numpro?> )</span></div></td>               
                	   <? 
					   }
					  else
					   { ?>
			   
		      <td align="left" valign="top" class='tal amazing_showr' ><div ><a href="subcat/<?=get_cat_name($cate['id']); ?>/allauction/<?=$cate[id];?>/" title="<?=get_cat_name($cate['id']); ?>/allauction/<?=$cate[id];?>/" style="text-transform:capitalize"><?=$cate['name'] ?></a> <span class="normaltextgreybold11">( <?=$numpro?> )</span></div></td>
	      					 
	  <? }
 					
					  $x++;
				 	  }

				 	?>              
      </tr>
 </table>
 </div></div>
<div class="tft1"><div class="tft2"></div><div class="tft3"></div></div>
 
 </div>
 
<div id="accountleft1">
  <div class="buygreen1" >
   <div class="buygreen2"><img src="<?=_BASEURLMEDIA_?>/adv_sponsors.gif" alt="advertisement sponsors" />
	</div><div class="buygreen3">
  </div>
  </div>
  <div class="allm100px">         <? 
  $page='innerpage';
  $query_num=mysql_query("select bid from zb_banners where `status`='1' and pagename='$page' order by rand() limit 0,2");
 while($brow=mysql_fetch_array($query_num))
  {
  ?>
<?=banner_home("innerpage","bottom",215,215,$brow['bid']);?>
<? }?>

  </div>

  <div class="tft1">
        <div class="tft2"></div>
        <div class="tft3"></div>
      </div>

  
  
  </div>

</div>
 
<? include("footer.php");?>
</div>
</div>
</body>
</html>
