
	var gBereich="";	// aktueller Bereich

// Funktionen für die Navigation

	function changeHead(pBereich)
	{
		document.getElementById("head1").src="images/headimages/head_"+pBereich+".gif";
		document.getElementById("head2").src="images/headimages/pic_"+pBereich+".jpg";
		showBlock(pBereich);
	}

	function showBlock(pBereich)
	{
		hideBlocks();
        document.getElementById("div_"+pBereich).style.display="block";
		gBereich=pBereich;
	}

	function hideBlocks()
	{
		if (gBereich!="") document.getElementById("div_"+gBereich).style.display="none";
	}
	
	function navi_over(pBereich,pArt)
	{
		document.getElementById("navi_"+pBereich).src="images/navi/navi_"+pBereich+"_"+pArt+".gif"
	}
	
	function naviOver(pBereich,pArt,pHauptbereich)
	{
		document.getElementById("navi_"+pHauptbereich+"_"+pBereich).src="images/navi/navi2_"+pBereich+"_"+pArt+".gif"
	}

	function displayImage(pImage, pID, pWidth, pHeight, pTitle)
	{
		var lHtml='';
		lHtml+='<table width='+pWidth+' border="0" cellspacing="0" cellpadding="0" height="'+pHeight+'">';
		lHtml+='<tr><td width="200" height="200" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=1"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="200" height="200"></td>'; 
		lHtml+='<td width="'+(pWidth-200)+'" height="200" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=2"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="'+(pWidth-200)+'" height="200"></td></tr>'; 
		lHtml+='<tr><td width="200" height="'+(pHeight-200)+'" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=3"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="200" height="'+(pHeight-200)+'"></td>'; 
		lHtml+='<td width="'+(pWidth-200)+'" height="'+(pHeight-200)+'" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=4"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="'+(pWidth-200)+'" height="'+(pHeight-200)+'"></td></tr>'; 
		lHtml+='</table>';
		
		showTooltip("divTooltip",lHtml,100);	
	}



// Funktionen fuer die Inline-Navigation
	var gHistory=new Array();	// Speicher
	var gHistoryPos=0;			// wo sind wir
	var gLastPage=false;		// sind wir auf der letzten Seite (d.h. diese ist noch nicht im Array)

	var gElement="";	// ELement fuer loadUrl
	
	function historyAdd()
	{
		// aktuellen Content im History-Array speichern
		
		// Ist der User zurückgegangen, dann löschen wir den Rest vom Array
		if (gHistoryPos<gHistory.length)
		{
			gHistory.splice(gHistoryPos,gHistory.length);
		}
		// aktuellen Content holen und dran pushen
		oContent=document.getElementById("divContent");
		gHistory.push(oContent.innerHTML);
		gHistoryPos=gHistory.length;
		gLastPage=true;
	}	
	
	function historyBack()
	{
		if (gHistoryPos>0)
		{		
			// wenn wir ganz am Ende sind, dann müssen wir eventuell den aktuellen Inhalt
			// auch speichern
			if (gLastPage)
			{
				oContent=document.getElementById("divContent");
				gHistory.push(oContent.innerHTML);
//				alert("Saving last page - "+gLastPage);
			}
	
			gHistoryPos--;
			// letzten Content aus dem History-Array anzeigen
			oContent=document.getElementById("divContent");
			oContent.innerHTML=gHistory[gHistoryPos];
			gLastPage=false;
		}
		else
		{
//			alert("no more pages "+gHistoryPos+"/"+gHistory.length);
		}
	}	
	
	function historyForward()
	{
//		alert("FORWARD:"+gHistoryPos+"/"+gHistory.length);
		
		if (gHistoryPos+1<gHistory.length)
		{		
			gHistoryPos++;
			if (gHistory[gHistoryPos]!="undefined")
			{
				// letzten Content aus dem History-Array anzeigen
				oContent=document.getElementById("divContent");
				oContent.innerHTML=gHistory[gHistoryPos];
			}
		}
		else
		{
//			alert("ENDE:"+gHistoryPos+"/"+gHistory.length);
		}
	}	

	function loadContent(pFile)
	{
		oContent=document.getElementById("divContent");
		// gHtml=oContent.innerHTML;
		historyAdd();
		lUrl="content.php?page="+pFile
		loadUrl(lUrl, oContent );
		gElement.innerHTML
	}
	
	// XML-HTTP-Request absetzen
	function loadUrl(pUrl, pElement ) 
	{
		var oDate = new Date();
		var lTs = oDate.getMilliseconds();
		var lUrl = pUrl +"&timestamp="+lTs;
		gElement=pElement;
		sendXMLHttpRequest("GET",lUrl,finishLoad);
	}
	
	function finishLoad()
	{
		var XMLResult = null;
		
		if (oXMLHttpRequest.readyState == 4)
		{
			if (oXMLHttpRequest.status == 200) 
			{
				gElement.innerHTML=oXMLHttpRequest.responseText;
			}
		}
	}
	
