var bMaximized = false;

function MM_preloadImagesMeinung() { //v3.0
	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
		
		var i,j=d.MM_p.length,a=MM_preloadImagesMeinung.arguments;
		for(i=0; i<a.length; i++)  {
			if (a[i].indexOf("#")!=0) { 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
		}
	}
}

function StartOne (strDivID) {
	// siehe StartAll() -> hier aber nur mit einem Div
	xAktElement = document.getElementById(strDivID);
	nMaxBewegung = 0;
	nSetTimeOut = 0;
	nAktIndex = -1;
	
	for (i=0; i < arrDivElements.length; i++) {
		arrAktTemp = arrDivElements[i];
		if (strDivID == arrAktTemp[0]) {
			nMaxBewegung = arrAktTemp[1];
			nSetTimeOut = arrAktTemp[2];
			nAktIndex = i;
			i = arrDivElements.length + 100;
		}
	}
	
	strRahmenWidth = getRahmenSize (arrAktTemp[0]);
	arrRahmenWidth = strRahmenWidth.split(",");
	
	nRahmenWidth = arrRahmenWidth[0];
	nRahmenHeight = arrRahmenWidth[1];

	strElementWidth = xAktElement.style.width;
	strElementWidth = parseInt( strElementWidth.replace("px","") );
	
	strElementHeight = xAktElement.style.height;
	strElementHeight = parseInt( strElementHeight.replace("px","") );
	
	nMaxBewegungWidth = parseInt(nRahmenWidth) - parseInt(strElementWidth);
	nMaxBewegungHeight = parseInt(nRahmenHeight) - parseInt(strElementHeight);
	
//	alert("One: " + nMaxBewegungWidth + ".." + nMaxBewegungHeight);

	if (nMaxBewegung == 0) nMaxBewegung = 20;
	if (nSetTimeOut == 0) nSetTimeOut = 150;
	
	nAktPosition = getPosition (xAktElement, nMaxBewegung, nMaxBewegungWidth, nMaxBewegungHeight);
	arrOldKoordinaten = new Array();
	arrOldKoordinaten[0] = xAktElement.style.top;
	arrOldKoordinaten[0] = arrOldKoordinaten[0].replace("px","");
	if (isNaN(arrOldKoordinaten[0]) ) arrOldKoordinaten[0] = 0;
	if (arrOldKoordinaten[0] < 0) arrOldKoordinaten[0] = 0;
	
	arrOldKoordinaten[1] = xAktElement.style.left;
	arrOldKoordinaten[1] = arrOldKoordinaten[1].replace("px","");
	if (isNaN(arrOldKoordinaten[1]) ) arrOldKoordinaten[1] = 0;
	if (arrOldKoordinaten[1] < 0) arrOldKoordinaten[1] = 0;
	
	nNewWinkel = getWinkel (xAktElement, nAktPosition);
	arrNewKoordinaten = getZiel (xAktElement, nAktPosition, nNewWinkel, nMaxBewegung, nMaxBewegungWidth, nMaxBewegungHeight);
	arrAktTemp[3] = false;
	arrDivElements[nAktIndex] = arrAktTemp;
	
	StartMove(xAktElement, arrOldKoordinaten, arrNewKoordinaten, nSetTimeOut, nMaxBewegung, nAktIndex, nAktPosition, nMaxBewegungWidth, nMaxBewegungHeight);
}

function StartAll() {
	bStop = false;
	
	for (mainI=0; mainI < arrDivElements.length; mainI++) {
		arrAktTemp = arrDivElements[mainI];
		
		// Maximale Bewegung und Timeout (ms) wird aus Array ausgelesen
		nAktDiv = document.getElementById(arrAktTemp[0]);
		nAktPosition = getPosition (nAktDiv);
		nMaxBewegung = arrAktTemp[1];
		nSetTimeOut = arrAktTemp[2];
		
		strRahmenWidth = getRahmenSize (arrAktTemp[0]);
		arrRahmenWidth = strRahmenWidth.split(",");
		
		nRahmenWidth = arrRahmenWidth[0];
		nRahmenHeight = arrRahmenWidth[1];
		
		// aktuelle Koordinaten des Div ermitteln
		arrOldKoordinaten = new Array();
		arrOldKoordinaten[0] = nAktDiv.style.top;
		arrOldKoordinaten[0] = arrOldKoordinaten[0].replace("px","");
		if (isNaN(arrOldKoordinaten[0]) ) arrOldKoordinaten[0] = 0; 
		if (arrOldKoordinaten[0] < 0) arrOldKoordinaten[0] = 0;
		
		arrOldKoordinaten[1] = nAktDiv.style.left;
		arrOldKoordinaten[1] = arrOldKoordinaten[1].replace("px","");
		if (isNaN(arrOldKoordinaten[1]) ) arrOldKoordinaten[1] = 0; 	
		if (arrOldKoordinaten[1] < 0) arrOldKoordinaten[1] = 0;
		
		strElementWidth = nAktDiv.style.width;
		strElementWidth = parseInt( strElementWidth.replace("px","") );
		
		strElementHeight = nAktDiv.style.height;
		strElementHeight = parseInt( strElementHeight.replace("px","") );
		
		nMaxBewegungWidth = nRahmenWidth - strElementWidth;
		nMaxBewegungHeight = nRahmenHeight - strElementHeight;
		
		// Neuer Winkel und neue Koordinaten werden ermittelt
		nNewWinkel = getWinkel (nAktDiv, nAktPosition);
		arrNewKoordinaten = getZiel (nAktDiv, nAktPosition, nNewWinkel, nMaxBewegung, nMaxBewegungWidth, nMaxBewegungHeight);

		arrAktTemp[3] = false; // aktuelles Div bewegt sich
		arrDivElements[mainI] = arrAktTemp;
		
		// Funktionsaufruf StartMove -> Schrittlängen ermitteln
		StartMove(nAktDiv, arrOldKoordinaten, arrNewKoordinaten, nSetTimeOut, nMaxBewegung, mainI, nAktPosition, nMaxBewegungWidth, nMaxBewegungHeight);
	}
}

