<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="robots" content="all" />
	<title>Be Book</title>
	<link rel="stylesheet" type="text/css" href="../Haiku-doc.css" />
	<script type="text/javascript">
		var offLineWelcomePage = 'file:///boot/system/documentation/BeBook/index.html';
		var onLineWelcomePage = 'https://www.haiku-os.org/legacy-docs/bebook/';

		var xmlhttp;
		function redirect() {
			xmlhttp = new XMLHttpRequest();
			xmlhttp.onreadystatechange = redirect_ReadyStateChange;
			try {
				xmlhttp.open("GET", offLineWelcomePage);
				xmlhttp.send(null);
			} catch (err) {
				window.location = onLineWelcomePage;
			}
		}

		function redirect_ReadyStateChange() {
			if (xmlhttp.readyState == 4) { // 4 = "loaded"
				if (xmlhttp.status == 200 || xmlhttp.status == 0) {
					// 200 = "OK"; loading from file:// so no http status set! hence status == 0.
					if (xmlhttp.responseText.length != 0)
						window.location = offLineWelcomePage;
					else
						window.location = onLineWelcomePage;
				} else {
					alert("Problem retrieving data:" + xmlhttp.statusText);
				}
			}
		}
	</script>
</head>
<body onload="redirect()">
</body>
</html>
