<script>
tb = parent.AfianHandler['allTabs']['<?echo 
$_GET['tabid'];?>'];
<?
if ($_SESSION['username'] == "admin") {


		$gid = $str->fromHTML($_GET['gid']);
		if ($gid != "1") {
	
		$rs = $db->query("SELECT * FROM ".$settings->config['users_tablename']." WHERE gid='".$gid."'");

		if ($rs->RecordCount() > 0) {
			while (!$rs->EOF) {
				$uid = $rs->fields['id'];
				$uname = $auth->id2username($rs->fields['id']);
				if ($auth->delUser($uid)) {
					$log->act("0", "user deletion", $uname." (".$uid.")");
					$iframeAlertMsg[] = $lang->get("User \"%1\" deleted", array($uname));
				} else {
					$log->act("1", "user deletion", $uname." (".$uid.")");
					$iframeAlertMsg[] = $lang->get("Failed to delete user \"%1\"", array($uname));
				}
				$rs->MoveNext();
			}
			$extraMsg = $lang->get(" Group had %1 users.", array($rs->RecordCount()));
		} else {
			$extraMsg = $lang->get(" Group was empty.");
		}

		$groupname = $auth->gid2name($gid);
		$rs = $db->query("DELETE FROM ".$settings->config['groups_tablename']." WHERE id='".$gid."'");
		if ($db->Affected_Rows() > 0) {
			$log->act("0", "group deletion", $groupname);
			$iframeAlertMsg[] = $lang->get("Group \"%1\" deleted.", array($groupname)).$extraMsg;
			?>
			if (tb != undefined) {
			tb.removeItem('<?echo $str->safeJS($gid);?>');
			}
			<?
		} else {
			$log->act("0", "group deletion", $groupname);
			$iframeAlertMsg[] = $lang->get("Failed to delete group \"%1\".", array($groupname)).$extraMsg;
		}
		
		} else {
			$iframeAlertMsg[] = $lang->get("You cannot delete group \"default\"");
		}

}
?>
	if (tb != undefined) {
		parent.cancelTimeOut(tb.id);
		if (tb.active) {
			parent.AdmGroupsStatusBar();
		}
		tb.hideHourGlass();
	}

<?iframeAlert($iframeAlertMsg);?>
</script>