<!DOCTYPE html>
<html>
<head>
    <style>
       html, body {
            overflow: hidden;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            background-color: #ffffcc;
            font-family: Verdana;
        }
        #renderCanvas {
            width: 100%;
            height: 100%;
			touch-action: none;
        }
    </style>
    <meta charset="utf-8"/>

    <title>SoaScape - ArchiMate Canvas</title>
    <script src="web/babylon.js"></script>
    <script src="web/babylon.gui.min.js"></script>
	<script src="web/SoaScape2Archi3D.js"></script>	
	<script src="web/forms.js"></script>	
	<script src="web/billboards.js"></script>	
	<script src="web/actions.js"></script>
	<script src="web/page.js"></script>
	<script>
		//	
		var _currAgent, _currFile, _domain;	
		
		function resizeCanvas0() {
			resizeCanvas();
			//createScene();
		}	
		
		function resizeCanvas() {
			var canvas = document.getElementById('renderCanvas');
			var canvasDiv = document.getElementById('panelX');
			canvas.width = canvasDiv.clientWidth;
			canvas.height = canvasDiv.clientHeight;
		}

		function getQueryString(field, url) {
			var href = url ? url : window.location.href;
			var reg = new RegExp('[?&]' + field + '=([^&#]*)', 'i');
			var string = reg.exec(href);
			return string ? string[1] : null;
		}		
		function getOutlineFile(cAgent) {
			var arry = cAgent.split("_^");
			console.log(cAgent + "  ..  " + arry[0]);
			return arry[0].trim();
		}
		function pageLoaded() {
		_currAgent = getQueryString("agent");
		if(_currAgent) _currAgentClean = getOutlineFile(_currAgent);
		_currFile = getQueryString("file");		
		//alert("pageLoaded >>" + _currFile);
		var dom = getQueryString("domain");
		if (dom) _domain = dom; else _domain = "_outline";
		pageLoad1();
		resizeCanvas();
		window.onbeforeunload = null;
		}	
		function pageLoad1() {
			var path;
			if (_currAgent) {
				path = "./../dependencies/" + _domain + "/" + _currAgent + ".json";
			} else {
				if (_currFile) path = "./../dependencies/~files/" + _currFile + ".json";
			}
			//alert("pageLoad1 >>" + path);
			renderLargeLocal(path);
		}
	</script>
</head>
<body style="" onload="pageLoaded()" onresize="resizeCanvas0()">

	<div style="height:100%">
		<canvas id="renderCanvas" draggable="false"></canvas>
	</div> 
</body>
</html>