<form action="index.php?ToDo=deleteCustomerGroups" id="frmCustomerGroups" name="frmCustomerGroups" method="post" onSubmit="return ValidateForm(ConfirmDeleteSelected)">
	<div class="row">
		<div class="col-sm-12">
			<h4 class="page-title">{% lang 'CustomerGroups' %}</h4>
			<p>{% lang 'CustomerGroupsIntro' %}</p>
			{{ Message|safe }}
		</div>
	</div>

	<div class="row">
		<div class="col-sm-12">
			<input type="button" value="Criar Grupo" class="btn btn-primary" onclick="document.location.href='index.php?ToDo=createCustomerGroup'" {{ DisableAdd|safe }} />
			<input type="button" name="CancelButton1" value="{% lang 'DeleteSelected' %}" class="btn btn-danger" onclick="ConfirmDeleteSelected()" {{ DisableDelete|safe }} />
		</div>
	</div>
	<br />

	<div class="row">
		<div class="col-sm-12">
			<div class="GridContainer">
				{{ CustomerGroupsDataGrid|safe }}
			</div>
		</div>
	</div>
</form>

<script type="text/javascript">
	function ToggleDeleteBoxes(Status){
		var fp = document.getElementById("frmCustomerGroups").getElementsByTagName('input');

		for (var i=0; i < fp.length; i++) {
			if (!fp[i].getAttribute('disabled'))
				fp[i].checked = Status;
		}
	}

	function ConfirmDeleteSelected()
	{
		var fp = document.getElementById("frmCustomerGroups").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 'ConfirmDeleteCustomerGroups' %}")) {
				return true;
			}else {
				return false;
			}
		}else{
			alert("{% lang 'ChooseCustomerGroup' %}");
			return false;
		}
	}
</script>