<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11">
<html>
<head>
	<title>%%LNG_AdminControlPanelTitle%%</title>
	<meta http-equiv="Content-Type" content="text/html; charset=%%GLOBAL_charset%%" />
	<style type="text/css">
		@import url("styles/styles_admin.css");
	</style>
	<!--[if IE]>
	<style type="text/css">
		@import url("Styles/ie.css");
	</style>
	<![endif]-->
	<script type="text/javascript" src="../javascript/jquery.js"></script>
	<script type="text/javascript" src="includes/general.js"></script>
	<script type="text/javascript" src="includes/menudrop.js"></script>
	<script type="text/javascript" src="includes/datepicker.js"></script>

	<script type="text/javascript" src="../javascript/iselector.js"></script>
	<script type="text/javascript" src="../javascript/thickbox.js"></script>
	<link rel="stylesheet" href="styles/thickbox.css" type="text/css" media="screen" />
	
	<script type="text/javascript" language="javascript">
		var url = 'remote.php';
		var critical_errors = "%%GLOBAL_CriticalErrors%%";
		$(document).ready(function() {
			// Are there any permissions problems?
			if(typeof(critical_errors) != 'undefined' && critical_errors == '1') {
				tb_show('', '#TB_inline?height=300&width=450&inlineId=permissionsBox&modal=true', '');
			}
		});
		
	</script>
	
</head>


<script type="text/javascript">
	function StartUpgrade()
	{
		document.getElementById('startButton').disabled = true;
		document.getElementById('startButton').value = "%%LNG_UpgradeInProgress%%";
		document.getElementById('startButton').style.color = "#AAA";

		if (document.getElementById('sstats').checked) {
			doCallback('confirm=1&sstats=1');
		} else {
			doCallback('confirm=1&sstats=0');
		}
	}

	function CancelUpgrade()
	{
		if (confirm("Are you sure? Cancelling a running upgrade may require you to restore your site from backup before beign able to attempt to upgrade again.")) {
			req.abort();
			document.getElementById('startButton').disabled = false;
		}
	}

	var req;

	function doCallback(data)
	{
		var url = '%%GLOBAL_FormAction%%';

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

		if (!req) {
			return false;
		}
		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) {
		}
		// only if req shows 'loaded'
		if (req.readyState == 4) {
			switch (req.status) {
				case 0:
				case 200:
				case 304:
					Finished(req.responseText);
					break;
				case 408:
				case 504:
					alert('request timed out');
					break;
				default:
					alert('There was a problem retrieving the XML data:\n' +
					req.responseText);
			}
		}
	}

	function Finished(text)
	{
		// If we didn't get a blank string back then do another xmlhttprequest
		// to see if we need to run any more upgrade scripts
		if (text != '') {
			if ((text.indexOf('<li>') > -1) || (text == "unfinished")) {
				//document.getElementById('upgradeList').innerHTML = text + document.getElementById('upgradeList').innerHTML;
				doCallback('confirm=1');
			} else if (text == "finished") {
				document.location.href = "index.php?ToDo=upgradeFinish";
			}
		}
	}

	function sizeBox() {
		var w = $(window).width();
		$('#box').css('position', 'absolute');
		$('#box').css('left', w/2-($('#box').width()/2));
	}

	$(document).ready(function() {
		sizeBox();
		$('#username').focus();
	});


</script>

<div id="box">
	<br /><br /><br /><br />
	<table><tr><td style="border:solid 2px #DDD; padding:20px; background-color:#FFF; width:450px">
	<table>
	  <tr>
		<td class="Heading1">
			<img src="images/logo.jpg" />
		</td>
	  </tr>
	  <tr>
		<td style="padding:10px 0px 5px 0px">
			<div style="display: %%GLOBAL_HideUpgradeWelcome%%">
				<strong>%%LNG_UpgradeInterspireKnowledgeManager%%</strong>
				<p>%%LNG_TargetVersionDesc%% %%GLOBAL_TargetVersion%%</p>
				<p>%%LNG_UpgradeWelcomeStart%%</p>
				<p>
					<label><input type="checkbox" name="sendServerDetails" id="sstats" value="1" checked="checked" style="vertical-align: middle;" /> %%LNG_SendAnonStats%%</label>
					<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="alert('%%LNG_ServerDetailsInfo%%')" style="color:gray">%%LNG_WhatWillBeSent%%</a>
				</p>

				<input type="submit" id="startButton" value="%%LNG_StartUpgrade%%" class="FormButton Field150" onclick="StartUpgrade();">
			</div>
		</td>
	  </tr>
	</table>
	</td></tr></table>
	<div style="padding:10px; margin-bottom:20px; text-align:center">%%GLOBAL_Copyright%%</div>
</div>
<div id="permissionsBox" style="display:none">
		<div style="background-image:url('images/permissions_error.gif'); background-position:right bottom; background-repeat:no-repeat; height:100%">%%GLOBAL_PermissionErrors%%</div>
</div>
</body>

</html>
