<div class="BodyContainer">

<script type="text/javascript">
	var req;

	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else {
		req = new ActiveXObject('Microsoft.XMLHTTP')
	}

	function doCallback(data)
	{
		var url = '%%GLOBAL_pathToKB%%/admin/index.php?ToDo=doIndexAttachment';
		if (!req) {
			return false;
		}

		document.body.style.cursor = 'wait';
		var bar = document.getElementById('progressbar');
		ToggleDisplay(bar);
		document.getElementById('start').style.display = 'none';
		document.getElementById('message').style.display = 'none';

		req.onreadystatechange = processReqChange;
		req.open('POST', url, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.send(data);
	}

	function processReqChange() {
		if (req.readyState == 1) {
			document.getElementById('progresstext').innerHTML = '<br />Your articles\' attachments is being indexed. Please wait...<br /><br />';
		}
		// only if req shows 'loaded'
		if (req.readyState == 4) {
			// only if 'OK'
			if (req.status == 200) {
				IndexFinished(req.responseXML);
			} else {
				alert('There was a problem retrieving the XML data:\n' +
					req.responseText);
			}
			document.body.style.cursor = 'default';
			var bar = document.getElementById('progressbar');
			ToggleDisplay(bar);
		}
	}

	function IndexFinished(data)
	{
		var root = data.documentElement;
		if (root) {
			var percent = '';
			var feedback = '';
			for (j = 0; j < root.attributes.length; j++) {
				switch (root.attributes[j].nodeName) {
					case 'percent':
						percent = root.attributes[j].value;
						break;
					case 'feedback':
						feedback = root.attributes[j].value;
						break;
				}
			}

			document.location = '%%GLOBAL_pathToKB%%/admin/index.php?ToDo=indexDone&file=' + feedback;
		}
	}
	
	function StartBackup() {
		var inputs = document.getElementsByTagName('INPUT');
		var url = '';
		for(var i = 0; i < inputs.length; ++i) {
			if(inputs[i].type == "submit" || inputs[i].type == "button" || ((inputs[i].type == "checkbox" || inputs[i].type == "radio") && inputs[i].checked == false) || inputs[i].offsetHeight == 0)
				continue;
				url += '&'+inputs[i].name+'='+inputs[i].value;
		}
		tb_show('', 'index.php?ToDo=indexAttachmentsInit'+url+'&keepThis=true&TB_iframe=tue&height=180&width=450&modal=true', '');
	}

</script>

<form method="post" onsubmit="return false" action="">
<table class="OuterPanel" cellspacing="0" cellpadding="0" border="0">
<tr>
	<td class="Heading1">%%LNG_IndexAttachments%%</td>
</tr>
<tr>
	<td>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr id="message">
			<td>
				<div class="Intro" style="display:%%GLOBAL_ShowBackupButton%%">
				<br />
				%%GLOBAL_AttachmentIndexingIntroMessage%%
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<br />
				%%GLOBAL_Message%%
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<td>
		<div style="display: %%GLOBAL_ShowBackupButton%%">
			<div id="progress">
				<div id="summary" style="margin-top:-10px">
				<!--<div class="Intro">%%GLOBAL_totalFiles%%</div>-->
					<ul>
						%%GLOBAL_totalExtension%%
					</ul>
				</div>
				<div id="start" style="margin-bottom: 20px" class="intro">
					<input type="button" style="width:120px;" class="BigButton" onclick="StartBackup(); return false;doCallback('start=0'); ToggleDisplay(document.getElementById('summary')); this.disabled=true;" value="%%LNG_StartIndexing%%">
				</div>
			</div>
		</div>
	</td>
</tr>
</table>
</form>

</div>