<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Jsaurus0</title>

		<!--	
		This work is licensed under the Creative Commons Attribution 2.5 License.

		To view a copy of this license, visit:
			http://creativecommons.org/licenses/by/2.5/

		or send a letter to:
			Creative Commons
			543 Howard Street, 5th Floor
			San Francisco, California, 94105, USA.

		All copies and derivatives of this source must contain the license statement 
		above and the following attribution:

		Author: Kyle Scholz      http://kylescholz.com/
		Copyright: 2006
		-->
		
		<!-- JSViz Libraries -->
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/Thesaurus.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/ThesaurusNode.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/ThesaurusRelation.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/Controller.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/ParticleSystem.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/Particle.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/HTMLRenderer.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/Timer.js"></script>
		<script language="JavaScript" src="http://www.cpoet.net/jsaurus/0.1/example/EventHandler.js"></script>

		<script language="JavaScript">
			/**
			*
			*/
			function getFrameWidth()
			{
				var width;
				if (document.all)
				{
					width = document.body.offsetWidth - 5;
				}
				else
				{
					width = window.innerWidth - 5;
				}
				
				return width;
			}
			
			/**
			*
			*/
			function getFrameHeight()
			{
				var height;
				if (document.all)
				{
					height = document.documentElement.offsetHeight - 5;
				}
				else
				{
					height = window.innerHeight - 5;
				}
				
				return height;
			}
			
			function init() 
			{
				/*Create controller create a thesaurus with nodes and relations later*/
				var controller = new Controller();				
				
				/*Get the dimension of the frame. The dimension forms the borders of the model*/
				var framewidth = getFrameWidth();
				var frameheight = getFrameHeight();
				var framedepth = 100;
				
				/*Create a renderer what will displays the model of the thesaurus's nodes and relations*/
				var particleSystem = new ParticleSystem();
				var renderer;
				if (false)//document.implementation.hasFeature("org.w3c.dom.svg", '1.1'))
				{
					renderer = new HTMLRenderer(0, 0, framewidth, frameheight, framedepth, particleSystem);
				}
				else
				{
					renderer = new HTMLRenderer(0, 0, framewidth, frameheight, framedepth, particleSystem);
				}
				
				for (var i = 0; i < 5; i++)
				{
					var node = controller.createNode();
					controller.addNode(node);
					var mass=10;
					var xpos = Math.random()*framewidth;
					var ypos = Math.random()*frameheight;
					var zpos = Math.random()*framedepth;
					renderer.insertNode(node, mass, xpos, ypos, zpos); 
				}				
				
				var fpsTimer = new Timer(40);
				fpsTimer.register(renderer);
				fpsTimer.start();
			}

				
		</script>
		
		
	</head>
	<body onload="init()"> 
		<!--<form onsubmit="searcher.search(document.getElementById('artistName').value);return(false);">
		<table id="titlebar">

			<tr>
				<td>Artist: <input type="text" id="artistName"> <input type="submit" value="Search"></td>
				<td align="right">Music Recommendations with JSViz</td>
			</tr></table>
		</form>
		<div id="artistResults"></div>-->
	</body>

</html>
