// (c) Peter-Michael Mangold / Stuttgart / 2006

if(document.ids)x='nc4';
else if( document.all && !document.getElementById )x='ie4';
else if( window.opera && !document.createElement )x='op5';
else if( window.opera && window.getComputedStyle )  {
          if(document.createRange)x='op8';
            else if(window.navigate)x='op7.5';
                             else x='op7.2';                   }
else if( window.opera && document.compatMode )x='op7';
else if( window.opera && document.releaseEvents )x='op6';
else if( document.contains && !window.opera )x='kq3';
else if(window.pkcs11&&window.XML)x='f15';
else if( window.getSelection && window.atob )x='nn7';
else if( window.getSelection && !document.compatMode )x='nn6';
else if( window.clipboardData && document.compatMode )x='ie6';
else if( window.clipboardData ){x='ie5';
     if( !document.createDocumentFragment ) x+='.5';
     if( document.doctype && !window.print ) x+='m';}
else if( document.getElementById && !document.all ) x='op4';
else if( document.images && !document.all ) x='nn3';
else if(document.clientWidth&&!window.RegExp)x='kq2';
else x='???';

var Ergebnis = x.search(/nn.+/);

if (Ergebnis != -1)
{
	sp= "</font></a></b>&nbsp;&nbsp;&nbsp;\n";
	HTMLstr	="<center>\n"
	HTMLstr += "<table width='780' cellspacing='1' cellpadding='3'>\n";
	HTMLstr += "<tr>\n";
	HTMLstr += "<td align='center' valign='middle' height='20'>\n";
	HTMLstr += "<b><a href='http://www.kleine-weinakademie.de/sitemap.htm'><font face='Arial' color='#FFFFFF' size='2'>Seiten-Übersicht"+sp;
	HTMLstr += "<b><a href='http://www.kleine-weinakademie.de/veranstaltungen.htm'><font face='Arial' color='#FFFFFF' size='2'>Veranstaltungen"+sp;
	HTMLstr += "<b><a href='http://www.kleine-weinakademie.de/kalender.htm'><font face='Arial' color='#FFFFFF' size='2'>Veranstaltungs-Kalender"+sp;
	HTMLstr += "<b><a href='http://www.kleine-weinakademie.de/weinproben.htm'><font face='Arial' color='#FFFFFF' size='2'>Wein-Proben"+sp;
	HTMLstr += "<b><a href='http://www.kleine-weinakademie.de/seminar_konditionen.htm'><font face='Arial' color='#FFFFFF' size='2'>Wein-Seminare"+sp;
	HTMLstr += "<b><a href='http://www.kleine-weinakademie.de/impressum.htm'><font face='Arial' color='#FFFFFF' size='2'>Impressum"+sp;
	HTMLstr += "</td>\n";
	HTMLstr += "</tr>\n";
	HTMLstr += "</table>\n";
	HTMLstr	+=  "</center>\n"
	document.writeln(HTMLstr);
}

