<div class="BodyContainer">
	<form action="%%GLOBAL_FormAction%%" method="POST" onsubmit="return checkForm(this);">
	<table class="OuterPanel" id="outerpanel" cellspacing="0" cellpadding="0" border="0" width="100%">
	<tr>
		<td class="Heading1">%%LNG_AdvancedCommentSearch%%</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td class="Intro">
					<div>
					%%LNG_AdvancedCommentSearchIntro%%
					</div>
				</td>
			</tr>
			<tr>
				<td>
				%%GLOBAL_Message%%
				</td>
			</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<input type="submit" value="Search" class="formbutton">
			<input type="button" onclick="ConfirmCancel()" class="FormButton" value="Cancel" name="CancelButton1"/>
		</td>
	</tr>
	<tr>
		<td class="gap">&nbsp;</td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					<table class="Panel">
					<tr>
						<td class="Heading2" colspan="2">%%LNG_AdvancedCommentSearch%%: </td>
					</tr>
					<tr>
						<td class="FieldLabel">%%LNG_Keyword%%: </td>
						<td>
							<input name="q" id="q" class="Field308" value="%%GLOBAL_SearchQuery%%">
						</td>
					</tr>
					<tr>
						<td class="FieldLabel">%%LNG_Categories%%: </td>
						<td>
							<select name="categories[]" class="Field308" size="10" multiple="multiple">
								%%GLOBAL_CategoryOptions%%
							</select>
						</td>
					</tr>
					<tr>
						<td class="FieldLabel">%%LNG_Posted%%: </td>
						<td>
							<select name="postedop" class="Field175">
								%%GLOBAL_postedOp%%
							</select>
							<input type="text" id="posted" name="posted" value="%%GLOBAL_posted%%" size="10" class="Field75" style="margin-left: 4px;" readonly="readonly">
							<img src="images/calbtn.gif" align="top" width="34" height="22" alt="toggle calendar" onclick="toggleCal();" style="margin-left: 4px;">
							<span id="postedCal" style="display: none; position: absolute; margin-left: 5px;"></span>
						</td>
					</tr>
					<tr>
						<td class="FieldLabel">%%LNG_Status%%: </td>
						<td>
							<select name="status" class="Field308">
								<option id="all" value="all" %%GLOBAL_StatusAllChecked%%>%%LNG_AllStatuses%%</option>
								<option id="approved" value="approved" %%GLOBAL_StatusApprovedChecked%%>%%LNG_Approved%%</option>
								<option id="disapproved" value="disapproved" %%GLOBAL_StatusDisapprovedChecked%%>%%LNG_Disapproved%%</option>
								<option id="pending" value="pending" %%GLOBAL_StatusPendingChecked%%>%%LNG_Pending%%</option>
							</select>
<!--							<input type="radio" id="all" name="status" value="all" %%GLOBAL_StatusAllChecked%%><label for="all">%%LNG_All%%</label>
							<input type="radio" id="approved" name="status" value="approved" %%GLOBAL_StatusApprovedChecked%%><label for="approved">%%LNG_Approved%%</label>
							<input type="radio" id="disapproved" name="status" value="disapproved" %%GLOBAL_StatusDisapprovedChecked%%><label for="disapproved">%%LNG_Disapproved%%</label>
							<input type="radio" id="pending" name="status" value="pending" %%GLOBAL_StatusPendingChecked%%><label for="pending">%%LNG_Pending%%</label>-->
						</td>
					</tr>
					<tr>
						<td class="gap"></td>
					</tr>
					<tr>
						<td>
							&nbsp;
						</td>
						<td>
							<input type="submit" value="Search" class="formbutton">
							<input type="button" onclick="ConfirmCancel()" class="FormButton" value="Cancel" name="CancelButton1"/>
						</td>
					</tr>
					<tr>
						<td colspan="2" class="gap"></td>
					</tr>
					</table>
				</td>
			</tr>
			</table>
		</td>
	</tr>
	</table>
	</form>

	<script type="text/javascript">
		function checkForm(f)
		{
			return true;
		}

		function toggleCal()
		{
			if (document.getElementById('postedCal').style.display == 'inline') {
				document.getElementById('postedCal').style.display = 'none';
			} else {
				document.getElementById('postedCal').style.display = 'inline';
				document.getElementById('postedCal').style.position = 'absolute';
			}
		}

		function updateDate()
		{
			if (dp.getDate() == null) {
				document.getElementById('posted').value = '';
				// We dont need to delay hiding the cal here since they are
				// deselecting the date
				toggleCal();
			} else {
				document.getElementById('posted').value = getFullISODateString(dp.getDate());
				if (dp.getDate().getMonth() == lastMonth) {
					setTimeout('toggleCal()', 100);
				}
			}
		}

		function ConfirmCancel()
		{
			if(confirm('%%LNG_CancelMessage%%')) {
				document.location.href='index.php?ToDo=viewComments';
			} else {
				return false;
			}
		}

		window.onload = function ()
		{
			// When the page loads we need to setup the date picker
			document.getElementById('postedCal').appendChild(dp.create());
			dp.onchange = updateDate;

			// We also want the focus to go to the search box
			document.getElementById('q').focus();
		}

		// Make the days of the week capital letters
		DatePicker.days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];

		if ("%%GLOBAL_jsPosted%%" == '') {
			var dp = new DatePicker(null);
		} else {
			var d = new Date(%%GLOBAL_jsPosted%%);
			var dp = new DatePicker(d);
		}

		if (dp.getDate() != null) {
			var lastMonth = dp.getDate().getMonth();
		} else {
			var today = new Date();
			var lastMonth = today.getMonth();
		}


	</script>
</div>