<div class="row">
	<div class="col-sm-12">
		<h4 class="page-title">{% lang 'ViewUsers' %}</h4>
		<p>{{ UserIntro|safe }}</p>
		{{ Message|safe }}
		{{ FlashMessages|safe }}
	</div>
</div>

<div class="row">
	<div class="col-sm-12">
		<input type="button" name="IndexCreateButton" value="{% lang 'CreateUser' %}" id="IndexCreateButton" class="Button btn btn-primary" onclick="document.location.href='index.php?ToDo=createUser'" />
		<input type="button" name="IndexDeleteButton" value="{% lang 'DeleteSelected' %}" id="IndexDeleteButton" class="SmallButton btn btn-danger" onclick="ConfirmDeleteSelected()" {{ DisableDelete|safe }} />
	</div>
</div>
<br />
<div class="row">
	<div class="col-sm-12">
		<form name="frmUsers" id="frmUsers" action="index.php?ToDo=deleteUsers" method="post">
			<div class="GridContainer">
				{{ UserDataGrid|safe }}
			</div>
		</form>
	</div>
</div>

<script type="text/javascript">
	function ToggleDeleteBoxes(Status){
		var fp = document.getElementById("frmUsers").elements;

		for(i = 0; i < fp.length; i++){
			if(fp[i].value != 1)
				fp[i].checked = Status;
		}
	}

	function ConfirmDeleteSelected(){
		var fp = document.getElementById("frmUsers").elements;
		var c = 0;

		for(i = 0; i < fp.length; i++){
			if(fp[i].type == "checkbox" && fp[i].checked)
				c++;
		}

		if(c > 0) {
			if(confirm("{% lang 'ConfirmDeleteUsers' %}"))
				document.getElementById("frmUsers").submit();
		}else{
			alert("{% lang 'ChooseUser' %}");
		}
	}
</script>