	// Hilfe-Fenster-Breite: xx
	// Hilfe-Fenster-Hoehe: yy
	// Hilfe-Fenster-Hoehe: change_yy (nur fuer die Berechnung zum Klappen nach oben)
	// Abstand des Hilfe-Fenters zur Maus: dx, dy
    // -----------------------------------------------------------------------
	var dx = 40;
	var dy = 70;
	var x = 0;
	var xx = 20;
	var yy = 44;
	var change_yy = 20;
	var y = 0;
	var showit = 0;
	var firstrun = true;

    // Welcher Browser?
    // ----------------
    ns = (document.layers)? true:false
	ne6= (navigator.appVersion.substring(0,1) >= 5 && navigator.appName == "Netscape")? true:false
    ie4 = (document.all)? true:false
    ie5 = false;
    if (ie4) {
    	if (navigator.userAgent.indexOf('MSIE 5')>0) {
    		ie5 = true;
    	}
    }
	
   // Welche Plattform? bei IE auf MAC keine Hilfe-Fenster
   // ---------------------------------------------------
	if ( navigator.platform.substring(0,3).toUpperCase() == "MAC" && (ie4 || ie5) )  
	{
	   mac = true;
	   } else {
	   mac = false;
	   }

	
	
	
    if ( (ns) || (ie4) || ne6 ) {
    	if (ns) {
			windowHeight = 'window.innerHeight'
			windowWidth = 'window.innerWidth'
			leftScrolled = 'window.pageXOffset'
			topScrolled = 'window.pageYOffset'
			x_correction = 0
			over = document.infoDiv
		}
		if (ne6) { 
			windowHeight = 'window.innerHeight'
			windowWidth = 'window.innerWidth'
			leftScrolled = 'window.pageXOffset'
			topScrolled = 'window.pageYOffset'
			x_correction = 0
			over = document.getElementById('infoDiv')
		}
    	if (ie4) { 
			windowHeight = 'document.body.offsetHeight'
			windowWidth = 'document.body.offsetWidth'
			leftScrolled = 'document.body.scrollLeft'
			topScrolled = 'document.body.scrollTop'
			x_correction = 20
			over = infoDiv.style
		}
    	document.onmousemove = mouseMove
    	if (ns || ne6) document.captureEvents(Event.MOUSEMOVE)
    }
	

    function wtl(txt) {
    	if (ns) {
    		var lll = document.infoDiv.document
    		lll.write(txt)
    		lll.close()
		} else if (ne6) {
    		document.getElementById('infoDiv').innerHTML = txt
    	} else {
    		if (ie4) document.all["infoDiv"].innerHTML = txt
    	}
    }


    function show(obj) {
    	if (ns) obj.visibility = "show"
		else if (ne6) obj.style.visibility = "visible"
    	else if (ie4) obj.visibility = "visible"
   }

    function hide(obj) {
    	if (ns) obj.visibility = "hide"
		else if (ne6) obj.style.visibility = "hidden"
    	else if (ie4) obj.visibility = "hidden"
    }

    function moveTo(obj,newlx,newly) {
		
		ly = newly + change_yy;
		if (navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('MSIE 6') >= 0) ly+=eval(topScrolled);
		
		lx = newlx - dx
		
		// Ausrichtung in x-Richtung
		tmpLx = lx
		if ( lx <= 10 ) lx = lx - (-xx) + 2*dx
		if ( lx + xx + 10 >= eval(windowWidth) ) lx = eval(windowWidth) - xx - x_correction 
		if ( tmpLx + xx >= eval(windowWidth) ) lx = tmpLx 
		if ( eval(leftScrolled) >= lx ) lx = eval(leftScrolled)
		
		// Ausrichtung in y-Richtung
		//if ( ly - eval(topScrolled) <= 30 ) ly =  eval(topScrolled)
		if ( ly + change_yy +40 >= eval(windowHeight) + eval(topScrolled) ) ly = ly - change_yy - dy//ly =  eval(topScrolled)

		
		// Passt der Hilfe-Fenster in den Frame? wenn nicht: fenster 40 hoch, 300 breit und oben ausrichten
		//if ( eval(windowHeight) <= change_yy - 10 ) { xx = 300; yy = 40; ly = 2; }
		
		// Hilfe-Fenster positionieren
		if (ne6) {
			obj.style.left = lx
			obj.style.top = ly //- dy
		} else {
    		obj.left = lx
    		obj.top = ly //- dy
		}
    }


    function hideit() {
    	if (mac) {return;}
		
		if ( (ns) || (ie4) || ne6 )  {
    		showit = 0;
    		hide(over);
    	}
    }
	
	
	// Title-Tags der Images loeschen
    // ------------------------------	
	function deleteTitles() {
		firstrun = false;
		for (i=0 ; i < document.images.length ; i++) {
			if ( document.images[i].name.substring(0,5) == 'info' ) {document.images[i].title = ''}
		}
	}


    // Hilfe-Popup zusammenstellen
    // ---------------------------
    function rpopi(text) {
		// Passt der Hilfe-Fenster in den Frame?
		if ( eval(windowHeight) <= change_yy - 10 ) { xx = 300; yy = 40; }
		
    	txt = "<TABLE _WIDTH="+xx+" BORDER=0 CELLPADDING=1 CELLSPACING=0 class=\"table_popi\"><TR><TD height=5><spacer type=block width=1 height=1></TD></TR><TR><TD><TABLE HEIGHT="+yy+" WIDTH=100% BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR=\"#ffffff\"><TR><TD VALIGN=TOP><!--<SPAN ID=\"thetext2\" class=blautext><nobr>Siedlungsgebiet:<br>--><FONT COLOR=\"#333333\" size=2>"+text+"</FONT></nobr><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
       	wtl(txt);
    	display_it();
    }


	function popi(infotext) {
		if (mac) {return;}
		if (firstrun && !ns ) {deleteTitles();}
		rpopi(infotext);
    }


    // Hilfe-Popup anzeigen
    // ---------------------
    function display_it() {
    	if ( (ns) || (ie4) || ne6 ) {
    		if (showit == 0) 	{
    			moveTo(over,x-(-xx),y);
    			show(over);
    			showit = 1;
    		}
    	}
    }


    // Auf Mausbewegungen reagieren
    // ----------------------------
    function mouseMove(e) {
    	if (ns || ne6) { x=e.pageX; y=e.pageY; }
    	if (ie4) { x=event.x; y=event.y; }
    	if (ie5) { x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop; }
    	if (showit) {
    		moveTo(over,x-(-xx),y);
    	}
    }
