

function MausInfoField() {

	var infoField = null;
	var IE6 = false;
	var IE = false;
	var xfieldSwitch = 0;
	var yfieldSwitch = 0;

	var posx = 0;
	var posy = 0;

	if(navigator.appVersion.match(/MSIE 6/)) IE6 = true;
	if(navigator.appVersion.match(/MSIE/)) IE = true;

	init();

	this.reInit = function() {init();}
	function init() {
		//Div f�r infos wird in den DOM geshrieben
		var body = document.getElementsByTagName("BODY");
		body = body[0];
		var div = document.createElement("div");
		div.setAttribute("id","lstInfoField");
		div.setAttribute("style","top:0px; left: 0px; z-index:10000;");
		if(!document.getElementById("lstInfoField")) {
			body.appendChild(div);
		}

		infoField = document.getElementById("lstInfoField");
		infoField.style.position = "absolute";

		var tags = Array("A","IMG","DIV", "SPAN", "AREA");


		for(var z=0; z < tags.length; z++) {
			var elemente = document.getElementsByTagName(tags[z]);
			for(var i=0; i < elemente.length; i++) {
				if(elemente[i].getAttribute("set") == "mausInfo") {
					elemente[i].onmousemove= zeigeInfo;
					//elemente[i].onmouseout = versteckeInfo;
					elemente[i].style.cursor = "pointer";
				}
			}
		}

		/*
		var elemente = document.getElementsByTagName("IMG");
		for(var i=0; i < elemente.length; i++) {
			if(elemente[i].getAttribute("set") == "mausInfo") {
				elemente[i].onmouseover= zeigeInfo;
				elemente[i].onmouseout = versteckeInfo;
				elemente[i].style.cursor = "pointer";
			}
		}
		*/

		document.onmousemove= setMousePosition;
	}

	// Wird zum verstecken des Mausinfofeldes �ber der Landakarte verwendet
	this.versteckeInfo = function(dasEreignis) {
		var meinEreignis = dasEreignis || window.event;
		var ereignisQuelle = meinEreignis.target || meinEreignis.srcElement;

		//infoField.style.visibility = "hidden";
		infoField.style.display = "none";

		if(false) {
			setTimeout(function() {
				infoField.style.display = "none";
			}, 400);
		}
	}

	//Zeigt nach Event das MausInfofeld �ber der Landkarte
	function zeigeInfo(dasEreignis) {
		var meinEreignis = dasEreignis || window.event;
		var ereignisQuelle = meinEreignis.target || meinEreignis.srcElement;

		var infoWidth = ereignisQuelle.getAttribute("infoWidth");
		if(infoWidth == null) infoWidth = "230";

		if( ereignisQuelle.getAttribute("alt") == null &&
			ereignisQuelle.getAttribute("infoTarget")== null) {
			return;
		}

		var content = ereignisQuelle.getAttribute("alt");

		//Content aus anderem Node holen. Gegeben durch Attribute: infoTarget
		if(ereignisQuelle.getAttribute("infoTarget")!="") {
			var tID = ereignisQuelle.getAttribute("infoTarget");
			var el = document.getElementById(tID);
			if(el){
				content = el.innerHTML;
			}
		}

		infoField.style.display = "none";

		var inhalt = "";
		if(IE6)inhalt += '<div style="position:absolute; z-index:99;">'
		inhalt +=  '<table id="infoTable" width="'+infoWidth+'"  height="100%" border="0" cellspacing="0" cellpadding="0" >';
		inhalt +=  '	<tr>';
		inhalt +=  '		<td height="15">';
		inhalt +=  '			<div class="info_tbBack_topLeft pngtrans"></div>';
		inhalt +=  '				<div id="infoTop" class="info_tbBack_top pngtrans" ></div>';
		inhalt +=  '			<div class="info_tbBack_topRight pngtrans"></div>';
		inhalt +=  '		</td>';
		inhalt +=  '	</tr>';
		inhalt +=  '	<tr >';
		inhalt +=  '		<td height="100%" valign="top">';
		inhalt +=  '			<div class="info_tbBackLeft pngtrans">';
		inhalt +=  '			<div class="info_tbBackRight pngtrans">';
		inhalt +=  '				<div id="infoBack" class="info_tbBack pngtrans">';
		inhalt +=  '					<div id="infoContent" class="info_content">' + content + '</div>';
		inhalt +=  '				</div>';
		inhalt +=  '			</div>';
		inhalt +=  '			</div>';
		inhalt +=  '		</td>';
		inhalt +=  '	</tr>';
		inhalt +=  '	<tr>';
		inhalt +=  '		<td height="10">';
		inhalt +=  '			<div style="position:relative;">';
		inhalt +=  '				<div class="info_tbBack_bottomLeft pngtrans"></div>';
		inhalt +=  '					<div id="infoFoot" class="info_tbBack_bottom pngtrans"></div>';
		inhalt +=  '				<div class="info_tbBack_bottomRight pngtrans"></div>';
		inhalt +=  '			</div>';
		inhalt +=  '		</td>';
		inhalt +=  '	</tr>';
		inhalt +=  '</table>';
		if(IE6)inhalt +=  '</div><div id="divIframe" style="position:absolute; top:11px; left:5px; z-index:1;"><iframe id="Iframe" scrolling="no" scrollbarvisable="no" scroll="no" frameborder="0" style="width: 100%; height: 100%;"></iframe></div>';
		infoField.innerHTML = inhalt;

		setPosInfoField();


		//infoField.style.visibility = "visible";

		if(true) {
			infoField.style.display = "block";
		}else {
			setTimeout(function() {
				new Effect.Appear("lstInfoField", {duration: 0.3});
			}, 350);
		}


		if(IE6) {
			var iframe = document.getElementById("Iframe");
			var infoContent = document.getElementById("infoContent");

			var breite = infoContent.offsetWidth;
			var hoehe = infoContent.offsetHeight;
			infoField.style.display = "none";

			//alert(breite+" "+hoehe);
			iframe.style.width = (breite-20)+"px";
			iframe.style.height = (hoehe+10)+"px";
			var divIframe = document.getElementById("divIframe");
			//divIframe.style.top = "-"+(hoehe)+"px";

			//infoContent.style.zIndex = "100";
			infoField.style.display = "block";
		}

	}


	function setMousePosition(ereignis) {
		posx = (document.all) ? window.event.clientX + document.documentElement.scrollLeft : ereignis.pageX;
		posy = (document.all) ? window.event.clientY + document.documentElement.scrollTop  : ereignis.pageY;
		setPosInfoField();
	}

	//Setzt die Position des MausInfofeldes ()ist position der Maus)
	function setPosInfoField() {

		var windowHeight = (document.all)? document.body.clientHeight : window.innerHeight;
		var windowWidth = (document.all)? document.body.clientWidth : window.innerWidth;

		var dimension = getWindowSize();
		windowWidth = dimension[0];
		windowHeight = dimension[1];


		var breite = infoField.offsetWidth;
		var hoehe = infoField.offsetHeight;
		var test = 0;


		if(posx > (windowWidth-breite+20) ) {
			xfieldSwitch = 1;
		}
		else {
			xfieldSwitch = 0;
		}
		//xfieldSwitch = 0;

		//alert( (posy - hoehe) );

		if( (posy - hoehe) > 10) {
			yfieldSwitch = 1;
		}else {
			yfieldSwitch = 0;
		}
		//yfieldSwitch = 1;


		if(yfieldSwitch==1) {
			try {
				document.getElementById("infoTop").style.backgroundPosition = "0px 38px";
				document.getElementById("infoFoot").style.backgroundPosition = "right 41px";
				document.getElementById("infoFoot").style.height = "15px"

				if(xfieldSwitch==1) {
					infoField.style.left = (posx)-breite+50+"px";
				}else {
					document.getElementById("infoFoot").style.backgroundPosition = "0px 16px";
					infoField.style.left = (posx)-40+"px";
				}


				infoField.style.top = (posy-hoehe)-10+"px";
				return;
			}catch(e){}

		}else {
			try {
				document.getElementById("infoTop").style.backgroundPosition = "";
				document.getElementById("infoFoot").style.backgroundPosition = "";
				document.getElementById("infoFoot").style.height = "11px"

				infoField.style.left = (posx)-40+"px";
				infoField.style.top = (posy)+20+"px";
			}catch(e){}
		}


		if(xfieldSwitch==1) {
			try {
				document.getElementById("infoTop").style.backgroundPosition = "right 16px";
				//document.getElementById("infoFoot").style.backgroundPosition = "0px 22px";
				//document.getElementById("infoFoot").style.height = "15px"

				infoField.style.left = (posx)-breite+50+"px";
				//infoField.style.top = (posy-hoehe)-8+"px";
				return;
			}catch(e){}

		}else {
			try {
				document.getElementById("infoTop").style.backgroundPosition = "";
				//document.getElementById("infoFoot").style.backgroundPosition = "";
				//document.getElementById("infoFoot").style.height = "10px"

				infoField.style.left = (posx)-40+"px";
				//infoField.style.top = (posy)+20+"px";
			}catch(e){}
		}

	}

	function getWindowSize() {
		  var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth;
		    myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myWidth = document.documentElement.clientWidth;
		    myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    myWidth = document.body.clientWidth;
		    myHeight = document.body.clientHeight;
		  }
		  return Array(myWidth, myHeight);
	}
}
