<script>
window.resizeTo(300,410);
window.moveTo(0,0);
var abc=opener.document.f1.grp.value;
 var dr_cr=[];

function fun()
{
opener.document.f1.grp.value=abc;
//opener.document.f1.drcr.value=dr_cr[document.f1.gp.selectedIndex];
window.close();
}

function showNature(x)
{
 var nature=dr_cr[x.gp.selectedIndex];
 if(nature=='Assets'||nature=='Income')
    opener.document.f1.drcr.value='Dr';
 else if(nature=='Liabilities'||nature=='Expenses')
    opener.document.f1.drcr.value='Cr';
 else
   opener.document.f1.drcr.value='';
}


</script>
<TITLE>GROUPS</TITLE>
<center>
<body bgcolor=lightsteelblue>
<B>ACCOUNT GROUPS <BR>
<?
 include("../opendb.php");
 $result=mysqli_query($db,"select * from acgroups where gname!='-' order by nature");
 print "<form name=f1> <select name=gp multiple=true size=15 onClick=opener.document.f1.grp.value=this.value;  onChange=showNature(this.form)>";
$i=0;
 while($row=mysqli_fetch_row($result))
  {
    print "<option value='$row[0]'>$row[0]-$row[1]</option>";
 print "\n<script>dr_cr[$i]='$row[1]'</script>";
 $i++;
  }
print "</select>";
?><br><br>
<input type=button value='OK' onClick=window.close()>
<input type=button value='Cancel' onClick=fun()>
</form>

