///////////////////////////////////////////////////////////////////////////
// File: 	coma.js
// Author:	Frank Specht
// Date: 	2007-07-30
// Copyright (c) by Frank Specht, Oldenburg
///////////////////////////////////////////////////////////////////////////

var activePage		= "";
var menueBgOver		= "#730916";
var menueBgOut		= "#B8B6B6";
var menueTextOver	= "#ffffff";
var menueTextOut	= "#4B4D4B";

///////////////////////////////////////////////////////////////////////////
// void comaActivateMenue(char *menueID)
// Hauptmenue-Eintrag farblich ändern bei angewählter Seite
///////////////////////////////////////////////////////////////////////////
function comaActivateMenue(menueID)
{
	activePage = menueID;
	document.getElementById(menueID).style.backgroundColor = menueBgOver;
	document.getElementById("nav"+menueID+"Link").style.color = menueTextOver;
}

///////////////////////////////////////////////////////////////////////////
// void comaChangeMenue(char *menueID, bool over)
// Hauptmenue-Eintrag farblich ändern bei mouseover()
///////////////////////////////////////////////////////////////////////////
function comaChangeMenue(menueID, over)
{
	if (over)
	{	
		document.getElementById(menueID).style.backgroundColor = menueBgOver;
		document.getElementById("nav"+menueID+"Link").style.color = menueTextOver;
	}
	else
	{
		if (menueID != activePage)
		{
			document.getElementById(menueID).style.backgroundColor = menueBgOut;
			document.getElementById("nav"+menueID+"Link").style.color = menueTextOut;
		}
	}
}

///////////////////////////////////////////////////////////////////////////
// void comaOpenImage(char *image, int breite, int hoehe, char *title, char *text)
// Bild in externem Fenster öffnen
///////////////////////////////////////////////////////////////////////////
function comaOpenImage(image, breite, hoehe, title, text)
{
	var left = (screen.width - breite) / 2;
	var top	 = (screen.height - hoehe) / 2;
	
	if (text != "")
		hoehe += 100;
	
	var win;
	if (text.length > 340)
	{
		breite += 20;
		win = window.open(image,"_blank","width="+breite+",height="+hoehe+",left="+left+",top="+top+",location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=no");
	}
	else
		win = window.open(image,"_blank","width="+breite+",height="+hoehe+",left="+left+",top="+top+",location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no");

	win.document.writeln("<html><head><title>Bildergalerie</title>");
	win.document.writeln("<link rel='stylesheet' type='text/css' href='styles.css'></head>");
	win.document.writeln("<body>");
	win.document.writeln("<table border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='top' bgcolor='#96A5A8'>");
	win.document.writeln("<a href='javascript:window.close()'><img src='" + image + "' border='0'></a></td></tr>");
	win.document.writeln("<tr><td align='left' bgcolor='#96A5A8' height='18'><div style='padding-left:10px;padding-right:10px'><font class='bildtitel'>" + title + "</font></div></td></tr>");
	win.document.writeln("<tr><td align='left' valign='top'><div style='padding-top:5px;padding-left:10px;padding-right:10px'><font class='bild'>" + text + "</font></div></td></tr>");
	win.document.writeln("</table>");
	win.document.writeln("</body></html>");
}
////////////////////////////////////////////////////////////////////////////
// Beginn POPUP-Menue
////////////////////////////////////////////////////////////////////////////

var breite;
var aktiv;

function hidealllayer()
{
	document.getElementById("popmenue1").style.visibility="hidden";
	document.getElementById("popmenue2").style.visibility="hidden";
	document.getElementById("popmenue3").style.visibility="hidden";
	document.getElementById("popmenue4").style.visibility="hidden";
	document.getElementById("popmenue6").style.visibility="hidden";
}

////////////////////////////////////////////
// [x][y]-Position eines Objekts zurückgeben
////////////////////////////////////////////
function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent)
	{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent)
		{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function show_layer(x)
{
	if (document.getElementById)
	{
		hidealllayer();

		pos = findPos(document.getElementById(x));
		breite = pos[0] + 10;
		hoehe  = pos[1] + 19;
		
		window.document.getElementById("pop"+x).style.top = hoehe /* + window.document.body.scrollTop */+"px";
		window.document.getElementById("pop"+x).style.left= breite /*+ window.document.body.scrollLeft */+"px";
		
		window.document.getElementById("pop"+x).style.visibility="visible";

		window.clearTimeout(aktiv);
		aktiv = window.setTimeout("hidealllayer()",15000);
	}
}

function menuOut(s)
{
	if( s == 0)
	{
		window.clearTimeout(aktiv);
		aktiv=window.setTimeout("hidealllayer()",100);
	}
	else
		window.clearTimeout(aktiv);
}

////////////////////////////////////////////////////////////////////////////
// Ende POPUP-Menue
////////////////////////////////////////////////////////////////////////////