function StartMove(AktDiv, arrOldCoords, arrNewCoords, nSetTimeOut, nMaxBew, nAktIndex, nAktPos, nMaxBewegungWidth, nMaxBewegungHeight) {
	if (AktDiv.id == "DivElement3a") alert("1");
	
	var nDeltaTop = 0; nDeltaLeft = 0;
	var strSchrittrichtungTop = 0, strSchrittrichtungLeft = 0;
	// alert("StartMove Old: " + arrOldCoords + " ==> New: " + arrNewCoords + " ++ " + nMaxBewegungWidth + ", " + nMaxBewegungHeight);
	// alter Top-Wert grösser als der neue Top-Wert
	if (parseInt(arrOldCoords[0]) > parseInt(arrNewCoords[0])) {
		// Bewegung geht nach oben
		nDeltaTop = parseInt(arrOldCoords[0]) - parseInt(arrNewCoords[0]);
		strSchrittrichtungTop = "--";
	}
	// alter Top-Wert kleiner als der neue Top-Wert
	if (parseInt(arrOldCoords[0]) < parseInt(arrNewCoords[0])) {
		// Bewegung geht nach unten
		nDeltaTop = parseInt(arrNewCoords[0]) - parseInt(arrOldCoords[0]);
		strSchrittrichtungTop = "++";
	}
	if (arrOldCoords[0] == arrNewCoords[0]) {
		// Bewegung geht nach links / rechts
		nDeltaTop = 0;
		strSchrittrichtungTop = "";
	}
	
	// alter Left-Wert grösser als der neue Left-Wert
	if (parseInt(arrOldCoords[1]) > parseInt(arrNewCoords[1])) {
		// Bewegung geht nach links
		nDeltaLeft = parseInt(arrOldCoords[1]) - parseInt(arrNewCoords[1]);
		strSchrittrichtungLeft = "--";
	}
	// alter Left-Wert kleiner als der neue Left-Wert
	if (parseInt(arrOldCoords[1]) < parseInt(arrNewCoords[1]) ) {
		// Bewegung geht nach unten
		nDeltaLeft = parseInt(arrNewCoords[1]) - parseInt(arrOldCoords[1]);
		strSchrittrichtungLeft = "++";
	}
	if (arrOldCoords[1] == arrNewCoords[1]) {
		// Bewegung geht nach unten / oben
		nDeltaLeft = 0;
		strSchrittrichtungLeft = "";
	}

	nHypotenuse = Math.sqrt( Math.pow(nMaxBewegungWidth,2) + Math.pow(nMaxBewegungHeight, 2) );
	nSteps = 100;
	fSingleStep	= 2.5;
	nSteps = Math.round(nHypotenuse / fSingleStep) + 1;
	
	nAktWinkel = arrNewCoords[2];
	
	constRadiant = Math.PI/180;
	nTempNewWinkel = constRadiant * nAktWinkel; // Umrechnung von Winkel in Radiant
	
	strAllSteps = "";

	if (strSchrittrichtungTop == "" && strSchrittrichtungLeft == "++") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = 0;
			b = fSingleHypotenuse;
			
			nNewTop = parseInt(arrOldCoords[0]) + parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) + parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			
			if (nNewLeft > nMaxBewegungWidth) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	if (strSchrittrichtungTop == "" && strSchrittrichtungLeft == "--") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = 0;
			b = fSingleHypotenuse;
			
			nNewTop = parseInt(arrOldCoords[0]) + parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) - parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			
			if (nNewLeft < 0) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	
	if (strSchrittrichtungTop == "++" && strSchrittrichtungLeft == "++") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = Math.round(Math.sin(nTempNewWinkel) * fSingleHypotenuse);
 			b = Math.round(Math.cos(nTempNewWinkel) * fSingleHypotenuse);
			
			nNewTop = parseInt(arrOldCoords[0]) + parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) + parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " Old: " +arrOldCoords[0] + ", " + arrOldCoords[1] + " ==> New: " + nNewTop + "," + nNewLeft + " MaxH: " + nMaxBewegungHeight + "-- MaxW: " + nMaxBewegungWidth);
			
			if (nNewTop > nMaxBewegungHeight || nNewLeft > nMaxBewegungWidth) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	
	if (strSchrittrichtungTop == "--" && strSchrittrichtungLeft == "++") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = Math.round(Math.cos(nTempNewWinkel) * fSingleHypotenuse);
			b = Math.round(Math.sin(nTempNewWinkel) * fSingleHypotenuse);
			
			nNewTop = parseInt(arrOldCoords[0]) - parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) + parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			
			if (nNewTop < 0 || nNewLeft > nMaxBewegungWidth) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	
	if (strSchrittrichtungTop == "++" && strSchrittrichtungLeft == "--") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = Math.round(Math.cos(nTempNewWinkel) * fSingleHypotenuse);
			b = Math.round(Math.sin(nTempNewWinkel) * fSingleHypotenuse);
			
			nNewTop = parseInt(arrOldCoords[0]) + parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) - parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			if (nNewTop > nMaxBewegungHeight || nNewLeft < 0) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	
	if (strSchrittrichtungTop == "--" && strSchrittrichtungLeft == "--") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = Math.round(Math.sin(nTempNewWinkel) * fSingleHypotenuse);
			b = Math.round(Math.cos(nTempNewWinkel) * fSingleHypotenuse);
			
			nNewTop = parseInt(arrOldCoords[0]) - parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) - parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			if (nNewTop < 0 || nNewLeft < 0) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	
	if (strSchrittrichtungTop == "++" && strSchrittrichtungLeft == "") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = fSingleHypotenuse;
			b = 0;
			
			nNewTop = parseInt(arrOldCoords[0]) + parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) + parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			if (nNewTop > nMaxBewegungHeight) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	if (strSchrittrichtungTop == "--" && strSchrittrichtungLeft == "") {
		for (i=1; i < nSteps+1; i++) {
			fSingleHypotenuse = fSingleStep * i;
			a = fSingleHypotenuse;
			b = 0;
			
			nNewTop = parseInt(arrOldCoords[0]) - parseInt(a);
			nNewLeft = parseInt(arrOldCoords[1]) + parseInt(b);
//			alert(strSchrittrichtungTop + "--" + strSchrittrichtungLeft + " ==> " + nNewTop + ".." + nNewLeft);
			if (nNewTop < 0) { 
				i = nSteps+10;
			} else {
				if (strAllSteps != "") strAllSteps = strAllSteps + ";";
				strAllSteps = strAllSteps + nNewTop + "," + nNewLeft;
			}
		}
	}
	
	var nSchrittweiteTop = 0, nSchrittweiteLeft = 0;
	nSchrittweiteTop = nDeltaTop / nSteps;
	nSchrittweiteLeft = nDeltaLeft / nSteps;
	
	fAktTopValue = parseInt(arrOldCoords[0]);
	fAktLeftValue = parseInt(arrOldCoords[1]);
	
	nOldTop = arrOldCoords[0];
	nOldLeft = arrOldCoords[1];
	
	nZielTop = arrNewCoords[0];
	nZielLeft = arrNewCoords[1];
	// rekursive Funktion BewegDich wird gestartet
	BewegDich(AktDiv.id, nOldTop, nOldLeft, nZielTop, nZielLeft, nSchrittweiteTop, strSchrittrichtungTop, fAktTopValue, nSchrittweiteLeft, strSchrittrichtungLeft, fAktLeftValue, nSetTimeOut, nAktIndex, strAllSteps, 0, nMaxBewegungWidth, nMaxBewegungHeight);
}

