<?
	include("config/connect.php");
	include("session.php");
	include("functions.php");
	$uid = $_SESSION["userid"];

	$qrysel = "select *,".$lng_prefix."bidpack_banner as bidpack_banner,".$lng_prefix."bidpack_name as bidpack_name 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" type="text/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>
<script language="javascript">
	function check()
	{
		
		if(document.payment.paymentmethod[0].checked==false&&document.payment.paymentmethod[1].checked==false&&document.payment.paymentmethod[2].checked==false&&document.payment.paymentmethod[3].checked==false)
		{
			alert("<?=$lng_plschoosemethod;?>");
			return false;
		}
		else
		{
			bpid = document.payment.bidpackid.value;			
			if(document.payment.paymentmethod[0].checked==true){
				pm = document.payment.paymentmethod[0].value;	
			}else if(document.payment.paymentmethod[1].checked==true){
				pm = document.payment.paymentmethod[1].value;	
			}else if(document.payment.paymentmethod[2].checked==true){
				pm = document.payment.paymentmethod[2].value;	
			}else if(document.payment.paymentmethod[3].checked==true){
				pm = document.payment.paymentmethod[3].value;	
			}
			window.location.href='buybidspayment.php?bpid=' + bpid + '&pm=' + pm ;
		}
	}
</script>
</head>


<?
	if($_POST["buybids"]!="" or $_GET["pkg"]!="")
	{
?>
<body>
<?
	}
	else{
		if($selected!="")
		{
?>
<body onload="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 class="page_title_font"><?=$lng_myauctionsavenue;?> - <?=$lng_tabbuybids;?></div></div>
					<div class="rightbar"></div>
				</div>
				<div class="bodypart">
				<?
				if($_POST["buybids"]!="" or $_GET["pkg"]!="")
				{
					$id = $_GET["pkg"];
					$qrysel = "select *,".$lng_prefix."bidpack_name as bidpack_name from bidpack where id=$id";
					$ressel = mysql_query($qrysel);
					$obj = mysql_fetch_object($ressel);
				?>
				<div style="height:10px;">&nbsp;</div>
				<div style="float: left; margin-left: 10px; width: 260px; height:110px; padding-right: 10px;"><img src="uploads/bidpack/<?=$obj->bidpack_banner;?>" border="0"/></div>
				<div style="float:left; text-align: left; width: 460px; padding-top: 10px;" class="buybidpacktitle"><?=$lng_buybidpack;?></div>
				<div style="padding-left: 15px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; padding-right: 10px; text-align: left; padding-top: 10px;"><br /><br /><?=$lng_youchoosen1;?> <b><? echo $obj->bidpack_name."&nbsp;(".$obj->bid_size." ´Î³ö¼Û / ".$Currency.$obj->bid_price.")";?></b>. <?=$lng_youchoosen2;?></div>
			<div style="clear: both; float:left; padding-left: 20px; padding-top: 10px; text-align: left;">
				<div style="width: 720px; height: 25px; background-image: url(images/openOuction_bar-middle.jpg); background-repeat: repeat-x; border-left: 1px solid  #cddce9;  border-right: 1px solid  #cddce9;">
					<div style="font-size: 14px; padding-top: 5px; padding-left: 20px;"><?=$lng_paymentmethod;?></div>
				</div>
				<div style="clear: both; height:10px;">&nbsp;</div>
				<form name="payment" action="" method="post">
					<div class="normal_text">
						<input type="radio" name="paymentmethod" value="alipay"  checked=true /><?=$lng_paymethod1;?>
						<input type="radio" name="paymentmethod" value="chinabank"  /><?=$lng_paymethod2;?>						
						<input type="radio" name="paymentmethod" value="tenpay"  /><?=$lng_paymethod3;?>						
						<input type="radio" name="paymentmethod" value="teepay"  /><?=$lng_paymethod4;?>						
					</div>
				<div style="clear: both; height:20px;">&nbsp;</div>
				<div class="normal_text" style="float:right; padding-right: 40px; height:40px;"><img src="<?=$lng_imagepath;?>buy bids-1.png" value="BUY BIDS" name="cnfbuybids" onclick="check();"  onmouseover="this.src='<?=$lng_imagepath;?>buy bids_hover.png'" onmouseout="this.src='<?=$lng_imagepath;?>buy bids-1.png';" style="cursor: pointer"/></div>
				<input type="hidden" name="bidpackid" value="<?=base64_encode($id);?>" />
				<input type="hidden" name="bidpacksize" value="<?=$obj->bid_size;?>" />
				</form>
			</div>
				<?
				}
				else
				{
				?>
						<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>
</body>
</html>
