<html>
<head>
<link href="../../css/pop_up style.css" rel="stylesheet" type="text/css">
<script src="../../js/group_creation_ajax.js"  type="text/javascript"></script>
<script src="../../js/jquery/jquery.js" type="text/javascript"></script>
<script src="../../js/shortcut.js"  type="text/javascript"></script>
<script>

shortcut.add("Alt+g",function() 
{
	document.getElementById("group_name").focus();
});

shortcut.add("Alt+r",function() 
{
	document.getElementById("group_remarks").focus();
});

</script>
<style>
.headings{ font-family:verdana; font-size:10px;}

</style>
</head>
<?php
error_reporting(0);
$edit_id=$_GET['edit_id'];
include("../../include/db.php");
if($_GET['edit_id']!='')
{
$group_table_display_style='style="display:inline;"';
} 
else
{
$group_table_display_styles='style="display:none;"';
}
function group_name($group_type)
  {
  
	 $sql_grp_name="select * from group_creation where sub_grpid='$group_type' ";
	$rs_grp_name=mysql_query($sql_grp_name);
	$rscount_grp_name=mysql_num_rows($rs_grp_name);
	while($rsdata_grp_name=mysql_fetch_object($rs_grp_name))
	{ 
	$group_name=$rsdata_grp_name->sub_group_name;
	}
	return $group_name;
}
 $id=$_GET[edit_id];
  $sql="select * from group_creation where sub_grpid='$_GET[edit_id]'";
  $rs=mysql_query($sql);
  $rscount=mysql_num_rows($rs);
 
  while($rsdata=mysql_fetch_array($rs))
  {
	  $group_name=$rsdata['sub_group_name'];
	  	  $group_type=$rsdata['group_id'];
		  	  $groupname=group_name($group_type);

	  $group_remarks=$rsdata['group_remarks'];
  }
  function groupname($group_id)
  {
  
	$sql_grp="select * from group_creation where sub_grpid='$group_id' ";
	$rs_grp=mysql_query($sql_grp);
	$rscount_grp=mysql_num_rows($rs_grp);
	while($rsdata_grp=mysql_fetch_object($rs_grp))
	{ 
	$group_name=$rsdata_grp->sub_group_name;
	}
	return $group_name;
}
 
?>
<body bgcolor="#F2F2F2">
<table width="100%" height="44%" cellspacing="15" bgcolor="#F2F2F2">
  <tr>
    <td valign="top">
    <table width="100%" bgcolor="#FFFFFF" style=" border:solid 1px;border-color:#C9C9C9">
  <tr>
    <td colspan="4" class="heading" style="border-bottom:solid 1px; border-bottom-color:#EFEFEF">Group Creation</td>
  </tr>
    <tr>
    <td colspan="4">&nbsp;</td>
  </tr>
  <tr>

  <td width="307" height="24" align="center" class="field"><span style="color:#F00"><strong>G</strong></span>roup Name <span class="style2">*</span></td>
  
  <td width="257" class="field"><input type="text" name="group_name" id="group_name"  tabindex="1" class="text_box"  value="<?php if($_GET['edit_id']!='') { echo $group_name; } ?>"></td>
  
  <td width="600" align="left"><select name="group_type" id="group_type" class="select_box" tabindex="2" >
    <?php if($_GET['edit_id']!='') { ?>
      <option value="Primary">Primary</option>
    <?Php
       $sql="select * from group_creation ";
  $rs=mysql_query($sql);
  $rscount=mysql_num_rows($rs);
 
  while($rsdata=mysql_fetch_array($rs))
  {
	 $group_id=$rsdata['sub_grpid'];
	  $group_name1=groupname($group_id);
	  ?>
      <option value="<?php echo $group_id;?>" <?php if($group_type==$group_id){?> selected="selected" <?php }?>><?php echo $group_name1;?></option>  
    <?php  } ?>
    <?php } else {?>
    <option value="Primary">Primary</option>
    <?Php
       $sql="select * from group_creation ";
  $rs=mysql_query($sql);
  $rscount=mysql_num_rows($rs);
 
  while($rsdata=mysql_fetch_array($rs))
  {
  	  $group_id=$rsdata['sub_grpid'];
	  $group_name1=groupname($group_id);
	  ?>
    <option value="<?php echo $group_id;?>" <?php if($group_type==$group_id){?> selected="selected" <?php }?>><?php echo $group_name1;?></option>  
    <?php } } ?>
  </select></td>
  </tr>
  
<tr>
<td align="center" valign="top" class="field"><span style="color:#F00"><strong>R</strong></span>emarks</td>
  <td colspan="2" rowspan="3" class="field"><textarea name="group_remarks" id="group_remarks" cols="40"  class="addr_box"rows="4" tabindex="3"><?php if($_GET['edit_id']!='') { echo $group_remarks; } ?></textarea></td>
  </tr>
          
<tr>

  <td align="center" valign="top" class="field">&nbsp;</td>
  </tr>

<tr>

  <td class="field"  valign="top">&nbsp;</td>
  </tr>

<tr>

  <td class="field" valign="top">&nbsp;</td>
  <td  class="field">&nbsp;</td>
</tr>
    <tr>
    <td colspan="4" style="border-bottom:solid 1px; border-bottom-color:#EFEFEF"><span style="color:#F00" class="headings">
    &nbsp;&nbsp;&nbsp;&nbsp;S.Key - ALT+KEY</span>
   </td>
  </tr>

        <tr>  
    <td colspan="6" class="field" align="right"><input type="button" name="action" id="action" tabindex="4" value="<?php if($_GET['edit_id']!='') { echo "EDIT";  } else { echo "ADD"; } ?>" class="button-primary" onClick="group_mainlist_add(group_name.value,group_type.value,group_remarks.value,'<?php echo $id;?>',this.value)"/>&nbsp;&nbsp;</td>
            </tr>
  </table>   
</td>
  </tr>
</table>
</body>
</html>