function BewegDich (tempDivID, nOldTop, nOldLeft, nZielTopParam, nZielLeftParam, nSchrittweiteTop, strSchrittrichtungTop, fAktTopValue, nSchrittweiteLeft, strSchrittrichtungLeft, fAktLeftValue, nSetTime, nAktInd, strSteps, nAktStep, nMaxBewegungWidth, nMaxBewegungHeight) {
	if (arrDivElements[nAktInd][3]) {
		window.setTimeout("BewegDich ('" + tempDivID + "', " + nOldTop + ", " + nOldLeft + ", " + nZielTopParam + ", " + nZielLeftParam + ", " + nSchrittweiteTop + ", '" + strSchrittrichtungTop + "', " + fAktTopValue + ", " + nSchrittweiteLeft + ", '" + strSchrittrichtungLeft +"', " + fAktLeftValue + ", " + nSetTime + ", " + nAktInd + ", '" + strSteps + "', " + nAktStep + ", " + nMaxBewegungWidth + ", " + nMaxBewegungHeight + ")", nSetTime);
	} else {
		xElementBeweg = document.getElementById(tempDivID);
	//	alert("xElementBeweg  " + xElementBeweg + " Bew. " + nMaxBewegungWidth + ", " + nMaxBewegungHeight);
		
		// aktuelle Koordinaten des Div werden ermittelt
		arrAktCoords = new Array();
		arrAktCoords[0] = xElementBeweg.style.top;
		arrAktCoords[0] = parseInt(arrAktCoords[0].replace("px",""));
		if (isNaN(arrAktCoords[0]) ) arrAktCoords[0] = 0;
		if (arrAktCoords[0] < 0) arrAktCoords[0] = 0;
		
		arrAktCoords[1] = xElementBeweg.style.left;
		arrAktCoords[1] = parseInt(arrAktCoords[1].replace("px",""));
		if (isNaN(arrAktCoords[1]) ) arrAktCoords[1] = 0;
		if (arrAktCoords[1] < 0) arrAktCoords[1] = 0;
		
		nAktTop = parseInt(arrAktCoords[0]); if (isNaN(nAktTop) ) nAktTop = 0;
		nZielTop = parseInt(nZielTopParam); if (isNaN(nZielTop) ) nZielTop = 0;
		nNewTop = 0;
		
		nAktLeft = parseInt(arrAktCoords[1]); if (isNaN(nAktLeft) ) nAktLeft = 0;
		nZielLeft = parseInt(nZielLeftParam); if (isNaN(nZielLeft) ) nZielLeft = 0;
		
		nNewLeft = 0;
		arrAllSteps = strSteps.split(";");
		if (parseInt(nAktStep) < arrAllSteps.length) {
			strAktKoord = arrAllSteps[nAktStep];
			arrAktKoord = strAktKoord.split(",");
			nNewTop = arrAktKoord[0];
			nNewLeft = arrAktKoord[1];
		} else {
			nNewTop = nAktTop;
			nNewLeft = nAktLeft;
		}
		if (isNaN(nNewTop) || nNewTop == "" ) nNewTop = nAktTop;
		if (isNaN(nNewLeft) || nNewLeft == "" ) nNewLeft = nAktLeft;
		//	alert(nNewTop + " > " + (parseInt(nOldTop) + parseInt(nMaxBewegungHeight) ) );
	
		if (nNewTop > parseInt(nMaxBewegungHeight) ) nNewTop = parseInt(nMaxBewegungHeight);
		if (nNewLeft > parseInt(nMaxBewegungWidth) ) nNewleft = parseInt(nMaxBewegungWidth);
		
		if (isNaN(nNewTop) ) nNewTop = nAktTop;
		if (isNaN(nNewLeft) ) nNewLeft = nAktLeft;
		
		if (nNewTop < 0) nNewTop = 0;
		if (nNewLeft < 0) nNewLeft = 0;
		
		// alert(nNewTop + ".." + nNewLeft);
		nAktStep++;
	//		alert("2" + nNewTop + " .. " + nNewLeft + " - Element: " + xElementBeweg);
		if (isNaN(nNewTop) || isNaN(nNewLeft) ) { 
			nAktStep = arrAllSteps.length+10; 
		} else {
			if (xElementBeweg != null) {
				// aktuelles Div wird an die neu berechneten Koordinaten gesetzt
				if (isNaN(nNewTop) ) alert("as");
				xElementBeweg.style.top = nNewTop + "px";
				xElementBeweg.style.left = nNewLeft + "px";
			}
		}
		// wenn entweder die Left-Koordinaten oder die Top-Koordinaten noch nicht erreicht sind, wird die "BewegDich"-Funktion erneut aufgerufen
		if (parseInt(nAktStep) < arrAllSteps.length && (nNewTop != nZielTop || nNewLeft != nZielLeft) ) {
			window.setTimeout("BewegDich ('" + tempDivID + "', " + nOldTop + ", " + nOldLeft + ", " + nZielTopParam + ", " + nZielLeftParam + ", " + nSchrittweiteTop + ", '" + strSchrittrichtungTop + "', " + fAktTopValue + ", " + nSchrittweiteLeft + ", '" + strSchrittrichtungLeft +"', " + fAktLeftValue + ", " + nSetTime + ", " + nAktInd + ", '" + strSteps + "', " + nAktStep + ", " + nMaxBewegungWidth + ", " + nMaxBewegungHeight + ")", nSetTime);
		} else {
			// wenn das aktuelle Div sich auf den Zielkoordinaten befindet, wird eine neue Bewegung initialisiert
			arrDivElements[nAktInd][3] = true; // aktuelles Div-Bewegt sich nicht
			window.setTimeout("StartOne ('" + tempDivID + "')", 10);
		}
	}
}