// ======== FUNKTIONEN FÜR TOOLTIPS ======
// ====== Funktionen zum Positionieren von Layern abhängig von der Mausposition =====

	oTooltip=null;		// Variable für den aktuellen Layer
	gHtml="";
	
	// ToolTip abhängig zur Maus positionieren
	function event_TooltipMove(e) 
	{
		if (oTooltip == null) return false;
		try 
		{
		
			x = (document.all) ? window.event.x + getDocumentBody().scrollLeft : e.pageX;
			y = (document.all) ? window.event.y + getDocumentBody().scrollTop : e.pageY;
			// Groesse des Layers und Position berücksichtigen
			ldocWidth = document.all ? getDocumentBody().scrollLeft+getDocumentBody().clientWidth : pageXOffset+window.innerWidth-15;
			ldocHeight = document.all ? Math.min(getDocumentBody().scrollHeight, getDocumentBody().clientHeight) : Math.min(window.innerHeight);
			lTooltipWidth=oTooltip.offsetWidth;
			lTooltipHeight=oTooltip.offsetHeight;
			lScrollTop=getDocumentBody().scrollTop;
			lScrollLeft=getDocumentBody().scrollLeft;
			var Jetzt = new Date();
			lHtml="MouseMove: "+Jetzt.toLocaleString()+"<br>";
			lHtml+="MousePos: "+x+","+y+"<br>";
			lHtml+="WindowSize: "+ldocWidth+"x"+ldocHeight+"<br>";
			lHtml+="LayerSize: "+lTooltipWidth+"x"+lTooltipHeight+"<br>";
			lHtml+="Scrollpos: "+lScrollLeft+","+lScrollTop+"<br>";
			lHtml+="Ränder:"+(y+20+lTooltipHeight-lScrollTop)+">"+ldocHeight+" == "+(lScrollTop+ldocHeight-40-lTooltipHeight)+"<br>";

			// wenn die Position jetzt zuweit rechts ist, dann links von der Maus
			if ((x+20+lTooltipWidth)>ldocWidth) x=x-lTooltipWidth-40;
			if ((y+20+lTooltipHeight-lScrollTop)>ldocHeight) y=lScrollTop+ldocHeight-40-lTooltipHeight;
			if (oTooltip == null) alert("Tooltip removed");
			oTooltip.style.left = (x + 20) + "px";
			oTooltip.style.top = (y + 20) + "px";

			lHtml+="NewPos: "+x+","+y+"<br>";
//			showDebugInfo(lHtml);

			return true;
		} catch (error) {  alert("Error:"+error.name+"\n"+error.message); error=null; }
	} // event_LayerMove		

	// Zeigt den Layer mit dem entsprechenden Inhalt (wenn gesetzt) an
	function showTooltip(pLayer, pHtml, pTimeout)
	{
		oTooltip=document.getElementById(pLayer);
		if (oTooltip == null) alert("Tooltip not created");

		if (pHtml!=null) oTooltip.innerHTML=pHtml;
		document.onmousemove=event_TooltipMove;
		if (pTimeout!=null)
		{
			window.setTimeout("setTooltipVisible()",pTimeout); 
		}
		else
		{
			setTooltipVisible();
		}
	}
	
	function setTooltipVisible()
	{
			if (oTooltip == null) return false;
			oTooltip.style.visibility="visible";
	}

	// Blendet den Layer aus
	function hideTooltip()
	{
		if (oTooltip==null) return false;
		oTooltip.style.visibility="hidden";
		clearTimeout();
		oTooltip=null;
		document.onmousemove="";
	}

	// Document-Object ermitteln (im Opera etwas anders)
	function getDocumentBody()
	{
		return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}	
	 