<? error_reporting(0); 
require 'include/configurations.php'; // ITECHBIDS Configuration File ?>


 <form  action="<? $_SERVER['PHP_SELF']?>" method="post" name="frm13">
<table border="0" align="center" cellpadding="5" cellspacing="2" width="80%" class="ft">
<tr class="ct" height="25">
  <td colspan="4"> Bid Increments Settings</td>
</tr>
<?

$auction_query="select * from options where auto=14";
$table=mysql_query($auction_query);
$row=mysql_fetch_array($table);
$bid_permission=$row['options'];

if($bid_permission=="no")
{
$auction_query="select * from bidincrement";
$tablebid=mysql_query($auction_query);
$total=mysql_num_rows($tablebid);
}
$i=1;

?>



<tr ><td  colspan="2"> Allow sellers to specify Bid increment</td> 
                      <td colspan="2"> <input type="radio" onClick="checkpermission('no','<?= $total
 ?>');" name="bidpermission" value="no" <? if($bid_permission=="no") echo"checked"; ?>>No 
          				  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					   <input type="radio" onClick="checkpermission('yes','<?= $total
 ?>');" name="bidpermission" value="yes" <? if($bid_permission=="yes") echo"checked"; ?>>Yes 
					  </td>
</tr>
<tr class="ct" height="25">
  <td>From ($)</td>
  <td>To ($)</td><td>Increment ($)</td><td align="center">Add / Delete</td>
</tr>
<?
while($rowbid=mysql_fetch_array($tablebid))
{
 ?>
	<tr >
     <td width="25%"> <input type="hidden" name="records_id<?= $i ?>" value="<?= $rowbid['bid_id'] ?>" />
	 <input  class="smalltxt" type="text" class="bluetext"name="bid_from<?= $i ?>" value="<?= $rowbid['bid_from'] ?>" <? if($bid_permission=="yes") { ?> disabled <? }?> ></td>
	 <td width="25%"> <input  class="smalltxt" type="text" class="bluetext"name="bid_to<?= $i ?>" value="<?= $rowbid['bid_to'] ?>" <? if($bid_permission=="yes") { ?> disabled <? }?> ></td>
	 <td width="25%"> <input  class="smalltxt" type="text" class="bluetext"name="bid_inc<?= $i ?>" value="<?= $rowbid['bid_inc'] ?>" <? if($bid_permission=="yes") { ?> disabled <? }?> ></td>
	 <td width="25%" align="center"> <input type="checkbox" name="bid_del<?= $i++ ?>"  value="0"></td>
</tr>
<? }
 ?>


<tr  ><td align="center" colspan="3"><input type="submit" class="button"   value=" Modify " name="bid_modify" ></td><td align="center"><input type="submit" class="button"   value=" Delete " name="bid_delete" ></td>
</tr>
	<tr   >
     <td width="25%"><input  class="smalltxt" type="text" class="bluetext"name="bids_from" <? if($bid_permission=="yes"){ ?> disabled <? }?> ></td>
	 <td width="25%"><input  class="smalltxt" type="text" class="bluetext"name="bids_to" <? if($bid_permission=="yes") { ?> disabled <? }?> ></td>
	 <td width="25%"><input  class="smalltxt" type="text" class="bluetext"name="bids_inc" <? if($bid_permission=="yes") { ?> disabled <? }?> ></td>
	 <td width="25%" align="center"><input type="hidden" name="total_records" value="<?= $total?>" />
	 
	 <input type="submit" class="button"   value=" Add " name="bid_add" ></td>
</tr>
</table>
</form>
<br>
<script language="javascript">
function checkpermission(val,tot)
{
var coun=document.forms[0].elements.length;
	for(i=0;i<coun;i++)
	{
		if(val=="yes")
		{
			if(document.forms[0].elements[i].type=="text")
			{
				document.forms[0].elements[i].disabled=true;
			}
		}
		if(val=="no")
		{
			if(document.forms[0].elements[i].type=="text")
			{
				document.forms[0].elements[i].disabled=false;
			}
		}
	}

}

</script>