	// event handling
        var links = null, display = null;
        dojo.addOnLoad(function(){
            links = dojo.widget.byId("links");
            display = dojo.widget.byId("display");

            // listen to links domNode for onclick event
            // lowercased on all DOM events as opposed to widget events
            dojo.event.connect(links.domNode, "onclick", 'relayClicks');
            //dojo.event.connect(display.domNode, "onclick", 'relayClicks');
        });

        // finds out if this is a link event
        function relayClicks(evt){
            var node = evt.target;
            if(node.nodeName.toLowerCase() == "a"){
		var id = node.id;
		evt.preventDefault();
		display.setUrl(node.href);
            }
        }
	
	function menuClick(nav, page)   // nav = advisory, company, development, ref, sitemap
	{
		display.setUrl(page);
		document.getElementById('advisory').style.display = "none";
		document.getElementById('company').style.display = "none";
		document.getElementById('development').style.display = "none";
		document.getElementById('ref').style.display = "none";
		dojo.widget.byId("sitemap").hide();
		if ( nav == "sitemap" ) {
			dojo.widget.byId("sitemap").show();
		}
		else {	
			if ( nav != '' ) {
				var a = document.getElementById(nav);
				a.style.display = "inline";
			}
		}
	}
	
	// pending message:  show / hide loading dialog
	function dialogHandler(e, show){
		var dialog = dojo.widget.byId("statusDialog");
		if(show){
			e.preventDefault();
			dialog.show();
			return;
		}
		dialog.hide();
	}
	// display loading dialog or use built in "Loading..." message
	function contentDownloadStart(e){
		var chkbox = dojo.byId("defaultLoadInfo");
		if(chkbox && chkbox.checked){
			// use built in
			return;
		}
		dialogHandler(e, true);
	}
	
	// ------------------------------ tool ----------------------------
	
	function showSummary()
	{
		var summary = dojo.widget.byId("summary");
		summary.show();
	}	
	function hideSummary()
	{
		var summary = dojo.widget.byId("summary");
		summary.hide();
	}
	function showCalc()
	{
		var calc = dojo.widget.byId("calc");
		calc.show();
	}
	function showUmrechnung()
	{
		var umrechnung = dojo.widget.byId("umrechnung");
		umrechnung.show();
	}
	function showPse()
	{
		var pse = dojo.widget.byId("pse");
		pse.show();
	}
	function showPlot()
	{
		var plot = dojo.widget.byId("plot");
		plot.show();
	}
	function showSoftware()
	{
		var software = dojo.widget.byId("software");
		software.show();
	}
	
	function displayPse (Name, Number, Weight, Melt, Freeze) {
		document.table.name.value=Name;
		document.table.number.value=Number;
		document.table.weight.value=Weight;
		document.table.melt.value=Melt;
		document.table.freeze.value=Freeze;
	}
	
	function drawCurve(curve,steps,className) {
		if(!className) className = "pixel";
		if(!steps) steps = 100;
		this.pixels = new Array(steps)
		for(var i=0;i<steps;i++) {
			var pt = curve.getValue(i/steps);
			this.pixels[i] = document.createElement("div");
			this.pixels[i].className = className;
			this.pixels[i].style.left = pt[0];
			this.pixels[i].style.top = pt[1];
			document.body.appendChild(this.pixels[i]);
		}
	}
	
	var tick;
	function clockStop() {
	   clearTimeout(tick);
	}
	function clock() {
	   var jetzt = new Date();
	   var mo = jetzt.getMonth();
	   var y = jetzt.getYear();
	   if (y < 999)
	    y += 1900;
	   var d = jetzt.getDate();
	   var ut=new Date();
	   var h,m,s;
	   var time="        ";
	   h=ut.getHours();
	   m=ut.getMinutes();
	   s=ut.getSeconds();
	   if(s<=9) s="0"+s;
	   if(m<=9) m="0"+m;
	   if(h<=9) h="0"+h;
	   time+=d+"."+( mo + 1) +"."+y+" " +h+":"+m+":"+s;
	   document.getElementById('clock').innerHTML=time;
	   tick=setTimeout("clock()",1000);    
	}
	
	
	// ----------------------- init -----------------------------
	dojo.addOnLoad( init);
	
	function init()
	{
	/*
		// zeichen kurve zusammengesetzt
		var p = new dojo.math.curves.Path();
		p.add(new dojo.math.curves.Line([10,10], [100,100]), 5);
		p.add(new dojo.math.curves.Line([0,0], [20,0]), 2);
		p.add(new dojo.math.curves.CatmullRom([[0,0], [400,400], [200,200], [500,50]]), 50);
		p.add(new dojo.math.curves.Arc([0,0], [100,100]), 20);
		p.add(new dojo.math.curves.Arc([0,0], [100,100], true), 20);
		//drawCurve(p, 200, "pixel");
		
		// kreis
		//drawCurve(new dojo.math.curves.Arc([300,300], [700,200]), 500, "pixel");
		
		
		
		var surface = dojo.gfx.createSurface('shape', 300, 300);
		// this is an example to split the linearGradient from setFill:
		var lg = {
			type: "linear",
			x1: 0, y1: 0, x2: 75, y2: 50,
			colors: [
				{ offset: 0, color: "#F60" },
				{ offset: 1, color: "#FF6" }
			]
		};
		var rect = { x: 0, y: 0, width: 100, height: 100 };
		// rechteck mit farbverlauf
		//surface.createRect(rect).setFill(lg).setTransform({ dx: 40, dy: 100 });
		
		// rotes rechteck
		//surface.createRect(rect).setFill('#ff0000');
		
		var poly_rect = surface.createRect(rect);
		poly_rect.setFill([255, 0, 0, 0.5]);
		//poly_rect.setStroke({color: "blue", width: 1, join: "round" });
		var shape = document.getElementById("shape");
		
	
		//poly_rect.setTransform({ dx: 100, dy: 100 });
		var b = new dojo.math.curves.Bezier([[0],[0.05],[0.1],[0.9],[0.95],[1]]);
		var li = new dojo.math.curves.Line([100,20], [600, 20]);
		fa = new dojo.animation.Animation(li, 2000, b, -1);
		dojo.event.connect(fa, "onAnimate", function(e) {
			with(document.getElementById("shape").style) {
				left = e.x + "px";
				top = e.y + "px";
			}
		});
		fa.play(true);
*/
/*
		fa.handler = function(e) {
			switch(e.type) {
				case "play":
					dojo.html.setOpacity(shape, 1);
					break;
				case "animate":
					shape.style.left = e.x + "px";
					shape.style.top = e.y + "px";
					break;
				case "end":
					break;
			}
		}
		fa.play();
		*/
		
		// animation punkt
		// repeats forever (4th arg of -1)
		Circle = dojo.math.curves.Circle;
		Line = dojo.math.curves.Line;
		// var line = new Line([200,200], [400, 20]);
		//c = new dojo.animation.Animation(new Circle([500,120], 40), 1000, 0, -1);
		
		//var l = new Line([100,20], [600, 20]);
		/*
		var b = new dojo.math.curves.Bezier([[0],[0.05],[0.1],[0.9],[0.95],[1]]);
		//var c = new dojo.math.curves.CatmullRom([[0,0], [400,400], [200,200], [500,50], [0,0]]);
		var c = new dojo.math.curves.CatmullRom([ [47,0], [34,2],[23,7],[15,12],[11,19],[5,28],[1,40],[0,50],[2,62],[6,71],[10,78],[16,84],[25,90],[36,95],[50,96],[60,95],[56,88],[52,80],[48,72],[38,71],[28,66],[20,60],[13,48],[11,48],[14,24],[20,13],[28,6],[36,2],[47,0] ] );
		
		ca = new dojo.animation.Animation(c, 12000, b, -1);
		
		
		dojo.event.connect(ca, "onAnimate", function(e) {
			with(document.getElementById("circ").style) {
				left = e.x + "px";
				top = e.y + "px";
			}
		});		
		ca.play(true);
		*/
		
	}