function getRahmenSize (strAktDiv) {	
	strAktRules = "";
	strAktRahmen = strAktDiv.replace("DivElement", "DivRahmen");
	strWidth = document.getElementById(strAktRahmen).style.width;
	strWidth = parseInt(strWidth.replace("px", "") );
	
	strHeight = document.getElementById(strAktRahmen).style.height;
	strHeight = parseInt(strHeight.replace("px", "") );
	
	strReturn = strWidth + "," + strHeight;
	return strReturn;
}
// neue Zielkoordinaten ermitteln, anhand der aktuellen Position und des neuen Winkels
function getZiel (nAktDiv, nAktPosition, nNewWinkel, nMaxBewegung, nMaxBewWidth, nMaxBewHeight) {
	// Berechnungsgrundlage -> siehe Schreibtisch Kristian
	var arrReturn = new Array();
	arrReturn[0] = 0; // top-Position
	arrReturn[1] = 0; // left-Position
	// Konstanter Wert um die Gradzahl in einen Radianten umzurechnen
	// Umrechnung notwendig, da Math.atan / Math.tan -> den Radianten und nicht die Gradzahl benötigen
	constRadiant = Math.PI/180;
	switch (nAktPosition) {
		case 1:
			nUmbruchwinkel = 135;
			
			nRadiantUmbruch = Math.atan(nMaxBewWidth / nMaxBewHeight);
			nUmbruchwinkel = Math.round(nRadiantUmbruch / constRadiant);
			if (nNewWinkel == 90 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 180) {
				switch (nNewWinkel) {
					case 90: arrReturn[0] = 0; arrReturn[1] = nMaxBewWidth; break;
					case nUmbruchwinkel: arrReturn[0] = nMaxBewHeight; arrReturn[1] = nMaxBewWidth; break;
					case 180: arrReturn[0] = nMaxBewHeight; arrReturn[1] = 0; break;
				}
			} else {
				// if (nNewWinkel == 90 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 180) {
				if (nNewWinkel < nUmbruchwinkel) {
					nNewWinkel = nNewWinkel - 90;
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempTop = Math.tan(nTempNewWinkel) * nMaxBewWidth;
					tempTop = Math.round(tempTop);
					
					arrReturn[0] = tempTop;
					arrReturn[1] = nMaxBewWidth;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				} else {
					nNewWinkel = nNewWinkel - 90;
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempTop1 = Math.tan(nTempNewWinkel) * nMaxBewHeight;
					tempTop1 = Math.round(tempTop1);
					tempTop2 = tempTop1 - nMaxBewHeight;
					tempLeft = Math.round( (nMaxBewHeight * tempTop2) / tempTop1);
					tempLeft = nMaxBewHeight - tempLeft;
					
					arrReturn[0] = nMaxBewHeight;
					arrReturn[1] = tempLeft;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				}
			
			}
			break;
		case 2:
			nUmbruchwinkel = 225;
			
			nRadiantUmbruch = Math.atan(nMaxBewWidth / nMaxBewHeight);
			nUmbruchwinkel = Math.round(nRadiantUmbruch / constRadiant);
			
			if (nNewWinkel == 180 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 270) {
				switch (nNewWinkel) {
					case 180: arrReturn[0] = nMaxBewHeight; arrReturn[1] = nMaxBewWidth; 	break;
					case nUmbruchwinkel: arrReturn[0] = nMaxBewHeight; arrReturn[1] = 0; 				break;
					case 270: arrReturn[0] = 0; 			arrReturn[1] = 0; 				break;
				}
			} else {
				// if (nNewWinkel == 180 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 270) {
				if (nNewWinkel < nUmbruchwinkel) {
					nNewWinkel = nNewWinkel - 180;
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempLeft = Math.tan(nTempNewWinkel) * nMaxBewHeight;
					tempLeft = Math.round(tempLeft);
					tempLeft = nMaxBewWidth - tempLeft;
					
					arrReturn[0] = nMaxBewHeight;
					arrReturn[1] = tempLeft;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					
				} else {
					nNewWinkel = nNewWinkel - 180;
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempLeft1 = Math.tan(nTempNewWinkel) * nMaxBewWidth;
					tempLeft1 = Math.round(tempLeft1);
					templeft2 = tempLeft1 - nMaxBewWidth;
					tempTop = Math.round( (nMaxBewWidth * templeft2) / tempLeft1);
					tempTop = nMaxBewWidth - tempTop;
					
					arrReturn[0] = tempTop;
					arrReturn[1] = 0;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				}
			}
			break;
		case 3:
			nUmbruchwinkel = 45;
			
			nRadiantUmbruch = Math.atan(nMaxBewWidth / nMaxBewHeight);
			nUmbruchwinkel = Math.round(nRadiantUmbruch / constRadiant);
			
			if (nNewWinkel == 0 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 90) {
				switch (nNewWinkel) {
					case 0:  arrReturn[0] = 0; 				arrReturn[1] = 0; 				break;
					case nUmbruchwinkel: arrReturn[0] = 0;	 			arrReturn[1] = nMaxBewWidth;	break;
					case 90: arrReturn[0] = nMaxBewHeight; 	arrReturn[1] = nMaxBewWidth; 	break;
				}
			} else {
				// if (nNewWinkel == 0 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 90) {
				if (nNewWinkel < nUmbruchwinkel) {
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempLeft = Math.tan(nTempNewWinkel) * nMaxBewHeight;
					tempLeft = Math.round(tempLeft);
					
					arrReturn[0] = 0;
					arrReturn[1] = tempLeft;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				} else {
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempLeft1 = Math.tan(nTempNewWinkel) * nMaxBewWidth;
					tempLeft1 = Math.round(tempLeft1);
					templeft2 = tempLeft1 - nMaxBewWidth;
					tempTop = Math.round( (nMaxBewWidth * templeft2) / tempLeft1);
					
					arrReturn[0] = tempTop;
					arrReturn[1] = nMaxBewWidth;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				}
			}
			break;
		case 4:
			nUmbruchwinkel = 315;
			
			nRadiantUmbruch = Math.atan(nMaxBewWidth / nMaxBewHeight);
			nUmbruchwinkel = Math.round(nRadiantUmbruch / constRadiant);
			
			if (nNewWinkel == 270 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 360) {
				switch (nNewWinkel) {
					case 270: arrReturn[0] = nMaxBewHeight; arrReturn[1] = 0; 				break;
					case nUmbruchwinkel: arrReturn[0] = 0;	 			arrReturn[1] = 0;				break;
					case 360: arrReturn[0] = 0; 			arrReturn[1] = nMaxBewWidth; 	break;
				}
			} else {
				// if (nNewWinkel == 270 || nNewWinkel == nUmbruchwinkel || nNewWinkel == 360) {
				if (nNewWinkel < nUmbruchwinkel) {
					nNewWinkel = nNewWinkel - 270;
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempTop = Math.tan(nTempNewWinkel) * nMaxBewWidth;
					tempTop = Math.round(tempTop);
					tempTop = nMaxBewWidth - tempTop
					arrReturn[0] = tempTop;
					arrReturn[1] = 0;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				} else {
					nNewWinkel = nNewWinkel - 270;
					nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
					
					tempTop1 = Math.tan(nTempNewWinkel) * nMaxBewHeight;
					tempTop1 = Math.round(tempTop1);
					tempTop2 = tempTop1 - nMaxBewHeight;
					tempLeft = Math.round( (nMaxBewHeight * tempTop2) / tempTop1);

					arrReturn[0] = 0;
					arrReturn[1] = tempLeft;
					arrReturn[2] = nNewWinkel;
					arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
				}
			}
			break;
		case 5:
			if (nNewWinkel == 0 || nNewWinkel == 90 || nNewWinkel == 180) {
				switch (nNewWinkel) {
					case   0: arrReturn[0] = 0; 					arrReturn[1] = 0; 				break;
					case  90: arrReturn[0] = arrOldKoordinaten[0];	arrReturn[1] = nMaxBewWidth;	break;
					case 180: arrReturn[0] = nMaxBewHeight; 		arrReturn[1] = 0; 				break;
				}
			} else {
				if (nNewWinkel < 90) {
					nRadiantUmbruch = Math.atan(nMaxBewWidth / arrOldKoordinaten[0]);
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = 0;
						arrReturn[1] = nMaxBewWidth;
						
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					} else {
						if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft = Math.tan(nTempNewWinkel) * arrOldKoordinaten[0];
							tempLeft = Math.round(tempLeft);
							
							arrReturn[0] = 0;
							arrReturn[1] = tempLeft;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft1 = Math.tan(nTempNewWinkel) * arrOldKoordinaten[0];
							tempLeft1 = Math.round(tempLeft1);
							
							tempLeft2 = tempLeft1 - nMaxBewHeight;
							tempTop2 = (arrOldKoordinaten[0] * tempLeft2) / tempLeft1;
							tempTop2 = Math.round(tempTop2);
								
							arrReturn[0] = tempTop2;
							arrReturn[1] = nMaxBewHeight;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden 
						}
					}
				} else {
					// if (nNewWinkel < 90) {
					nRadiantUmbruch = Math.atan(nMaxBewHeight / (nMaxBewHeight - arrOldKoordinaten[0]) );
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					
					nNewWinkel = 180 - nNewWinkel;
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = nMaxBewHeight;
						arrReturn[1] = nMaxBewWidth;
					} else {
						if (nNewWinkel > nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft1 = Math.tan(nTempNewWinkel) * (nMaxBewHeight - arrOldKoordinaten[0]);
							tempLeft1 = Math.round(tempLeft1);
							
							tempLeft2 = tempLeft1 - nMaxBewHeight;
							tempTop2 = ( (nMaxBewHeight - arrOldKoordinaten[0]) * tempLeft2) / tempLeft1;
							tempTop2 = Math.round(tempTop2);
								
							arrReturn[0] = nMaxBewHeight - tempTop2;
							arrReturn[1] = nMaxBewWidth;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft = Math.tan(nTempNewWinkel) * (nMaxBewHeight - arrOldKoordinaten[0]);
							tempLeft = Math.round(tempLeft);
							
							arrReturn[0] = nMaxBewHeight;
							arrReturn[1] = tempLeft;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						}
					}
				}
			}
			break;
		case 6:
			if (nNewWinkel == 180 || nNewWinkel == 270 || nNewWinkel == 360) {
				switch (nNewWinkel) {
					case 180 : arrReturn[0] = nMaxBewHeight; arrReturn[1] = nMaxBewWidth; break;
					case 270 : arrReturn[0] = arrOldKoordinaten[0]; arrReturn[1] = 0; break;
					case 360 : arrReturn[0] = 0; arrReturn[1] = nMaxBewWidth; break;
				}
			} else {
				if (nNewWinkel < 270) {
					nRadiantUmbruch = Math.atan(nMaxBewWidth / (nMaxBewHeight - arrOldKoordinaten[0]));
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					
					nNewWinkel = nNewWinkel - 180;
					
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = nMaxBewHeight;
						arrReturn[1] = 0;
						
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					} else {
						if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft = Math.tan(nTempNewWinkel) * (nMaxBewHeight - arrOldKoordinaten[0]);
							tempLeft = Math.round(tempLeft);
							tempLeft = nMaxBewWidth - tempLeft;
							
							arrReturn[0] = nMaxBewHeight;
							arrReturn[1] = tempLeft;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft1 = Math.tan(nTempNewWinkel) * (nMaxBewHeight - arrOldKoordinaten[0]);
							tempLeft1 = Math.round(tempLeft1);
							
							tempLeft2 = tempLeft1 - nMaxBewWidth;
							tempTop2 = ( (nMaxBewHeight - arrOldKoordinaten[0]) * tempLeft2) / tempLeft1;
							tempTop2 = Math.round(tempTop2);

							arrReturn[0] = nMaxBewHeight - tempTop2;
							arrReturn[1] = 0;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						}
					}
				} else {
					// if (nNewWinkel < 270) {
					nRadiantUmbruch = Math.atan(nMaxBewWidth / (nMaxBewHeight - arrOldKoordinaten[0]));
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					
					nNewWinkel = 360 - nNewWinkel;
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = 0;
						arrReturn[1] = 0;
						
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					
					} else {
						// if (nNewWinkel == nWinkelUmbruch) {
						if (nNewWinkel > nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempLeft1 = Math.tan(nTempNewWinkel) * (arrOldKoordinaten[0]);
							tempLeft1 = Math.round(tempLeft1);
							
							tempLeft2 = tempLeft1 - nMaxBewWidth;
							tempTop2 = ( (arrOldKoordinaten[0]) * tempLeft2) / tempLeft1;
							tempTop2 = Math.round(tempTop2);
							
							arrReturn[0] = tempTop2;
							arrReturn[1] = 0;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempLeft = Math.tan(nTempNewWinkel) * (nMaxBewHeight - arrOldKoordinaten[0]);
							tempLeft = Math.round(tempLeft);
							tempLeft = nMaxBewWidth - tempLeft;
							
							arrReturn[0] = 0;
							arrReturn[1] = tempLeft;
							
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						}
					} 
				}
			}
			break;
		case 7:
			if (nNewWinkel == 90 || nNewWinkel == 180 || nNewWinkel == 270) {
				switch (nNewWinkel) {
					case  90 : arrReturn[0] = 0;				arrReturn[1] = nMaxBewWidth;		 break;
					case 180 : arrReturn[0] = nMaxBewHeight; 	arrReturn[1] = arrOldKoordinaten[1]; break;
					case 270 : arrReturn[0] = 0; 				arrReturn[1] = 0; 					 break;
				}
			} else {
				// if (nNewWinkel == 90 || nNewWinkel == 180 || nNewWinkel == 270) {
				
				if (nNewWinkel < 180) {
					nRadiantUmbruch = Math.atan(nMaxBewHeight / (nMaxBewWidth - arrOldKoordinaten[1]));
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					
					nNewWinkel = nNewWinkel-90;
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = nMaxBewHeight;
						arrReturn[1] = nMaxBewWidth;
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					} else {
						if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							tempTop = Math.tan(nTempNewWinkel) * (nMaxBewWidth - arrOldKoordinaten[1]);
							tempTop = Math.round(tempTop);
							
							arrReturn[0] = tempTop;
							arrReturn[1] = nMaxBewWidth;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							// if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (nMaxBewWidth - arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							tempTop2 = tempTop1 - nMaxBewHeight;
							tempLeft2 = ( (arrOldKoordinaten[1]) * tempTop2) / tempTop1;
							tempLeft2 = Math.round(tempLeft2);
							
							arrReturn[0] = nMaxBewHeight;
							arrReturn[1] = nMaxBewWidth - tempLeft2;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						}
					}
				} else {
					// if (nNewWinkel < 180) {
					nRadiantUmbruch = Math.atan(nMaxBewWidth / arrOldKoordinaten[1]);
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					nNewWinkel = 270-nNewWinkel;
					
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = nMaxBewHeight;
						arrReturn[1] = 0;
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					} else {
						if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							arrReturn[0] = tempTop1;
							arrReturn[1] = 0;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							// if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							tempTop2 = tempTop1 - nMaxBewHeight;
							tempLeft2 = ( (arrOldKoordinaten[1]) * tempTop2) / tempTop1;
							tempLeft2 = Math.round(tempLeft2);
							
							arrReturn[0] = nMaxBewHeight;
							arrReturn[1] = tempLeft2;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden					
						}
					}
				}
			}
			break;
		case 8:
			if (nNewWinkel == 270 || nNewWinkel == 360 || nNewWinkel == 450) {
				switch (nNewWinkel) {
					case 270 : arrReturn[0] = nMaxBewHeight;	arrReturn[1] = 0;		 			 break;
					case 360 : arrReturn[0] = 0; 				arrReturn[1] = arrOldKoordinaten[1]; break;
					case 450 : arrReturn[0] = nMaxBewHeight; 	arrReturn[1] = nMaxBewWidth; 		 break;
				}
			} else {
				// if (nNewWinkel == 270 || nNewWinkel == 360 || nNewWinkel == 450) {
				if (nNewWinkel < 360) {
					nRadiantUmbruch = Math.atan(nMaxBewHeight / arrOldKoordinaten[1]);
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					
					nNewWinkel = nNewWinkel-270;
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = 0;
						arrReturn[1] = 0;
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					} else {
						if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							arrReturn[0] = nMaxBewHeight - tempTop1;
							arrReturn[1] = 0;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						} else {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							tempTop2 = tempTop1 - nMaxBewHeight;
							tempLeft2 = ( (arrOldKoordinaten[1]) * tempTop2) / tempTop1;
							tempLeft2 = Math.round(tempLeft2);
							
							arrReturn[0] = 0;
							arrReturn[1] = tempLeft2;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "alpha"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						}
					}
				} else {
					// if (nNewWinkel < 360) {
					nRadiantUmbruch = Math.atan(nMaxBewHeight / (nMaxBewWidth - arrOldKoordinaten[1]) );
					nWinkelUmbruch = Math.round(nRadiantUmbruch / constRadiant);
					nNewWinkel = 450 - nNewWinkel;
					if (nNewWinkel == nWinkelUmbruch) {
						arrReturn[0] = 0;
						arrReturn[1] = nMaxBewWidth;
						arrReturn[2] = nNewWinkel;
						arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
					} else {
						// if (nWinkelUmbruch == nNewWinkel) {
						if (nNewWinkel < nWinkelUmbruch) {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (nMaxBewWidth - arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							arrReturn[0] = nMaxBewHeight - tempTop1;
							arrReturn[1] = nMaxBewWidth;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden 
						} else {
							nTempNewWinkel = constRadiant * nNewWinkel; // Umrechnung von Winkel in Radiant
							
							tempTop1 = Math.tan(nTempNewWinkel) * (nMaxBewWidth - arrOldKoordinaten[1]);
							tempTop1 = Math.round(tempTop1);
							
							tempTop2 = tempTop1 - nMaxBewHeight;
							
							tempLeft2 = ( (nMaxBewWidth - arrOldKoordinaten[1]) * tempTop2) / tempTop1;
							tempLeft2 = Math.round(tempLeft2);
							
							arrReturn[0] = 0;
							arrReturn[1] = nMaxBewWidth - tempLeft2;
							arrReturn[2] = nNewWinkel;
							arrReturn[3] = "beta"; // muß dieser Winkel als alpha -> sinus oder als Beta -> cosinus verstanden werden
						}
					}
				}
				
			}
			break;
	}
	
	if (arrReturn[0] < 0) arrReturn[0] = 0;
	if (arrReturn[1] < 0) arrReturn[1] = 0;
	return arrReturn;
}



