<?php
if (!defined("root")) {
	define("root", $_SERVER['DOCUMENT_ROOT']);
}
require(root."/___simple_config.php");
session_start();
$pageSubOf = "transactions";
$pageName = "members";
$pageTitle = "Members";
$thisUrl = "members";
$pageUrl = "/".adminFolder."/$thisUrl";
$coutSpecs = array('nl'=>"n");
require(root."/".adminFolder."/_common.php");
require(root."/".adminFolder."/_lib/db.php");
require(root."/".adminFolder."/_lib/main.php");
require(root."/".adminFolder."/PHPMailer/PHPMailerAutoload.php");
require(root."/".adminFolder."/_lib/mail.php");
require(root."/".adminFolder."/_lib/auth.php");
$a = cekpost(cleanQuery($_GET["a"]), "");
$stgl = cekpost(cleanQuery($_REQUEST["fil_stgl"]), date('d-m-Y', time()));
$etgl = cekpost(cleanQuery($_REQUEST["fil_etgl"]), date('d-m-Y', time()));
$q_stgl = strtotime($stgl);
$q_etgl = strtotime($etgl)+86400;
$fil_stgl = strtotime($stgl);
$fil_etgl = strtotime($etgl);
require(root."/".adminFolder."/_tpl/tag_html_a.php");
cout('
<style type="text/css">
	
</style>
');

require(root."/".adminFolder."/_tpl/openbody.php");
require(root."/".adminFolder."/_tpl/header.php");
cout('<div class="page-header">');
	cout('<h1>'.$pageTitle.'</h1>');
cout('</div>');
# MAIN
###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
if ($a=="" || $a=="main") {
	cout('<div class="section_submenus">');
		cout('<ul class="nav nav-tabs" role="tablist">');
			if (authorizedModule("members_main", $ses_kduser)) {
				cout('<li role="presentation" class="active"><a href="'.$pageUrl.'/" title="Main List"><span class="glyphicon glyphicon-list"></span> Main</a></li>');
			}
		cout('</ul>');
	cout('</div>');
	if (authorizedModule("members_quick_add", $ses_kduser)) {
		cout('<nav class="navbar navbar-default">
			<div class="container-fluid">
				<!-- Brand and toggle get grouped for better mobile display -->
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="#">Quick Add</a>
				</div>
				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">');
					cout('<form class="navbar-form navbar-left" id="quick-add-form" role="search" method="post" target="quick_iframe" action="/'.adminFolder.'/_ajax/ajax_members.php?a=quick_add">');
						cout('<div class="form-group">
							<label for="ikdbank">Bank</label>
							<select name="ikdbank" id="ikdbank" class="form-control">
								<option value="">- Select Bank -</option>');
								$rsb=array();$qb="SELECT * FROM banks WHERE isactive=1";
								callRS($rsb, $qb);
								for ($i=0;$i<count($rsb);$i++) {
									cout('<option value="'.$rsb[$i]["kdbank"].'">'.$rsb[$i]["inisial"].'</option>');
								}
							cout('
							</select>
						</div>');
						cout('<div class="form-group">
							<label for="ikdgame">Games</label>
							<select name="ikdgame" id="ikdgame" class="form-control">
								<option value="">- Select Game -</option>');
								$rsb=array();$qb="SELECT * FROM games WHERE isactive=1";
								callRS($rsb, $qb);
								for ($i=0;$i<count($rsb);$i++) {
									cout('<option value="'.$rsb[$i]["kdgame"].'">'.$rsb[$i]["nama"].'</option>');
								}
							cout('
							</select>
						</div>');
						cout('<div class="form-group">
							<label for="inorek">Nomor Rekening</label>
							<input type="text" name="inorek" id="inorek" class="form-control" placeholder="Nomor Rekening">
						</div>');
						cout('<div class="form-group">
							<label for="inamarek">Nama Pemilik Rek</label>
							<input type="text" name="inamarek" id="inamarek" class="form-control" placeholder="Nama Pemilik Rek">
						</div>');
						cout('<div class="form-group">
							<label for="iemail">Email</label>
							<input type="email" name="iemail" id="iemail" class="form-control" placeholder="Email">
						</div>');
						cout('<div class="form-group">
							<label for="itelp">Telepon</label>
							<input type="text" name="itelp" id="itelp" class="form-control" placeholder="Telepon">
						</div>');
						cout('<button type="submit" class="btn btn-primary" onclick="formSubmit(\'quick-add-form\');return false;">Add Member</button>');
						cout('<div id="quick-err" class="err" style="width:100%;"></div>');
					cout('</form>');
					$viewFrame = 0;
					if ($viewFrame==1) {
						cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="500" height="100" style="overflow:;border:1px red solid;" visibility="" scrolling="yes" frameborder="1"></iframe>');
					} else {
						cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="500" height="11" style="overflow:hidden;" visibility="hidden" scrolling="no" frameborder="0"></iframe>');
					}
				cout('
				</div><!-- /.navbar-collapse -->
			</div><!-- /.container-fluid -->
		</nav>');
	}
	cout('<nav class="navbar navbar-default">
		<div class="container-fluid">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2" aria-expanded="false">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="#">Filter</a>
			</div>
			<!-- Collect the nav links, forms, and other content for toggling -->
			<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
				<form class="navbar-form navbar-left" role="search" method="post" target="filter_iframe" action="/'.adminFolder.'/_ajax/ajax_members.php?a=section_main">');
					if (authorizedModule("members_filter", $ses_kduser)) {
						if (authorizedModule("members_element_games", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_kdgame">Games</label>
								<select name="fil_kdgame" id="fil_kdgame" class="form-control">
									<option value="">- Filter Game -</option>');
									$rsb=array();$qb="SELECT * FROM games WHERE isactive=1";
									callRS($rsb, $qb);
									for ($i=0;$i<count($rsb);$i++) {
										cout('<option value="'.$rsb[$i]["kdgame"].'">'.$rsb[$i]["nama"].'</option>');
									}
								cout('
								</select>
							</div>');
						}
						if (authorizedModule("members_element_games", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_username">Username</label>
								<input type="text" name="fil_username" id="fil_username" class="form-control" placeholder="% UserName %">
							</div>');
						}
						if (authorizedModule("members_element_banks", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_kdbank">Bank</label>
								<select name="fil_kdbank" id="fil_kdbank" class="form-control">
									<option value="">- Filter Bank -</option>');
									$rsb=array();$qb="SELECT * FROM banks WHERE isactive=1";
									callRS($rsb, $qb);
									for ($i=0;$i<count($rsb);$i++) {
										cout('<option value="'.$rsb[$i]["kdbank"].'">'.$rsb[$i]["inisial"].'</option>');
									}
								cout('
								</select>
							</div>');
						}
						if (authorizedModule("members_element_bank_account_number", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_norek">Nomor Rekening</label>
								<input type="text" name="fil_norek" id="fil_norek" class="form-control" placeholder="% Nomor Rekening %">
							</div>');
						}
						if (authorizedModule("members_element_bank_account_holder", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_namarek">Nama Pemilik Rek</label>
								<input type="text" name="fil_namarek" id="fil_namarek" class="form-control" placeholder="% Nama Pemilik Rek %">
							</div>');
						}
						if (authorizedModule("members_element_email", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_email">Email</label>
								<input type="text" name="fil_email" id="fil_email" class="form-control" placeholder="% Email %">
							</div>');
						}
						if (authorizedModule("members_element_phone", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_telp">Phone</label>
								<input type="text" name="fil_telp" id="fil_telp" class="form-control" placeholder="% Phone %">
							</div>');
						}
						if (authorizedModule("members_element_active", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_isactive">Active?</label>
								<select name="fil_isactive" id="fil_isactive" class="form-control">
									<option value="0">All</option>
									<option value="1" selected="selected">Active</option>
									<option value="2">Non-Active</option>
								</select>
							</div>');
						}
						if (authorizedModule("members_element_assign", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_assign">Assigned?</label>
								<select name="fil_assign" id="fil_assign" class="form-control">
									<option value="0" selected="selected">All</option>
									<option value="1">Not Yet</option>
									<option value="2">Assigned</option>
								</select>
							</div>');
						}
						cout('<div class="form-group">
							<label for="fil_sort">Sort by?</label>
							<select name="fil_sort" id="fil_sort" class="form-control">
								<option value="0" selected="selected">Date</option>
								<option value="1">Highest DP</option>
								<option value="2">Highest WD</option>
								<option value="3">Lowest DP</option>
								<option value="4">Lowest WD</option>
							</select>
						</div>');
					}
					cout('
					<button type="button" class="btn btn-primary" onclick="filterReload(\''.$pageName.'\', 1);return false;">Search</button>
				</form>
			</div><!-- /.navbar-collapse -->
		</div><!-- /.container-fluid -->
	</nav>');
	#cout('<div>Upload: <span id="progress-upload"></span></div>');
	#cout('<div>Download: <span id="progress-download"></span></div>');
	
	#cout('<div class="bar-upload"><div class="progress-upload">Uploaded</div>Upload</div>');
	cout('<div class="bar-download"><div class="progress-download">Downloaded</div>Download</div>');
	cout('<div class="ajax_resp"></div>');
	cout('<script>
		function clearQuickAdd() {
			$("#ikdbank").val("");
			$("#ikdgame").val("");
			$("#inorek").val("");
			$("#inamarek").val("");
			$("#iemail").val("");
			$("#itelp").val("");
			$(".quick-err").html("");
		}
		$("#fil_username, #fil_norek, #fil_namarek, #fil_email, #fil_telp").keypress(function (e) {
			if(e.which == 13) {
				filterReload(\''.$pageName.'\', 1);
				return false;
			}
		});
		function checkIP(parIP) {
			$(".modal-title").html("Check IP: <strong>"+ parIP +"</strong>");
			$(".modal-body").html("<img src=\"/'.adminFolder.'/img/ajax-loader.gif\" /> <div>or</div><div><a href=\"http://ipinfo.io/"+parIP+"/json\" target=\"_blank\">http://ipinfo.io/"+parIP+"/json</a></div>");
			$(".modal-footer").html("<button type=\"button\" class=\"btn btn-danger\" data-dismiss=\"modal\">Close</button>");
			$("#myModal").modal("show");
			$.ajax({
				type: "GET",
				url: "/'.adminFolder.'/_ajax/ajax_user_visitors.php",
				data: "a=checkip&ip="+ parIP +"",
				success: function(resp){
					$(".modal-body").html(resp);
				}
			});
			
		}
		$("#fil_username").focus();
		filterReload(\''.$pageName.'\', 1);
		function checkSBOCredit(parKd) {
			$(".modal-body").append("<img src=\"/'.adminFolder.'/img/ajax-loader.gif\" alt />");
			var pData = "a=checkcredit&kd="+ parKd +"";
			$.ajax({
				type: "GET",
				url: "/'.adminFolder.'/_ajax/ajax_members.php",
				data: pData,
				success: function(resp){
					//alert(resp);
					//$(".modal-body").append(resp);
					$(".modal-body").html(resp);
				}
			});
		}
		function doAct(parType, parKd) {
			var pData = "a=do&type="+ parType +"&kd="+ parKd +"";
			if (parType=="edit") {
				pData += "&nfkdbank"+ parKd +"="+ $("#nfkdbank"+ parKd +"").val() +"";
				pData += "&nfkdgame"+ parKd +"="+ $("#nfkdgame"+ parKd +"").val() +"";
				pData += "&nfnorek"+ parKd +"="+ $("#nfnorek"+ parKd +"").val() +"";
				pData += "&nfnamarek"+ parKd +"="+ $("#nfnamarek"+ parKd +"").val() +"";
				pData += "&nfemail"+ parKd +"="+ $("#nfemail"+ parKd +"").val() +"";
				pData += "&nftelp"+ parKd +"="+ $("#nftelp"+ parKd +"").val() +"";
				pData += "&nfisactive"+ parKd +"="+ $("#nfisactive"+ parKd +"").val() +"";
			}
			if (parType=="trydepo" || parType=="trywd") {
				pData += "&tanggalx="+ $("#tanggalx").val() +"";
				pData += "&ijam="+ $("#ijam").val() +"";
				pData += "&jumlah="+ $("#jumlah").val() +"";
			}
			if (parType=="assign" || parType=="reassign") {
				pData += "&nfkdaccount"+ parKd +"="+ $("#nfkdaccount"+ parKd +"").val() +"";
			}
			$.ajax({
				type: "GET",
				url: "/'.adminFolder.'/_ajax/ajax_members.php",
				data: pData,
				success: function(resp){
					//alert(resp);
					var tsp1 = resp.split("$$$");
					var tsp2 = new Array();
					for (var i=0;i<tsp1.length;i++) {
						if (tsp1[i]=="deleterow") {
							$(".tr-data"+ tsp1[1] +"").remove();
						} else if (tsp1[i]=="done") {
							$("#myModal").modal("hide");
						} else {
							tsp2 = tsp1[i].split("$$");
							$("."+tsp2[0]).html(tsp2[1]);
						}
					}
				}
			});
		}
		function prepareAct(parType, parKd) {
			$.ajax({
				type: "GET",
				url: "/'.adminFolder.'/_ajax/ajax_members.php",
				data: "a=prepare&type="+ parType +"&kd="+ parKd +"",
				success: function(resp){
					//alert(resp);
					var tsp1 = resp.split("$$$");
					//alert(tsp1[0]);
					if (tsp1[0]=="assign" || tsp1[0]=="reassign" || tsp1[0]=="trydepo" || tsp1[0]=="trywd" || tsp1[0]=="tryview" || tsp1[0]=="trycredit") {
						$(".modal-title").html(tsp1[1]);
						$(".modal-body").html(tsp1[2]);
						$(".modal-footer").html(tsp1[3]);
						$("#myModal").modal("show");
						if (tsp1[0]=="trydepo" || tsp1[0]=="trywd") {
							$("#myModal").on("shown.bs.modal", function () {
								bindDatePicker(".tanggalx");
								$("#myModal #jumlah").number( true, 0 );
							});
						}
					} else {
						var tsp2 = new Array();
						for (var i=0;i<tsp1.length;i++) {
							tsp2 = tsp1[i].split("$$");
							$("."+tsp2[0]).html(tsp2[1]);
						}
					}
				}
			});
		}
	</script>');
}
###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######

/*
		# MAIN
		###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
		if ($a=="" || $a=="main") {
			cout('<div class="contentMenu">');
				cout(adminSubMenu(''.$pageUrl.'/', "main", "Main"));
			cout('</div>');
			cout('<div class="contentContainer">');
				cout('<div class="helper">');
					cout('<form method="post" target="quick_iframe" action="/'.adminFolder.'/_ajax/ajax_members.php?a=add">');
						cout('<div class="inline" style="width:95%;border:1px #999 dashed;padding:10px;">');
							cout('<div class="inline">');
								cout('<div class="fleft">
									<div><label for="ikdbank">Bank</label></div>
									<div><select name="ikdbank" id="ikdbank">
										<option value=""></option>');
										$rsb=array();$qb="SELECT * FROM banks WHERE isactive=1";
										callRS($rsb, $qb);
										for ($i=0;$i<count($rsb);$i++) {
											cout('<option value="'.$rsb[$i]["kdbank"].'">'.$rsb[$i]["inisial"].'</option>');
										}
									cout('
									</select></div>
								</div>');
								cout('<div class="fleft">
									<div><label for="inorek">Nomor Rekening</label></div>
									<div><input type="text" name="inorek" id="inorek" /></div>
								</div>');
								cout('<div class="fleft">
									<div><label for="inamarek">Nama Pemilik Rekening</label></div>
									<div><input type="text" name="inamarek" id="inamarek" /></div>
								</div>');
								cout('<div class="fleft">
									<div><label for="iemail">Email</label></div>
									<div><input type="text" name="iemail" id="iemail" /></div>
								</div>');
								cout('<div class="fleft">
									<div><label for="itelp">Telepon</label></div>
									<div><input type="text" name="itelp" id="itelp" /></div>
								</div>');
								cout('<div class="fleft">
									<div>&nbsp;</div>
									<div><input type="submit" value="Add Member" /></div>
								</div>');
							cout('</div>');
							cout('<div id="quick-err" class="err" style="width:100%;"></div>');
						cout('</div>');
					cout('</form>');
					
					$viewFrame = 0;
					if ($viewFrame==1) {
						cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="500" height="100" style="overflow:;border:1px red solid;" visibility="" scrolling="yes" frameborder="1"></iframe>');
					} else {
						cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="500" height="11" style="overflow:hidden;" visibility="hidden" scrolling="no" frameborder="0"></iframe>');
					}
					
					cout('<div class="inline" style="width:95%;border:1px #999 dashed;padding:10px;">');
						cout('<div class="inline" style="width:100%;"><strong>Filter</strong></div>');
						cout('<div class="filter-panel">');
							cout('<div class="sect">
								<div class="label"><label for="fil_username">Username</label></div>
								<div class="field"><input type="text" name="fil_username" id="fil_username" /></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_kdbank">Bank</label></div>
								<div class="field"><select name="fil_kdbank" id="fil_kdbank">
									<option value=""></option>');
									$rsb=array();$qb="SELECT * FROM banks WHERE isactive=1";
									callRS($rsb, $qb);
									for ($i=0;$i<count($rsb);$i++) {
										cout('<option value="'.$rsb[$i]["kdbank"].'">'.$rsb[$i]["inisial"].'</option>');
									}
								cout('
								</select></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_norek">Nomor Rekening</label></div>
								<div class="field"><input type="text" name="fil_norek" id="fil_norek" /></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_namarek">Nama Pemilik Rekening</label></div>
								<div class="field"><input type="text" name="fil_namarek" id="fil_namarek" /></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_email">Email</label></div>
								<div class="field"><input type="text" name="fil_email" id="fil_email" /></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_telp">Phone</label></div>
								<div class="field"><input type="text" name="fil_telp" id="fil_telp" /></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_isactive">Active?</label></div>
								<div class="field"><select name="fil_isactive" id="fil_isactive">
									<option value="0">All</option>
									<option value="1" selected="selected">Active</option>
									<option value="2">Non-Active</option>
								</select></div>
							</div>');
							cout('<div class="sect">
								<div class="label"><label for="fil_assign">Assigned?</label></div>
								<div class="field"><select name="fil_assign" id="fil_assign">
									<option value="0">All</option>
									<option value="1" selected="selected">Not Yet</option>
									<option value="2">Assigned</option>
								</select></div>
							</div>');
						cout('</div>');
						cout('<div class="inline" style="width:100%;">');
							cout('<div class="fleft">
								<div><input class="formButton" type="button" value="Submit" onclick="quickReload(1);" /></div>
							</div>');
						cout('</div>');
						cout('<div id="quick-err" class="err" style="width:100%;"></div>');
					cout('</div>');
					
					cout('<div id="main-list" class="main-list"></div>');
					cout('<div class="tempMagicPop" style="width:1px;height:1px;overflow:hidden;"><div class="isi" style="display:inline-block;"></div></div>');
					cout('<script>
						quickReload(1);
						function quickReload(parPage) {
							$(".main-list").html("<img src=\"/'.adminFolder.'/img/ajax-loader.gif\" alt />");
							var fil_kdbank = $("#fil_kdbank").val();
							var fil_username = $("#fil_username").val();
							var fil_norek = $("#fil_norek").val();
							var fil_namarek = $("#fil_namarek").val();
							var fil_email = $("#fil_email").val();
							var fil_telp = $("#fil_telp").val();
							var fil_assign = $("#fil_assign").val();
							var fil_isactive = $("#fil_isactive").val();
							var adata = "a=load&cp="+ parPage +"";
							adata += "&fil_username="+ fil_username +"";
							adata += "&fil_norek="+ fil_norek +"";
							adata += "&fil_namarek="+ fil_namarek +"";
							adata += "&fil_email="+ fil_email +"";
							adata += "&fil_telp="+ fil_telp +"";
							adata += "&fil_kdbank="+ fil_kdbank +"";
							adata += "&fil_assign="+ fil_assign +"";
							adata += "&fil_isactive="+ fil_isactive +"";
							$.ajax({
								type: "GET",
								url: "/'.adminFolder.'/_ajax/ajax_members.php",
								data: adata,
								success: function(resp){
									$(".main-list").html(resp);
									$("#ikdbank option[value=\"\"]").attr("selected",true);
									$("#inorek").val("");
									$("#inamarek").val("");
									$("#iemail").val("");
									$("#itelp").val("");
									$("#iusername").focus();
									$("#quick-err").html("");
								}
							});
						}
						function doAction(parType, parKd) {
							var pData = "a=do&type="+ parType +"&kd="+ parKd +"";
							if (parType=="update") {
								pData += "&nfkdbank"+ parKd +"="+ $("#nfkdbank"+ parKd +"").val() +"";
								pData += "&nfnorek"+ parKd +"="+ $("#nfnorek"+ parKd +"").val() +"";
								pData += "&nfnamarek"+ parKd +"="+ $("#nfnamarek"+ parKd +"").val() +"";
								pData += "&nfemail"+ parKd +"="+ $("#nfemail"+ parKd +"").val() +"";
								pData += "&nftelp"+ parKd +"="+ $("#nftelp"+ parKd +"").val() +"";
								pData += "&nfisactive"+ parKd +"="+ $("#nfisactive"+ parKd +"").val() +"";
							}
							if (parType=="assignm" || parType=="reassignm") {
								pData += "&nfkdaccount"+ parKd +"="+ $("#nfkdaccount"+ parKd +"").val() +"";
							}
							$.ajax({
								type: "GET",
								url: "/'.adminFolder.'/_ajax/ajax_members.php",
								data: pData,
								success: function(resp){
									var tsp1 = resp.split("$$$");
									var tsp2 = new Array();
									for (var i=0;i<tsp1.length;i++) {
										if (tsp1[i]=="deleterow") {
											$(".data"+ tsp1[1] +"").remove();
										} else if (tsp1[i]=="dePopAction") {
											dePopAction();
										} else {
											tsp2 = tsp1[i].split("$$");
											$("."+tsp2[0]).html(tsp2[1]);
										}
									}
								}
							});
						}
						function dePopAction() {
							$(".magicPopupbg").hide().remove();
							$(".magicPopup").hide().remove();
						}
						function prepareAction(parType, parKd) {
							$.ajax({
								type: "GET",
								url: "/'.adminFolder.'/_ajax/ajax_members.php",
								data: "a=prepare&type="+ parType +"&kd="+ parKd +"",
								success: function(resp){
									var tsp1 = resp.split("$$$");
									if (tsp1[0]=="assign" || tsp1[0]=="reassign") {
										var winWidth = $("html").width();
										var winHeight = $("html").height();
										$(".magicPopupbg").remove();
										$(".magicPopup").remove();
										$("body").append("<div class=\"magicPopupbg\"></div><div class=\"magicPopup\"></div>");
										$(".magicPopupbg").css({ "position":"fixed", "z-index":"9000", "width":winWidth+"px", "height":winHeight+30+"px", "background":"#000", "opacity":"1", "top":"0", "left":"0", "opacity":"0.4" });
										var defWidth = 50;
										var defHeight = 50;
										$(".magicPopup").css({ "position":"absolute", "z-index":"9100", "padding":"10px", "width":defWidth+ "px", "height":defHeight +"px", "top":"50%", "left":"50%", "margin":"-"+ (defWidth/2) +"px 0 0 -"+ (defHeight/2) +"px", "border":"1px #f09999 dashed", "background":"#fff" });
										$(".magicPopup").html("");
										$(".magicPopup").html("<div style=\"position:absolute;top:50%;left:50%;margin:-20px 0 0 -20px;\"><img src=\"/'.adminFolder.'/img/ajax-loader.gif\" alt /></div>");
										$(".tempMagicPop .isi").html(tsp1[1]);
										var isiWid = $(".tempMagicPop .isi").width();
										var isiHei = $(".tempMagicPop .isi").height();
										if($.browser.safari){ bodyelem = $("body"); } else{ bodyelem = $("html,body"); }
										var vscroll = bodyelem.scrollTop()+70;
										$(".magicPopup").html("");
										$(".magicPopup").animate({ "width":isiWid+"px", "height":isiHei+"px", "top":"50%", "left":"50%", "margin":"-"+ (isiHei/2) +"px 0 0 -"+ (isiWid/2) +"px" }, function(){
											$(".magicPopup").html(tsp1[1]);
											$(".tempMagicPop .isi").html("");
										});
										$(".magicPopupbg").bind("click", function(){
											 dePopAction();
										});
									} else {
										var tsp2 = new Array();
										for (var i=0;i<tsp1.length;i++) {
											tsp2 = tsp1[i].split("$$");
											$("."+tsp2[0]).html(tsp2[1]);
										}
									}
								}
							});
						}
						$("#iusername").bind("blur", function(){
							var username = $.trim($(this).val());
							if (username!="") {
								$.ajax({
									type: "GET",
									url: "/'.adminFolder.'/_ajax/ajax_members.php",
									data: "a=randpass",
									success: function(resp){
										$("#ipassword").val(resp);
									}
								});
							}
						});
						function showQuickErr(errMsg) {
							$("#quick-err").html(errMsg);
							//$("#iusername").val("");
							//$("#ipassword").val("");
							$("#iusername").focus();
						}
					</script>');
					
				cout('</div>');
			cout('</div>');
		}
		###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
*/
require(root."/".adminFolder."/_tpl/footer.php");
require(root."/".adminFolder."/_tpl/tag_html_b.php");
?>