

function init(){
  //document.onselectstart = function(){ return false; };
  window.onresize = fittosize;
  $("qboxmap").onclick=setqbox;
  $("highlightael").onclick=suchinfo;
  $("highlightfl").onclick=suchinfo;
  $("highlightflgl").onclick=suchinfo;
  $("highlightgl").onclick=suchinfo;
  $("highlightkgfl").onclick=suchinfo;
  $("highlightkg").onclick=suchinfo;
  $("highlightkggl").onclick=suchinfo;
  $("highlightkz").onclick=suchinfo;
  $("highlightunknown").onclick=suchinfo;

  //$('maparea').ondblclick=zeiggauss;
  $("maparea").onmousedown = startmove;
  $("maparea").onmouseup = stopmove;
  $("maparea").onmouseout = stopmove;
  $("maparea").onmousemove = mmove;
  $("zoom"+aktzoom).checked="checked";

  init_locator();
  fittosize();
  mainloop();
  moving = -1;
}

function fittosize(){
  winwidth = self.innerWidth || document.body.clientWidth || document.documentElement.clientWidth;
  winheight = self.innerHeight || document.body.clientHeight || document.documentElement.clientHeight;

  // fix right/bottom aligned elements in IE
  $('footer').style.top = (winheight - $('footer').offsetHeight)+"px";
  $('navi').style.left = (winwidth - $('navi').clientWidth)+"px";
  $('weissewand').style.height = (winheight-$('header').clientHeight - $('footer').clientHeight)+"px";
  
  if( resultson ) $('lagerliste').style.height = (winheight-findPos($('lagerliste'))[1]-$('footer').clientHeight) + "px";
  
  initmap();
}

/** utility functions */ 

function $(id){
  return document.getElementById(id);
}

function removeAllChildren( node ){
  while( node.childNodes.length > 0 ){
    node.removeChild( node.firstChild );
  }
}

// find an element's absolute position on the page
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

