// JavaScript Document
function show(id) {
var d = document.getElementById(id);
	for (var i = 0; i<=10; i++) {
		if (document.getElementById('menu'+i)) {
			document.getElementById('menu'+i).style.display='none';
		}
		if (document.getElementById('liste'+i)) {
			document.getElementById('liste'+i).className='liste';
		}
		var nummer = 'menu'+i;
		if (id==nummer) {
			document.getElementById('liste'+i).className='listeaktiv';
		} 
	}
if (d) {d.style.display='block';}
}

function navi(nummer) { 
  var contentNode = dojo.byId("navi");
  dojo.xhrGet( {
	// The following URL must match that used to test the server.
	url: "navi.inc.php?nav="+nummer, 
	handleAs: "text",

	// The LOAD function will be called on a successful response.
	load: function(data,args){
		// fade out the node we're modifying
		dojo.fadeOut({
			node: contentNode,
			onEnd: function(){
			  // set the data, fade it back in
			  contentNode.innerHTML = data; 
			  dojo.fadeIn({
				node: contentNode,
				onEnd:show('menu0')
				}).play();    
			}
		}).play();
	},

	// The ERROR function will be called in an error case.
	error: function(response, ioArgs) {
	  console.error("HTTP status code: ", ioArgs.xhr.status);
	  return response;
	  }
	});	
}

function page(seite) { 
  var contentNode = dojo.byId("inhalt");
  dojo.xhrGet( {
	// The following URL must match that used to test the server.
	url: seite+".inc.php", 
	handleAs: "text",

	// The LOAD function will be called on a successful response.
	load: function(data,args){
		// fade out the node we're modifying
		dojo.fadeOut({
			node: contentNode,
			onEnd: function(){
			  // set the data, fade it back in
			  contentNode.innerHTML = data; 
			  dojo.fadeIn({node: contentNode}).play();    
			}
		}).play();
	},

	// The ERROR function will be called in an error case.
	error: function(response, ioArgs) {
	  console.error("HTTP status code: ", ioArgs.xhr.status);
	  return response;
	  }
	});	
}

function seite(page){
	
	new Request.HTML({
		url: page+'.inc.php',
		method: 'get',
		update: 'inhalt',
		evalScripts: true
	}).send();
	
}

function bild_oben(bild) {
	var contentNode = dojo.byId("info_rechts_oben");
	
	
	dojo.fadeOut({
			node: contentNode,
			onEnd: function(){
			  // set the data, fade it back in
			  contentNode.innerHTML = "<img src='bilder/icons/"+bild+".png' />";
			  dojo.fadeIn({node: contentNode}).play();    
			}
		}).play(); 
}
function bild_unten(bild) {
	var contentNode = dojo.byId("info_rechts_unten");
	
	
	dojo.fadeOut({
			node: contentNode,
			onEnd: function(){
			  // set the data, fade it back in
			  contentNode.innerHTML = "<img src='bilder/aufbau/"+bild+".png' />";
			  dojo.fadeIn({node: contentNode}).play();    
			}
		}).play(); 
}

function map(map) {
	dojo.byId("map").innerHTML= "<img src=bilder/karten/"+map+".png />";
}