// Ermitteln des Winkels, der ausgehend von der aktuellen Position als nächstes angelegt werden soll
function getWinkel (aktDiv, nAktPosition) {
	nWinkelHoch = 0, nWinkelTief = 0;
	switch (nAktPosition) {
		case 1: 
			nWinkelHoch = 155;
			nWinkelTief = 115;
			break;
		case 2: 
			nWinkelHoch = 245;
			nWinkelTief = 205;
			break;
		case 3: 
			nWinkelHoch = 65;
			nWinkelTief = 25;
			break;
		case 4: 
			nWinkelHoch = 335;
			nWinkelTief = 295;
			break;
		case 5: 
			nWinkelHoch = 155;
			nWinkelTief = 25;
			break;
		case 6: 
			nWinkelHoch = 335;
			nWinkelTief = 205;
			break;
		case 7: 
			nWinkelHoch = 245;
			nWinkelTief = 115;
			break;
		case 8: 
			nWinkelHoch = 155;
			nWinkelTief = 25;
			break;
	}
	
	var nZufallsZahl = Math.round(Math.random() * (nWinkelHoch -  nWinkelTief)) + nWinkelTief;
	// 8 -> untere Linie (eigentlicher Winkel sind 270° - 360° -> darum wird eine Zahl von 0-180 gesucht und anschließend um 270 erhöht
	if (nAktPosition == 8) nZufallsZahl = nZufallsZahl + 270;
	return nZufallsZahl;
}

