/*===========================================================================
| Anwendung......: Internetpraesenz adt-Rinck
| Modul-Name.....: Dynamische Menues
| Copyrights.....: adt-Rinck, http://www.adt-rinck.de
| Erstellt.......: 08.12.2002
| Autor..........: Daniel Rinck
|----------------------------------------------------------------------------
| Beschreibung:
|
|============================================================================
| Historie:
| 17.03.2003 22:09 Ri:
| Anpassung für Netscape 4.x
|==========================================================================*/

/*****************************************************************
 Grundeinstellungen
*****************************************************************/
g_RootPath = "http://www.adt-rinck.de/";
//g_RootPath = "file://H:/Projekte/adt-Web/adt-rinck.de/ADT/";
//g_RootPath = "http://ikarus/";

/*****************************************************************
 Browser-Weiche
*****************************************************************/
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;
if(window.opera)
	OP = 1;
if(document.getElementById)
{
	DHTML = 1;
	DOM = 1;
}
if(document.all && !OP)
{
	DHTML = 1;
	MS = 1;
}
if (window.netscape && window.screen && !DOM && !OP)
{
	DHTML = 1;
	NS = 1;
}

/*****************************************************************
 Allgemeine Funktionen
*****************************************************************/

var timer1;
var last_item = 0;

//////////////////////////////////////////////////////////////////
// HTML Element anhand der ID ermitteln
//
function ElemByID(id)
{
	var Elem;
	if(DOM && (typeof document.getElementById(id) == "object"))
		return document.getElementById(id);
	else if(MS && (typeof document.all[id] == "object"))
		return document.all[id];
	else if(NS && (typeof document[id] == "object"))
		return document[id];
	else return void(0);
}

function ShowIt(e, id)
{
	var pos = new Array(380, 290, 385);
	if(!NS)
	{
		if(MS)
		{
		  e.style.left = document.body.offsetWidth - pos[id-1];
		  e.style.top = 105;
		}
		else
		  e.style.left = window.innerWidth - pos[id-1];
		e.style.visibility = "visible";
	}
	else
	{
		e.left = window.innerWidth - pos[id-1];
		e.visibility = "visible";
	}
}

function HideIt(e)
{
	if(!NS)
		e.style.visibility = "hidden";
	else
		e.visibility = "hidden";
}

function InitMenu()
{
	with(window.document)
	{
		// Positionierung der Submenues: siehe auch ShowIt()
		//write('<style media="screen" type="text/css"><!--');
		write('<style type="text/css"><!--');
		write('#Menu1 { position: absolute; top: 98px; width: 175px; visibility: hidden }');
		write('#Menu2 { position: absolute; top: 98px; width: 202px; visibility: hidden }');
		write('#Menu3 { position: absolute; top: 98px; width: 276px; visibility: hidden }');
		write('--></style>');
	}
}

function WriteMenu()
{
	var imgDir = g_RootPath + "img/";
	with(window.document)
	{
		//write('<img src="'+imgDir+'dummy11.gif" width="10" height="23" border="0"><img src="'+imgDir+'men_aktuell.gif" width="83" height="22" border="0" onMouseover="EnterMenu(1)"><img src="'+imgDir+'dummy11.gif" width="7" height="22" border="0"><img src="'+imgDir+'men_service.gif" width="83" height="22" border="0" onMouseover="EnterMenu(2)"><img src="'+imgDir+'dummy11.gif" width="7" height="22" border="0"><img src="'+imgDir+'men_ueber.gif" width="83" height="22" border="0" onMouseover="EnterMenu(3)"><img src="'+imgDir+'dummy11.gif" width="7" height="22" border="0"><a href="'+g_RootPath+'kontakt/kontakt.html"><img src="'+imgDir+'men_kontakt.gif" width="83" height="22" border="0"></a><br>');

		write('<div id="Menu1" align="right">');
		write('<a href="'+g_RootPath+'aktuell/news.php"><img src="'+imgDir+'mensub_news.gif" width="86" height="28" border="0"></a>');
		write('<a href="'+g_RootPath+'aktuell/tipps.html"><img src="'+imgDir+'mensub_tipps.gif" width="89" height="28" border="0"></a>');
		write('</div>');

		write('<div id="Menu2" align="right">');
		write('<a href="'+g_RootPath+'service/auftraege.html"><img src="'+imgDir+'mensub_auftraege.gif" width="86" height="28" border="0"></a>');
		write('<a href="'+g_RootPath+'service/kunden.html"><img src="'+imgDir+'mensub_kunden.gif" width="116" height="28" border="0"></a>');
		write('</div>');

		write('<div id="Menu3" align="right">');
		write('<a href="'+g_RootPath+'ueber/unternehmen.html"><img src="'+imgDir+'mensub_unternehmen.gif" width="96" height="28" border="0"></a>');
		write('<a href="'+g_RootPath+'ueber/spektrum.html"><img src="'+imgDir+'mensub_spektrum.gif" width="90" height="28" border="0"></a>');
		write('<a href="'+g_RootPath+'ueber/historie.html"><img src="'+imgDir+'mensub_historie.gif" width="90" height="28" border="0"></a>');
		write('</div>');
	}
}

function EnterMenu(id)
{
	var e;
	e = ElemByID("Menu" + id);
	if(last_item) HideIt(last_item);
	if(e) ShowIt(e, id);
	last_item = e;
	window.clearTimeout(timer1);
	timer1 = window.setTimeout("HideSubMenu();", 4000);
}

function HideSubMenu()
{
	var e, n;
	for(n = 1; e = ElemByID("Menu" + n); n++)
		HideIt(e);
}

InitMenu();
