<? 
	ob_start();
	session_start();
	if($_SESSION['lang']=='')
{
	$_SESSION['lang'] = "en";
}	
	
	include 'languages/lang_common_'.$_SESSION['lang'].'.php';
	
	include("include/db.inc.php"); 
	include("include/bit_functions.inc.php");
	include("include/functions.php"); 
	 include("include/pager.php"); 
	 include("include/meta_functions.php");
    $db1=new db;
    $db1->open();
	mysql_query("SET NAMES 'utf8'");
		 $currency_symbol_new=symbol_currency();
	$uid=$_SESSION['uid'];
	$myres=remainbid1();
	
	if($_REQUEST['keyword']<>''){
	
	$str="";
	 $jsres=mysql_query(dopaging("SELECT * FROM t123go_product where (pname like '%".$_REQUEST['keyword']."%' ) and start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and	 end_time >DATE_SUB(now(), INTERVAL 2 MINUTE) and status='1' $str ORDER BY end_time ",10));	
	$pids="";
	while($jsrec=mysql_fetch_array($jsres))
	{
	$pids.=$jsrec['pid'].",";
	$_SESSION['new'][$jsrec['pid']]=$jsrec['bid_price'];	
	}
  
	 $qry="SELECT pid,pname,bid_price,starting_bidprice,description,thumbnail,bider_id,price,cid,brand,type1 FROM t123go_product 
	where  (pname like '%".$_REQUEST['keyword']."%' ) and start_time <= DATE_ADD(now(), INTERVAL 72 HOUR) and end_time >
	 DATE_SUB(now(), INTERVAL 2 MINUTE) and status='1' $str ORDER BY end_time ";
	
	$homeres=mysql_query(dopaging($qry,10));
	
	 }
	
	
?>
<!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 content="<?=_TITLE1_?> offers bargain auctions of new brand products. Save up to 70% for every product almost. Bid and Win high quality products.<?=_TITLE1_?> offers amazing bargains." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Info-Tech Ltd. | We simplify web 2.0"/>
<title><?=_TITLE_?> SEARCH</title>
<link href="<?=_BASEURLCSSNEW_?>/myaccount.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/index.css" rel="stylesheet" type="text/css" />
<link href="<?=_BASEURLCSSNEW_?>/index_sec.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("timer.js.php");?>
</head>
<body onload="home_detail();">
<div id="container">

<? include("header.php");?>

      <div id="searchframe"><div id="indexframe">
        <? if(mysql_num_rows($homeres)==0){
	
	echo '<div class="no_message_show">
		 <h3>Please narrow your search more</h3> </div>';
	
	}else{?>
        <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 where 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>
          
        <? 
	$k=0;	
	while($mypro=mysql_fetch_array($homeres)){
			$k++;
	?>
    
    
    
    
    
        <div <? if($i%2==1) {echo 'class="showup"';}else{echo 'class="showupnot"';}?>>
      <table width="100%" cellpadding="0" cellspacing="0">
        <tr height="110px">
          <td align="center" valign="middle" width="110">
                                   
              
              <div class="imagex"> <a href="<?=get_cat_name($mypro['cid']);?>/<?=str_replace(" ","-",trim($mypro['pname']));?>/auction/<?=$mypro['pid']?>">
              <div class="img_bor"><?=image_90($mypro['pid']); ?></div>
            </a></div></td>
          <td width="426" align="center" valign="middle"><div class="text"> <a href="<?=get_cat_name($mypro['cid']);?>/<?=str_replace(" ","-",trim($mypro['pname']));?>/auction/<?=$mypro['pid']?>" class="mainptitleframe">
              <?=substr($mypro['pname'],0,37);?>
              </a>
              <div class="normaltextlightgrey">
                <?=substr($mypro['brand'],0,250);?>
                ...</div>
            </div></td>
              <td align="center" valign="middle" width="161"><div class="tac ttc normaltextblackbold13">
             <span class="normaltextlightgrey">Instead at actual price of</span> <br />
 <?=$currency_symbol_new?>&nbsp;<?=$mypro['price'];?><br />

<span class="normaltextlightgrey">Starting price is</span> <span class="normaltextorangebold13"><br />
<?=$currency_symbol_new?>&nbsp;<?=$mypro['starting_bidprice'];?> </span>
            </div></td>
          <td align="center" valign="top" width="107">
<div class="image_show tm5px lm15px">
                    <? if($mypro['type1']=='1'){?>
                    <div class="fixed_price1"></div>
        <? }else if($mypro['type1']=='2'){?>
                    <div class="penny_prd1"></div>
        <? }else if($mypro['type1']=='3'){?>
                    <div class="s100_off1"></div>
                <? }?>
                   
              </div>
          <div class="ttc normaltextredbold13_profile tm5px">
              <div id="winner_index_page_<?=$mypro['pid']?>"></div>
            </div></td>
          <td align="center" valign="middle" class="normaltextblackbold13 fsb" width="154">
		  <div style="display:none" id="maximumbid_<?=$mypro['pid']?>" class="highestbid"></div>
            <div class="tac" id="button_finished_index_page_<?=$mypro['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('<?=$mypro[pid]?>'); return false;" value="   " class="button" />
              <? }?>
              </a> </div>
            <div id="productprice_<?=$mypro[pid]?>" class="normaltextorangebold19c tac"><?=$currency_symbol_new?>&nbsp;<span id="price_index_page_<?=$mypro['pid']?>">
              <? 
		  echo $mypro['bid_price'];
		?>
              </span> </div>
            <div class="normaltextblackbold19c" id="productcounter_<?=$myrow[pid]?>"><span id="counter_index_page_<?=$mypro['pid']?>"></span></div>
            <div id="winner_index_page_<?=$mypro['pid']?>"></div></td>
        </tr>
      </table>
    </div>        
        <?
				
			}	// end of while loop
		if(rightpaging()){

				?><table width="100%" class="clb"><tr><td class="allp5px" align="center">
					<div class="page"><br>
          <? echo rightpaging(); ?></div></td></tr>
</table>
	<?
			}
			?>
        <? }?>
      </div>    </div>

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