// aktuelle Position des Div wird ermittelt und der jeweilige Positionstyp (1 -> (0,0), 2 -> (20,0) usw. wird zurückgegeben
function getPosition (nAktDiv, nMaxBewegung, nMaxBewWidth, nMaxBewHeight) {
	if (nAktDiv == null) return 0;

	nAktTop = 0; nAktLeft = 0;
	nAktTop = nAktDiv.style.top;
	nAktTop = parseInt(nAktTop.replace("px", ""));
	if (isNaN(nAktTop) ) nAktTop = 0; // wenn keine Position angegeben, befindet sich das Element ganz oben
	nAktLeft = nAktDiv.style.left;
	nAktLeft = parseInt(nAktLeft.replace("px", ""));
	if ( isNaN(nAktLeft) ) nAktLeft = 0; // wenn keine Position angegeben, befindet sich das Element ganz link

	nAktTop = parseInt(nAktTop); if (isNaN(nAktTop) ) nAktTop = 0;
	nAktLeft = parseInt(nAktLeft); if (isNaN(nAktLeft) ) nAktLeft = 0;
	
	if (nAktTop == 0 && nAktLeft == 0) return 1;
	if (nAktTop == 0 && nAktLeft == nMaxBewWidth) return 2;
	if (nAktTop == nMaxBewHeight && nAktLeft == 0) return 3;
	if (nAktTop == nMaxBewHeight && nAktLeft == nMaxBewWidth) return 4;
	
	if ( (nAktTop > 0 && nAktTop < nMaxBewHeight) && nAktLeft == 0) return 5;
	if ( (nAktTop > 0 && nAktTop < nMaxBewHeight) && nAktLeft == nMaxBewWidth) return 6;

	if (nAktTop == 0 && (nAktLeft > 0 && nAktLeft < nMaxBewWidth) ) return 7;
	if (nAktTop == nMaxBewHeight && (nAktLeft > 0 && nAktLeft < nMaxBewWidth) ) return 8;
	
	// nächste ideale Position ermitteln
	nAktDiffT = 0;
	if (nAktTop > nMaxBewHeight - nAktTop) nAktDiffT = (nMaxBewHeight - nAktTop); else nAktDiffT = nAktTop;
	nAktDiffL = 0;
	if (nAktLeft > nMaxBewWidth - nAktLeft) nAktDiffL = (nMaxBewWidth - nAktLeft); else nAktDiffL = nAktLeft;
	
	if (nAktDiffT < nAktDiffL) {
		if (nAktTop > nMaxBewHeight - nAktTop) nAktTop = nMaxBewHeight; else nAktTop = 0;
	} else {
		if (nAktLeft > nMaxBewWidth - nAktLeft) nAktLeft = nMaxBewWidth; else nAktLeft = 0;
	}
	
	if (nAktTop == 0 && nAktLeft == 0) return 1;
	if (nAktTop == 0 && nAktLeft == nMaxBewWidth) return 2;
	if (nAktTop == nMaxBewHeight && nAktLeft == 0) return 3;
	if (nAktTop == nMaxBewHeight && nAktLeft == nMaxBewWidth) return 4;
	
	if ( (nAktTop > 0 && nAktTop < nMaxBewHeight) && nAktLeft == 0) return 5;
	if ( (nAktTop > 0 && nAktTop < nMaxBewHeight) && nAktLeft == nMaxBewWidth) return 6;

	if (nAktTop == 0 && (nAktLeft > 0 && nAktLeft < nMaxBewWidth) ) return 7;
	if (nAktTop == nMaxBewHeight && (nAktLeft > 0 && nAktLeft < nMaxBewWidth) ) return 8;
}
// ---> Ende der Funktionen für die Bewegung des KleinBilds innerhalb des Rahmens





// ---> Beginn der Funktionen für den Layer (Grossbild)
function StartMaximize (AktDiv, nAktuellerIndex) {
	ele = document.getElementById(AktDiv);
	coordinaten = getElementCoords(ele);
	coordinaten.x = coordinaten.x - 2;
	coordinaten.y = coordinaten.y - 5;
	
	xLayer = document.getElementById("meinungslayer");
	
	arrAktTemp = arrDivElements[nAktuellerIndex];
	strSrcDatei = arrAktTemp[8];
	HideMeinung(xLayer);
	imglayer = document.getElementById("DivImgMeinung");
	if (navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("6.0") > -1) { coordinaten.x = parseInt(coordinaten.x) + 855; strSrcDatei = arrAktTemp[10]; }
	if (navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("7.0") > -1) { coordinaten.x = parseInt(coordinaten.x) - 17; }

	ShowLayerMeinung(coordinaten.x, coordinaten.y, arrAktTemp[5], arrAktTemp[4], strSrcDatei);
	
	nAktBildModus = arrAktTemp[9];
	nStartHeight = arrAktTemp[5];
	nStartWidth = arrAktTemp[4];
	
	nEndHeight = arrAktTemp[7];
	nEndWidth = arrAktTemp[6];
	
	var deltaX = 0; deltaY = 0;
	deltaX = nEndHeight - nStartHeight;
	deltaY = nEndWidth - nStartWidth;
	
	nSchrittweiteH = (deltaX) / gnAnzahlStufen;
	nSchrittweiteH = parseInt(nSchrittweiteH);
	nSchrittweiteW = (deltaY) / gnAnzahlStufen;
	nSchrittweiteW = parseInt(nSchrittweiteW);
	if (nSchrittweiteH % 2 == 1) nSchrittweiteH++;
	if (nSchrittweiteW % 2 == 1) nSchrittweiteW++;
	// alert("ExpandMeinung (" + nAktBildModus + ", " + nStartHeight + ", " + nStartWidth + ", " + nEndHeight + ", " + nEndWidth + ", " + nSchrittweiteH + ", " + nSchrittweiteW + ", 0, 0, " + AktDiv + ");");
	ExpandMeinung (nAktBildModus, nStartHeight, nStartWidth, nEndHeight, nEndWidth, nSchrittweiteH, nSchrittweiteW, AktDiv, 0);
}