else
{
function Menu()
{

	//Aufruf für eigene css-Teile
	MyCSS=""
	MyCSS=MyCSS+"<style type=\"text/css\">";
	MyCSS=MyCSS+"a:link, a:visited { text-decoration:none ;} ;a:hover { text-decoration:underline ;}";
	MyCSS=MyCSS+"</style>";
	document.write(MyCSS);

	this.bgColor     = "#FFFFFF";
	this.menuFont = "xx-small MS Sans Serif";
	this.dot1 = "<img border='0' src='whitedot.gif' width='5' height='5'>"
	this.dot2 = "<img border='0' src='http://www.kleine-weinakademie.de/images/link.gif'>&nbsp;&nbsp;"

	this.addItem    = addItem;
	this.addSubItem = addSubItem;
	this.showMenu   = showMenu;
	this.mainPaneBorder = 1;
	this.subMenuPaneBorder = 1;
	this.subMenuPaneWidth = 240;
	lastMenu = null;
	
	rightY = 0;
	rightX = 0;
	leftY = 0;
	leftX = 0;

	HTMLstr = "";
	HTMLstr += "<!-- MENU PANE DECLARATION BEGINS -->\n";
	HTMLstr += "\n";

	HTMLstr += "<style type='TEXT/CSS'>\n";
	HTMLstr += "<!--\n";
	HTMLstr += ".clsMenuItemIE{text-decoration: none; font: xx-small MS Sans Serif; color: black; cursor: hand;}\n";
	HTMLstr += "A: {text-decoration: none;}\n";
	HTMLstr += "A:focus {color: #770000;}\n";
	HTMLstr += "A:hover {color: #770000;}\n";
	HTMLstr += "-->\n";
	HTMLstr += "</style>\n";

	HTMLstr += "<div id='MainTable' style='position:relative'>\n";
	HTMLstr += "<table width='100%' cellspacing='0' cellpadding='2' bordercolor='#3E3E3E' border='1'>\n";
	HTMLstr += "<tr>";
	HTMLstr += "<!-- MAIN MENU STARTS -->\n";
	HTMLstr += "<!-- MAIN_MENU -->\n";
	HTMLstr += "<!-- MAIN MENU ENDS -->\n";
	HTMLstr += "</tr>\n";
	HTMLstr += "</table>\n";
	HTMLstr += "\n";
	HTMLstr += "<!-- SUB MENU STARTS -->\n";
	HTMLstr += "<!-- SUB_MENU -->\n";
	HTMLstr += "<!-- SUB MENU ENDS -->\n";
	HTMLstr += "\n";
	HTMLstr+= "</div>\n";
	HTMLstr += "<!-- MENU PANE DECALARATION ENDS -->\n";
}

function addItem(idItem, text, hint, location, altLocation)
{
	var Lookup = "<!-- ITEM "+idItem+" -->";
	if (HTMLstr.indexOf(Lookup) != -1)
	{
		alert(idParent + " already exist");
		return;
	}
	var MENUitem = "";
	MENUitem += "\n<!-- ITEM "+idItem+" -->\n";

	{
		MENUitem += "<td bgcolor='#FFFFFF' align='left' bordercolor='#DDDDDD'>\n";
		MENUitem += "<div id='"+idItem+"' style='position:relative; font: "+this.menuFont+";'>\n";
		MENUitem += "<a ";
		MENUitem += "class=clsMenuItemIE ";
		MENUitem += "style='text-decoration: none; font: "+this.menuFont+"; cursor: hand;' ";
		if (hint != null)
			MENUitem += "title='"+hint+"' ";
		if (location != null)
		{
			MENUitem += "href='"+location+"' ";
			MENUitem += "onmouseover=\"hideAll()\" ";
		}
		else
		{
			if (altLocation != null)
				MENUitem += "href='"+altLocation+"' ";
			else
				MENUitem += "href='.' ";
			MENUitem += "onmouseover=\"displaySubMenu('"+idItem+"')\" ";
			MENUitem += "onclick=\"return false;\" "
		}
		MENUitem += ">";
		MENUitem += this.dot1+"\n";
		MENUitem += text;
		MENUitem += "</a>\n";
		MENUitem += "</div>\n";
		MENUitem += "</td>\n";
	}
	MENUitem += "<!-- END OF ITEM "+idItem+" -->\n\n";
	MENUitem += "<!-- MAIN_MENU -->\n";

	HTMLstr = HTMLstr.replace("<!-- MAIN_MENU -->\n", MENUitem);
}

function addSubItem(idParent, text, hint, location)
{
	var MENUitem = "";

	Lookup = "<!-- ITEM "+idParent+" -->";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		alert(idParent + " not found");
		return;
	}
	Lookup = "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		{
			MENUitem += "\n";
			MENUitem += "<div id='"+idParent+"submenu' style='position:absolute; visibility: hidden; width: "+this.subMenuPaneWidth+"; font: "+this.menuFont+"; top: -300;'>\n";
			MENUitem += "<table cellspacing='0' cellpadding='2' bordercolor='#DDDDDD' border='1' width="+this.subMenuPaneWidth+">\n";
			MENUitem += "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
			MENUitem += "</table>\n";
			MENUitem += "</div>\n";
			MENUitem += "\n";
		}
		MENUitem += "<!-- SUB_MENU -->\n";
		HTMLstr = HTMLstr.replace("<!-- SUB_MENU -->\n", MENUitem);
	}

	Lookup = "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";

	if (hint.slice(0,1) == '-') 
	MENUitem = "<tr><td bgcolor='#FFFFFF' align='left'><font face='Arial'; size='1'>"+"&nbsp;&nbsp;"+text+"<br></font></td></tr>\n";
	else MENUitem = "<tr><td bgcolor='#FFFFFF' align='left' bordercolor='#DDDDDD'><a class=clsMenuItemIE title='"+hint+"'href='"+location+"'>"+this.dot2+text+"</a><br></td></tr>\n";
	
	MENUitem += Lookup;
	HTMLstr = HTMLstr.replace(Lookup, MENUitem);
}

function showMenu()
{
	document.writeln(HTMLstr);
}

function displaySubMenu(idMainMenu)
{
	var menu;
	var submenu;

	{
		menu = eval(idMainMenu);
		submenu = eval(idMainMenu+"submenu.style");
		submenu.left = calculateSumOffset(menu, 'offsetLeft');
		submenu.top  = menu.style.top + 22;
		submenu.visibility = "visible";

		if (lastMenu != null && lastMenu != submenu) hideAll();

		leftX  = document.all[idMainMenu+"submenu"].style.posLeft;
		rightX = leftX + document.all[idMainMenu+"submenu"].offsetWidth;

		leftY  = document.all[idMainMenu+"submenu"].style.posTop+
			document.all[idMainMenu+"submenu"].offsetHeight;
		rightY = leftY;
	}
	lastMenu = submenu;
}

function calculateSumOffset(idItem, offsetName)
{
	var totalOffset = 0;
	var item = eval('idItem');
	do
	{
		totalOffset += eval('item.'+offsetName);
		item = eval('item.offsetParent');
	}
	while (item != null);

	if (totalOffset < 5) {totalOffset = totalOffset + 10};
	if (totalOffset > 770) {totalOffset = totalOffset - 60};
	if (totalOffset > 830) {totalOffset = totalOffset - 80};

	return totalOffset;
}

function hideAll()

{
	if (lastMenu != null) {lastMenu.visibility = "hidden";lastMenu.left = 0;}
}
   

function updateIt(e)
{

        var x =  e? e.pageX : window.event.clientX;
        var y =  e? e.pageY : window.event.clientY;

	{


		if (x > rightX || x < leftX) 
			hideAll();
		else 
			if (y > rightY) hideAll();
	}
}


}