
	var gCurrentMenu="";	// aktuelles Menue
	var gCurrentSubMenu="";	// aktuelles Unter-Menue
	var gTimeout="";
	
// Funktionen für die Navigation

	function changeNavi(pBereich)
	{
		hideBlocks();
		// erst mal den alten zuruecksetzen
		if (gCurrentMenu!="")
		{
			document.getElementById("navi_"+gCurrentMenu).src="images/"+gCurrentMenu+".gif";
		}
		document.getElementById("navi_"+pBereich).src="images/"+pBereich+"_on.gif";
		gCurrentMenu=pBereich;
	}

	function showBlock(pBereich)
	{
		hideBlocks();
        document.getElementById("div_"+pBereich).style.display="block";
		gCurrentSubMenu=pBereich;
	}

	function hideBlocks()
	{
		if (gCurrentSubMenu!="") document.getElementById("div_"+gCurrentSubMenu).style.display="none";
		gCurrentSubMenu="";
	}
	
	function navi_over(pBereich,pArt)
	{
		if (gCurrentMenu!=pBereich) document.getElementById("navi_"+pBereich).src="images/"+pBereich+pArt+".gif"
	}
	

	function displayImage(pImage, pID, pWidth, pHeight, pTitle)
	{
		if (gTimeout!="") clearTimeout(gTimeout);
		gTimeout="";
	
		pWidthOrig=pWidth;
		pHeightOrig=pHeight;
		pWidth=pWidth*5/8;
		pHeight=pHeight*5/8;
		var lHtml='';
		lHtml+='<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" height="500" bgcolor="#EFEFEF"><tr><td>';
		lHtml+='<table width='+pWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height="'+pHeight+'" onClick="showImage('+"'"+pImage+"', '"+pID+"', "+pWidthOrig+","+ pHeightOrig+",'"+pTitle+"'"+')" title="'+pTitle+' - click for larger image...">';
		lHtml+='<tr><td width="125" height="125" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=1&f=62.5"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="125" height="125"></td>'; 
		lHtml+='<td width="'+(pWidth-125)+'" height="125" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=2&f=62.5"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="'+(pWidth-125)+'" height="125"></td></tr>'; 
		lHtml+='<tr><td width="125" height="'+(pHeight-125)+'" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=3&f=62.5"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="125" height="'+(pHeight-125)+'"></td>'; 
		lHtml+='<td width="'+(pWidth-125)+'" height="'+(pHeight-125)+'" background="gallery/view.php?t=J&i='+pImage+'&id='+pID+'&p=4&f=62.5"><img src="gallery/view.php?t=G&i='+pImage+'&id='+pID+'" width="'+(pWidth-125)+'" height="'+(pHeight-125)+'"></td></tr>'; 
		lHtml+='</table>';
		lHtml+='<span class="copyright">ALL IMAGES &copy; by HCH-Fotodesign</span>';
		lHtml+='</td></tr></table>';
		oContent=document.getElementById("divContent");
		oContent.innerHTML=lHtml;
	}

	function displayImage480(pImage, pID, pWidth, pHeight, pTitle)
	{
		if (gTimeout!="") clearTimeout(gTimeout);
		gTimeout="";
	
		var lHtml='';
		lHtml+='<table width="500" border="0" cellspacing="0" cellpadding="0" align="center" height="500" bgcolor="#EFEFEF"><tr><td>';
		lHtml+='<table width='+pWidth+' border="0" cellspacing="0" cellpadding="0" align="center" 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>';
		lHtml+='</td></tr></table>';
		oContent=document.getElementById("divContent");
		oContent.innerHTML=lHtml;
	}

	function showImage(pImage, pID, pWidth, pHeight, pTitle)
	{
		// Groessen definieren
		var lWidth = screen.width;
		var lHeight = screen.height;
	
		lStats='width='+pWidth+',height='+pHeight+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
		popUpWindow = window.open ('empty.htm',"wPopUp",lStats); 

		var lHtml='';
		lHtml='<html><head><title>'+pTitle+'</title><meta http-equiv="imagetoolbar" CONTENT="no"></head><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()" onClick="self.close()" onkeydown="self.close()" onkeypress="self.close()">';  
		lHtml+='<table width='+pWidth+' border="0" cellspacing="0" cellpadding="0" align="center" 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>';
		lHtml+='</html>';
		popUpWindow.document.write(lHtml);
		popUpWindow.document.close();
		popUpWindow.focus();
	}

	
	function loadGallery(pFile)
	{
		oContent=document.getElementById("divThumbnails");
		lUrl="content.php?page=gallery_detail"+pFile
		loadUrl(lUrl, oContent );
		
		// Content löschen
		oContent=document.getElementById("divContent");
		lHtml='<table width="500" border="0" height="500"><tr><td align="center"><img src="images/loading.gif" width="100" height="100" border="0"></td></tr></table>';
		oContent.innerHTML=lHtml;
		
		// und nach 5 Sekunden dann das erste Bild laden
		// jetzt auch noch das erste Bild laden
		lUrl="content.php?page=gallery_display"+pFile
//		loadUrl(lUrl, oContent );
		gTimeout=setTimeout("loadUrl(lUrl, oContent );",3000);
	}
	

// 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);
	// zur sicherheit noch die thumbnails ausblenden
		oContent=document.getElementById("divThumbnails");
		oContent.innerHTML="";
	}
	
	// XML-HTTP-Request absetzen
	function loadUrl(pUrl, pElement ) 
	{
//		alert(pElement.id+" = "+pUrl);
		var oDate = new Date();
		var lTs = oDate.getMilliseconds();
		var lUrl = pUrl +"&timestamp="+lTs;
		gElement=pElement;
		sendXMLHttpRequest("GET",lUrl,finishLoad);
	}
	
	function finishLoad()
	{
		var XMLResult = null;
//		alert("FINISH:"+oXMLHttpRequest.readyState);
		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
	}	
	 