function StartMinimize (strNextDiv) {
	var oLayer = document.getElementById("meinungslayer");
	var orgDiv = document.getElementById(strAktMaxBildID);
	
	coordsLayer = getElementCoords(oLayer);
	coordsOrgDiv = getElementCoords(orgDiv);
	
	if (navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("6.0") > -1) coordsLayer.x = coordsLayer.x + 855;
	
	// arrTemp (Div-ID, max.Bewegung, Geschwindigkeit (in ms), True => Div bewegt sich NICHT - false => Div bewegt sich 
	// StartWidth, StartHeight, EndWidth, EndHeight, Src-Grossbild,  Modus- wie der Layer aufgehen soll)
	if (strAktMaxBildID == "") {
		oLayer.style.display = "none";
	} else {
		// Ermitteln der aktuellen Werte des Divs
		var nStartHoehe = 0, nStartBreite = 0, nEndHoehe = 0, nEndBreite = 0;
		
		for (i=0; i < arrDivElements.length; i++) {
			arrAktTemp = arrDivElements[i];
			
			if (arrAktTemp[0] == strAktMaxBildID) {
				nAktMaxBildModus = arrAktTemp[9];
				nStartBreite = arrAktTemp[4];
				nStartHoehe = arrAktTemp[5];
				nEndBreite = arrAktTemp[6];
				nEndHoehe = arrAktTemp[7];
				i = arrDivElements.length + 100;
			}
		}

		var deltaX = 0; deltaY = 0;
		deltaX = nEndHoehe - nStartHoehe;
		deltaY = nEndBreite - nStartBreite;
		
		nSchrittweiteH = (deltaX) / gnAnzahlStufen;
		nSchrittweiteH = parseInt(nSchrittweiteH);
		nSchrittweiteW = (deltaY) / gnAnzahlStufen;
		nSchrittweiteW = parseInt(nSchrittweiteW);
		
		if (nSchrittweiteH % 2 == 1) nSchrittweiteH++;
		if (nSchrittweiteW % 2 == 1) nSchrittweiteW++;
	
		// alert("ReduceMeinung (" + nAktMaxBildModus + ", " + nStartHoehe + ", " + nStartBreite + ", " + nEndHoehe + ", " +nEndBreite + ", " + nSchrittweiteH + ", " + nSchrittweiteW + ", 0, 0, " + strAktMaxBildID+ ");");
		ReduceMeinung (nAktMaxBildModus, nStartHoehe, nStartBreite, nEndHoehe, nEndBreite, nSchrittweiteH, nSchrittweiteW, strAktMaxBildID, 10, strNextDiv);
	}
}



