<html>
<head>
<title>
Parent Window
</title>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />

<script language="JavaScript"> 
var k=0;
function getvalue(cv){
	var e = cv;
	e.value = k + 1;
}

function add(){
if(k<2){
k++;

var row = t1.insertRow(t1.rows.length); 
var col = row.insertCell(0); 
col.innerHTML = "<td>PO No</td>"; 
col = row.insertCell(1); 
col.innerHTML = "<td><input type=text id=poNo"+k+" name=poNo"+k+" value=''></td>";
}else{
alert("You cannot add more than 3 PO into one invoice.")
}
$().ready(function() {
	$("#poNo"+k+"").autocomplete("poauto.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
}

$().ready(function() {
	$("#poNo0").autocomplete("poauto.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
</script>
</head>
<body>


<table id='t1' border='0' cellspacing='0' cellpadding='5' bordercolor='white' width='60%' align=''>
<form method="post" name="aform" action="addstockpo.php" onsubmit="getvalue(counter);">

<tr>
<td colspan="2">
<a href="JavaScript:void(0);" id=addrow name=addrow type=button value=Add onClick="add()";">
<img src="Picture/add.gif" width="35" height="35" alt="Add PO">Add PO</a>
</td>
</tr>

<?php

$date = date("Y-m-d");
echo "<tr>";
echo "<td>Date</td>";
echo "<td><input type='hidden' name='poDate' value='$date'>$date</td>";
echo "</tr>";
?>

<tr>
<td>Inv No</td>
<td><input type='text' name='billNo' value=''></td>
</tr>

<tr>
<td>PO No</td>
<td><input type='text' id='poNo0' name='poNo0' value=''></td>
</tr>
</table>
<table>
<tr>
<td><center><input type="hidden" id="counter" name="counter" value=""><input type='submit' name='Submit' value='Submit'></center></td>
</tr>
</form>
</table>
</body>
</html>