<div class="BodyContainer">

	<script type="text/javascript" language="javascript">
		function ConfirmCancel()
		{
			if (confirm('%%LNG_CancelMessage%%')) {
				document.location.href='index.php?ToDo=viewGroups';
			} else {
				return false;
			}
		}

		function toggleAllCheckboxes(check)
		{
			formObj = check.form;
			for (var i=0;i < formObj.length;i++) {
				fldObj = formObj.elements[i];
				if (fldObj.type == 'checkbox') {
					fldObj.checked = check.checked;
				}
			}
		}

		function toggleSomeCheckboxes(check, startOfName)
		{
			formObj = check.form;
			for (var i=0;i < formObj.length;i++) {
				fldObj = formObj.elements[i];
				if (fldObj.type == 'checkbox') {
					if (fldObj.name.substr(0, startOfName.length) == startOfName.toLowerCase()) {
						fldObj.checked = check.checked;
					}
				}
			}
		}

		function checkSomeCheckboxes(startOfName)
		{
			formObj = document.getElementById('frmAddGroup');
			for (var i=0;i < formObj.length;i++) {
				fldObj = formObj.elements[i];
				if (fldObj.type == 'checkbox') {
					if (fldObj.name.substr(0, startOfName.length) == startOfName.toLowerCase()) {
						fldObj.checked = true;
					}
				}
			}
		}

		function uncheckSomeCheckboxes(startOfName)
		{
			formObj = document.getElementById('frmAddGroup');
			for (var i=0;i < formObj.length;i++) {
				fldObj = formObj.elements[i];
				if (fldObj.type == 'checkbox') {
					if (fldObj.name.substr(0, startOfName.length) == startOfName.toLowerCase()) {
						fldObj.checked = false;
					}
				}
			}
		}

		function CheckForm(f)
		{
			if (FV('name') == '') {
				alert('%%LNG_GroupNoName%%');
				$('#name').focus();
				return false;
			}

			if (FV('categories') == '') {
				alert('%%LNG_GroupNoCategory%%');
				$('#categories').focus();
				return false;
			}

			return true;
		}

		function checkBackendAccess(opt) {
			if (opt == "1") {
				$("#backendAccess").css("display","none");
			} else {
				$("#backendAccess").css("display","block");
			}
		}

	</script>

	<form action="index.php?ToDo=%%GLOBAL_FormAction%%" onSubmit="return CheckForm(this)" name="frmAddGroup" id="frmAddGroup" method="post">
	%%GLOBAL_hiddenFields%%
	<table class="OuterPanel" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td class="Heading1">%%GLOBAL_GroupTitle%%</td>
	</tr>
	<tr>
		<td class="Intro">
			<div>%%GLOBAL_GroupIntro%%</div>
			<div>
				<input type="submit" name="SubmitButton1" value="%%LNG_Save%%" class="FormButton">
				<input type="button" name="CancelButton1" value="%%LNG_Cancel%%" class="FormButton" onClick="ConfirmCancel()">
			</div>
		</td>
	</tr>
	<tr>
		<td>
		%%GLOBAL_Message%%
		</td>
	</tr>
	<tr>
		<td>
			<table class="Panel">
			<tr>
				<td class="Heading2" colspan="2">%%LNG_GroupDetails%%</td>
			</tr>
			<tr>
				<td width="150" align="left" class="FieldLabel"><span class="required">*</span> %%LNG_GroupName%%:</td>
				<td><input type="text" name="name" id="name" value="%%GLOBAL_name%%" class="Field250"></td>
			</tr>
			<tr>
				<td width="150" align="left" class="FieldLabel">&nbsp;&nbsp;&nbsp;%%LNG_GroupContactable%%:</td>
				<td align="left">
					<input type="checkbox" name="contactable" id="contactable" value="1" class="Field" %%GLOBAL_YesContactable%%>
					<label for="contactable">%%LNG_YesGroupContactable%%</label>
					<img onMouseOut="HideHelp(this)" onMouseOver="ShowHelp(this, '%%LNG_GroupContactable%%', '%%LNG_GroupContactableHelp%%')" src="images/help.gif" width="24" height="16" border="0" alt="help">
				</td>
			</tr>
			</table>

			<table class="Panel">
			<tr>
				<td class="Heading2" colspan="2">%%LNG_GroupType%%</td>
			</tr>
			<tr>
				<td width="150" align="left" class="FieldLabel"><span class="required">*</span> %%LNG_GroupType%%:</td>
				<td>
					<input type="radio" name="feonly" value="1" id="feonly1" onclick="checkBackendAccess(1);" %%GLOBAL_feonly1%% /><label for="feonly1">%%LNG_FrontendOnly%%</label><br />
					<input type="radio" name="feonly" value="0" id="feonly0" onclick="checkBackendAccess(0);" %%GLOBAL_feonly0%% /><label for="feonly0">%%LNG_FrontendAndBackEnd%%</label>
				</td>
			</tr>
			</table>

			<table class="Panel">
			<tr>
				<td class="Heading2" colspan="2">%%LNG_GroupAppliesTo%%</td>
			</tr>
			<tr>
				<td width="150" align="left" valign="top" style="padding-top: 5px;"  class="FieldLabel">
					<span class="required">*</span> %%LNG_GroupAppliesTo%%:
				</td>
				<td valign="top">
					<select id="categories" name="appliesto[]" class="Field300 ISSFormat ISSelectReplacement" multiple="multiple"  size="20" multiple >
						<option value="-1" %%GLOBAL_AllSelected%%>%%LNG_AllCategoriesOnly%%</option>
						%%GLOBAL_appliestooptions%%
					</select>
					<img onmouseout="HideHelp(this)" onmouseover="ShowHelp(this, '%%LNG_GroupAppliesTo%%', '%%LNG_GroupAppliesToHelp%%')" src="images/help.gif" width="24" height="16" border="0" alt="help" align="top">
				</td>
			</tr>
			<tr>
				<td class="Gap" colspan="2">&nbsp;</td>
			</tr>
			</table>

			<div id="backendAccess">
			%%GLOBAL_Grid%%

			</div>

			<table class="Panel">
			<tr>
				<td valign="top" colspan="2" style="padding-left: 190px"  class="ClearGap">
					<br />
					<input type="submit" name="SubmitButton2" value="%%LNG_Save%%" class="FormButton">
					<input type="button" name="CancelButton2" value="%%LNG_Cancel%%" class="FormButton" onClick="ConfirmCancel()">
				</td>
			</tr>
			</table>
		</td>
	</tr>
	</table>
	</form>

	<script>checkBackendAccess(%%GLOBAL_GroupFE%%);</script>

</div>