function ExpandMeinung (nModus, nStartHoehe, nStartBreite, nEndHoehe, nEndBreite, nSchrittweiteH, nSchrittweiteW, strDivID, nOpacityIndex) {
	var oLayer = document.getElementById("meinungslayer");
	oLayer.style.cursor = "wait";
	var imglayer = document.getElementById("DivImgMeinung");
	nTempH = parseInt(oLayer.style.height.replace("px", "") );
	nTempW = parseInt(oLayer.style.width.replace("px", "") );
	bMaximized = false;
	switch (nModus) {
		case 1: 
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
		case 2: 
			nTempLeft = oLayer.style.left;
			nTempLeft = Number(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft - (nSchrittweiteW/2); 
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
		case 3: 
			nTempLeft = oLayer.style.left;
			nTempLeft = Number(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft - nSchrittweiteW;
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
			
		case 4: 
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop - (nSchrittweiteH/2);
			// alert(oLayer.style.top + "--" + nTempTop);
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
		case 5: 
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") )
			nTempTop = nTempTop - (nSchrittweiteH/2);
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft - (nSchrittweiteW/2);
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
		case 6: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft - nSchrittweiteW;
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") )
			nTempTop = nTempTop - (nSchrittweiteH/2);
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			
			break;
			
		case 7: 
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop - nSchrittweiteH;
			oLayer.style.top = nTempTop + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
		case 8: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") );
			nTempLeft = nTempLeft - (nSchrittweiteW/2);
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop - nSchrittweiteH;
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
		case 9: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") );
			nTempLeft = nTempLeft - nSchrittweiteW;
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop - nSchrittweiteH;
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			
			break;
			
		default: 
			oLayer.style.height = (nTempH + nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW + nSchrittweiteW) + "px";
			imglayer.height = nTempH + nSchrittweiteH;
			imglayer.width = nTempW + nSchrittweiteW;
			break;
	}
	
	
	nOpacityIndex++;
	imglayer.style.opacity = (0.1 * nOpacityIndex);
	
	if (nTempH + nSchrittweiteH < nEndHoehe && nTempW + nSchrittweiteW < nEndBreite) {
		window.setTimeout("ExpandMeinung(" + nModus + ", " + nStartHoehe + ", " + nStartBreite + ", " + nEndHoehe + ", " + nEndBreite + ", " + nSchrittweiteH + ", " + nSchrittweiteW + ", '" + strDivID + "', '" + nOpacityIndex + "')",30);
	} else {
		if (nOpacityIndex < 10) {
			imglayer.style.opacity = 1;
		}
		
		if (nTempH + nSchrittweiteH < nEndHoehe || nTempH + nSchrittweiteH > nEndHoehe ) {
			// wenn die ZielHöhe noch nicht erreicht oder überschritten wurde, wird automatisch die Zielhöhe gesetzt
			oLayer.style.height = nEndHoehe + "px";
			imglayer.height = nEndHoehe;
		}
		if (nTempW + nSchrittweiteW < nEndBreite || nTempW + nSchrittweiteW > nEndBreite ) {
			// wenn die ZielHöhe noch nicht erreicht oder überschritten wurde, wird automatisch die Zielhöhe gesetzt
			oLayer.style.width = nEndBreite + "px";
			imglayer.width = nEndBreite;
		}
		strAktMaxBildID = strDivID;

		nAktMaxBildModus = nModus;
		oLayer.style.cursor = "pointer";
		nAktionsID = 2;
		xEle = document.getElementById(strAktMaxBildID);
		bMaximized = true;
		// alert(xEle + " : " + xEle.style.top + ".." + xEle.style.left);
			
	}
}

function ReduceMeinung (nModus, nStartHoehe, nStartBreite, nEndHoehe, nEndBreite, nSchrittweiteH, nSchrittweiteW, strDivID, nOpacityIndex, strNextDivShow) {
	var oLayer = document.getElementById("meinungslayer");
	oLayer.style.cursor = "wait";
	var imglayer = document.getElementById("DivImgMeinung");
	
	nTempH = oLayer.style.height.replace("px", "");
	nTempW = oLayer.style.width.replace("px", "");
	bMaximized = true;
	switch (nModus) {
		case 1: 
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
		case 2: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft + (nSchrittweiteW/2); 
			
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
		case 3: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft + nSchrittweiteW;
			
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
			
		case 4: 
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop + (nSchrittweiteH/2);
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
		case 5: 
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop + (nSchrittweiteH/2);
			
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") );
			nTempLeft = nTempLeft + (nSchrittweiteW/2);
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
		case 6: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") )
			nTempLeft = nTempLeft + nSchrittweiteW;
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") )
			nTempTop = nTempTop + (nSchrittweiteH/2);
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
			
		case 7: 
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop + nSchrittweiteH;
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
		case 8: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") );
			nTempLeft = nTempLeft + (nSchrittweiteW/2);
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop + nSchrittweiteH;
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
		case 9: 
			nTempLeft = oLayer.style.left;
			nTempLeft = parseInt(nTempLeft.replace("px", "") );
			nTempLeft = nTempLeft + nSchrittweiteW;
			nTempTop = oLayer.style.top;
			nTempTop = parseInt(nTempTop.replace("px", "") );
			nTempTop = nTempTop + nSchrittweiteH;
			
			oLayer.style.top = nTempTop + "px";
			oLayer.style.left = nTempLeft + "px";
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
			
		default: 
			oLayer.style.height = (nTempH - nSchrittweiteH) + "px";
			oLayer.style.width = (nTempW - nSchrittweiteW) + "px";
			
			imglayer.height = nTempH - nSchrittweiteH;
			imglayer.width = nTempW - nSchrittweiteW;
			break;
	}
	nOpacityIndex--;
	imglayer.style.opacity = (0.1 * nOpacityIndex);
	
	if (nTempH - nSchrittweiteH > nStartHoehe && nTempW - nSchrittweiteW > nStartBreite) {
		window.setTimeout("ReduceMeinung (" + nModus + ", " + nStartHoehe + ", " + nStartBreite + ", " + nEndHoehe + ", " + nEndBreite + ", " + nSchrittweiteH + ", " + nSchrittweiteW + ", '"  + strDivID + "', '" + nOpacityIndex + "', '" + strNextDivShow + "')",30);
	} else {
		nAktMaxBildModus = 0;
		oLayer.style.display = "none";
		oLayer.style.cursor = "pointer";
		nAktionsID = 4;
		
		strAktSource = imglayer.src;
		if (strAktSource.indexOf("de_img/tr.gif") > -1) {
			// kein aktueller Layer
		} else {
			// es ist bereits ein Layer geöffnet
			nAktImageIndex = -1;
			for (imgI = 0; imgI < arrDivElements.length; imgI++) {
				arrTempImg = arrDivElements[imgI];
				strTestSource = arrTempImg[8];
				if (navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("6.0") > -1) { strTestSource = arrTempImg[10];  }
				strTestSource = strTestSource.replace("../", "");
				
				if (strAktSource.indexOf(strTestSource) > -1) {
					nAktImageIndex = imgI;
					imgI = arrDivElements.length + 100;
				}
			}
			if (nAktImageIndex > -1) {
				arrTempImg = arrDivElements[nAktImageIndex];
				xAktImageVisible = document.getElementById(arrTempImg[0]);
				if (xAktImageVisible != null) {
					xAktImageVisible.style.visibility = "visible";
				}
			}
		}
		imglayer.src = "../de_img/tr.gif";
		imglayer.width = "1";
		imglayer.height = "1";
		strAktMaxBildID = "";
		if (strNextDivShow == "undefined" || strNextDivShow == "null") strNextDivShow = "";
		if (strNextDivShow != "") {
			ShowContent(strNextDivShow);
		}
	}
	
}


function ShowLayerMeinung(nStartX, nStartY, nStartHeight, nStartWidth, strSrc) {
	var o = document.getElementById("meinungslayer");
	// Positionieren des Layer
	o.style.left = nStartX + "px";
	o.style.top = nStartY + "px";
	
	// StartBreite und StartHoehe des Layer
	o.style.height = (parseInt(nStartHeight) + 5) + "px";
	o.style.width = (parseInt(nStartWidth) + 5) + "px";

	imglayer = document.getElementById("DivImgMeinung");
	imglayer.src = strSrc;
	imglayer.width = nStartWidth;
	imglayer.height = nStartHeight;
	o.style.display = "block";
}

function StopAll () {
	bStop = true;
}
function ShowContent(strAktDiv) {
	if (strAktMaxBildID != "" && strAktMaxBildID != strAktDiv) {
		nTempIndex = -1;
		for (imgI = 0; imgI < arrDivElements.length; imgI++) {
			arrTempImg = arrDivElements[imgI];
			if (strAktMaxBildID == arrTempImg[0]) {
				nTempIndex = imgI;
			}
		}
		if (nTempIndex > -1 && nTempIndex != nAktIndex) {
			StartMinimize(strAktDiv);
		} else {
			strAktMaxBildID = "";
			ShowContent(strAktDiv);
		}
	} else {
		nAktIndex = -1;
		for (i=0; i < arrDivElements.length; i++) {
			arrTemp = arrDivElements[i];
			if (arrTemp[0] == strAktDiv) { nAktIndex = i; }
		}
		if (nAktIndex > -1) {
			arrTemp = arrDivElements[nAktIndex];
			xAktLayerImage = document.getElementById("DivImgMeinung");
			strAktSource = xAktLayerImage.src;
			if (strAktSource.indexOf("de_img/tr.gif") > -1) {
				// kein aktueller Layer
			} else {
				// es ist bereits ein Layer geöffnet
				nAktImageIndex = -1;
				for (imgI = 0; imgI < arrDivElements.length; imgI++) {
					arrTempImg = arrDivElements[imgI];
					strTestSource = arrTempImg[8]; 
					if (navigator.appName.indexOf("Microsoft") > -1 && navigator.appVersion.indexOf("6.0") > -1) { strTestSource = arrTempImg[10];  }
					strTestSource = strTestSource.replace("../", "");
					if (strAktSource.indexOf(strTestSource) > -1) {
						nAktImageIndex = imgI;
						imgI = arrDivElements.length + 100;
					}
				}
				if (nAktImageIndex > -1) {
					arrTempImg = arrDivElements[nAktImageIndex];
					xAktImageVisible = document.getElementById(arrTempImg[0]);
					if (xAktImageVisible != null) {
						xAktImageVisible.style.visibility = "visible";
					}
				}
			}
			
			xAktImageVisible = document.getElementById(arrTemp[0]);
			if (xAktImageVisible != null) {
				xAktImageVisible.style.visibility = "hidden";
			}
			StartMaximize(strAktDiv, nAktIndex);
		}
	}
}

function HideMeinung(xElement) {
	if (xElement.style.display == "block") {
		xElement.style.display = "none";
		xElement.style.left = "-100px";
		xElement.style.top = "-100px";
		xElement.style.width = "0px";
		xElement.style.height = "0px";
		
		var imglayer = document.getElementById("DivImgMeinung");
		imglayer.src = "../de_img/tr.gif";
		imglayer.height = "1";
		imglayer.width = "1";
	}
}

