// @ SPW 2002 - All Rights Reserved
// You may not use this script or any part of it
// on any web site without
// proper license from SPW GmbH. 
// Email info@spw.info
// for purchase and licensing details.

// ******************************************************
// find the settings that you might want to modify below

var wmenuBackgroundColor = "#DDDDDD";
var wmenuBackgroundHLColor = "#50E0E0"; //hiliting color for background
var wmenuFontColor = "Black";
var wmenuFontHLColor = "White"; //hiliting font color
var wmenuTitleFontSize = "12";
var wmenuFontSize = "12";
var wmenuTitleFontFamily = "sans-serif"; // "serif" or "sans-serif" or "monospace" etc.
var wmenuFontFamily = "sans-serif"; // "serif" or "sans-serif" or "monospace" etc.

if (vr_lang == "ENGLISH")
{
var wmenuTitles = new Array ('<A CLASS="hoverlink" href="'+WMenuTopLink+'">NEW<img align="absmiddle" src="/images/world34d19x19slow.gif" width="19" height="19" border="0">IMAGES</A>','');
}
else
{
var wmenuTitles = new Array ('<A CLASS="hoverlink" href="'+WMenuTopLink+'">W<img align="absmiddle" src="/images/world34d19x19slow.gif" width="19" height="19" border="0">CHENSCHAU</A>','');
}

// style="padding-top : 4px;" 
var wmenuCount = new Array (3,0);

var CurrentModule;
if (CurrentModule == "fotos")
	{
	wmenuTitles[wmenuTitles.length] = 'Auswahl';
	wmenuCount[wmenuCount.length] = 6;
	}
if (CurrentModule == "werke")
	{
	wmenuTitles[wmenuTitles.length] = 'Auswahl';
	wmenuCount[wmenuCount.length] = 5;
	}

var allWMenus = new Array();
if (vr_lang == "ENGLISH")
{
allWMenus ['1x1'] = 'as Images (Last 3 Weeks)';
allWMenus ['1x2'] = 'as Stories (Last 3 Weeks)';
allWMenus ['1x3'] = 'Choose Timespan (Advanced Search)...';
}
else
{
allWMenus ['1x1'] = 'in Bildern (letzte 3 Wochen)';
allWMenus ['1x2'] = 'in Listenform (letzte 3 Wochen)';
allWMenus ['1x3'] = 'freier Zeitraum (erweiterte Suche)...';
}
var allWMenuLinks = new Array();
allWMenuLinks ['1x1'] = "document.location='" + WMenuImageLink + "'";
allWMenuLinks ['1x2'] = "document.location='" + WMenuStoryLink + "'";
allWMenuLinks ['1x3'] = "document.location='/bild/search.cfm?SearchStyle=advanced'";


var wmenuWidth = 270;
var wmenuHeight = 23;
var wmenuLeft = 329;
if (vr_lang != "ENGLISH")
	{wmenuLeft = wmenuLeft - 15};
var wmenuTop = 20;
if ((macOrWin == "Mac") && (browserName == "IE"))
	{wmenuTop = wmenuTop + 2;}
else if  ((macOrWin == "Mac") && (browserName == "Netscape"))
	{wmenuTop = wmenuTop + 8;}
else if  ((macOrWin == "Mac") && (browserName == "Netscape6"))
	{wmenuTop = wmenuTop - 2;}
else if  ((macOrWin == "Win") && (browserName == "Netscape6"))
	{wmenuTop = wmenuTop - 7;}
else if  ((macOrWin == "Win") && (browserName == "Netscape"))
	{wmenuTop = wmenuTop + 8;}
	
var wmenuHSpacing = 160;
var wmenuTimeout = 2 *1000;

var onClickWrapperStart = ''; 
// will be 'document.location=\'' for a normal link,
// can also be '' for javascripts in the wmenu,
// in this case a wmenu item must be written like
// allWMenuLinks ['3x2'] = "alert('Hello')";
var onClickWrapperEnd = ''; // will be '\'' for a normal link, can also be '' for javascripts in the wmenu

// normally you would want to change anything below this point
// ***********************************************************

var wmenuhidetimeout = new Array();
for (var i = 0; i < wmenuCount.length; i++)
{
	wmenuhidetimeout[i];
}

var cursorName;
var leftPosModifier;
var vWMenuSpaceModifier;
var wmenuHeightModifier;
var topPosModifier;

if ((macOrWin == "Mac") && (browserName == "IE"))
	{
		leftPosModifier = 0;
		topPosModifier = -2;
		cursorName = "hand";
		vWMenuSpaceModifier = 0;
		vWMenuSpaceModifier = -1;
		wmenuHeightModifier = 0;
	}
	else if ((macOrWin == "Win") && (browserName == "IE"))
	{
		leftPosModifier = -25;
		topPosModifier = -7;
		cursorName = "hand";
		vWMenuSpaceModifier = -1;
		wmenuHeightModifier = 0;
	}
	else if ((macOrWin == "Mac") && (browserName == "Netscape"))
	{
		leftPosModifier = 0;
		topPosModifier = -15;
	  	cursorName = "pointer";
	  	vWMenuSpaceModifier = -2;
	  	wmenuHeightModifier = 0;
	}
	else if ((macOrWin == "Win") && (browserName == "Netscape"))
	{
		leftPosModifier = 0;
		topPosModifier = -15;
	  cursorName = "pointer";
	  vWMenuSpaceModifier = -2;
		wmenuHeightModifier = 0;
	}
	else if ((macOrWin == "Mac") && (browserName == "Netscape6"))
	{
		leftPosModifier = 0;
		topPosModifier = -5;
	 	cursorName = "pointer";
	 	vWMenuSpaceModifier = -1;
		wmenuHeightModifier = -5;
	}
	else
	{
		leftPosModifier = 0;
		topPosModifier = 0;
	 	cursorName = "pointer";
	 	vWMenuSpaceModifier = 0;
		wmenuHeightModifier = 0;
	}

var thisWMenuTop;
document.writeln('<style type=\"text/css\">');
for (var i = 0; i < wmenuCount.length; i ++)
{
	// write the wmenu headers
	document.writeln ('#wmenuheader',i,' {');
	document.writeln ('position: absolute;');
	document.writeln ('left: ',wmenuLeft+(i*wmenuWidth)+(i*wmenuHSpacing),'px;');
	document.writeln ('top: ',wmenuTop+topPosModifier,'px;');
	document.writeln ('width: 143px;');
	document.writeln ('height: ',wmenuHeight+wmenuHeightModifier,'px;');
	//document.write ('background-color: ',wmenuBackgroundColor,';');
	//if (document.layers){document.write ('layer-background-color: ',wmenuBackgroundColor,';');}
	document.write ('color: #666666;');
	document.write ('padding-left: 3px;');
	document.write ('padding-top: 3px;');
	document.write ('font-size: 18px;');
	//document.writeln ('border-width : 1px;');
	//document.writeln ('border-color : #10A0A0;');
	//document.write ('border-style : solid;');
	document.write ('font-family: "Courier New", Courier, mono;');
	//document.write ('visibility : visible;');
	if (!(document.layers)) {document.write ('cursor: ',cursorName,';');}
	document.write ('}');
	// end write the wmenu headers
	
	for (var j = 0; j < wmenuCount[i]; j++)
	{
	document.write ('#wmenu',i,'x',j,' {');
	document.write ('position: absolute;');
	thisWMenuTop = parseInt(topPosModifier + wmenuTop + ((j+1)*wmenuHeight) + ((j+1)*vWMenuSpaceModifier));
	document.write ('left: ',wmenuLeft+(i*wmenuWidth)+(i*wmenuHSpacing),'px;');
	document.write ('top: ', thisWMenuTop,'px;');
	document.write ('width: ',wmenuWidth,'px;');
	document.write ('height: ',wmenuHeight+wmenuHeightModifier,'px;');
	document.write ('background-color: ',wmenuBackgroundColor,';');
	if (document.layers){document.write ('layer-background-color: ',wmenuBackgroundColor,';');}
	document.write ('color: ',wmenuFontColor,';');
	document.write ('padding-left: 3px;');
	document.write ('padding-top: 3px;');
	document.write ('font-size: ',wmenuFontSize,'px;');
	document.write ('border-width : 1px;');
	document.write ('border-color : #10A0A0;');
	document.write ('border-style : solid;');
	document.write ('font-family: "Courier New", Courier, mono;');
	//if (!(document.layers))
	//{
	document.write ('visibility : hidden;');
	//}
	if (!(document.layers)) {document.write ('cursor: ',cursorName,';');}
	document.write ('}');
	
	if (document.layers) // for netscape 4 we have to create hilite wmenu layers
		{
		document.write ('#wmenu',i,'x',j,'hilite {');
		document.write ('position: absolute\;');
		document.write ('left: ',wmenuLeft+(i*wmenuWidth)+(i*wmenuHSpacing),'px\;');
		document.write ('top: ',thisWMenuTop,'px\;');
		document.write ('width: ',wmenuWidth,'px\;');
		document.write ('height: ',wmenuHeight+wmenuHeightModifier,'px\;');
		document.write ('layer-background-color: ',wmenuBackgroundHLColor,'\;');
		document.write ('color: ',wmenuFontHLColor,'\;');
		document.write ('padding-left: 3px\;');
		document.write ('padding-top: 3px\;');
		document.write ('font-size: ',wmenuFontSize,'px\;');
		document.write ('border-width : 1px\;');
		document.write ('border-color : #10A0A0\;');
		document.write ('border-style : solid\;');
		document.write ('font-family: ',wmenuFontFamily,';');
		document.write ('visibility : hidden;');
		document.write ('}');
		}
	
	} // for netscape 4 we have to create hilite wmenu layers END
}
document.write ('</style>');

var visible;
var hidden;

if (document.layers)
	{visible = "show";hidden="hide";}
else
	{visible = "visible";hidden="hidden";}
		
var wmenuItems = new Array ();
var wmenus = new Array(wmenuItems);

var wmenuItemsHilite;
var wmenusHilite;

if (document.layers) // we need hilight layers for NS4
{
	wmenuItemsHilite = new Array ();
	wmenusHilite = new Array(wmenuItemsHilite);
}


	
function ReferenceWMenu()
{
	
	for (var i = 0; i < wmenuCount.length; i ++)
	{
	
	for (var j = 0; j < wmenuCount[i]; j++)
	{
	//alert (i +'x' + j);
	
	if (document.all)
	{
		wmenuItems[j] = document.all['wmenu'+i+'x'+j].style;
		
	}
	
	else if (document.layers)
	{
		wmenuItems[j] = document.layers['wmenu'+i+'x'+j];
		wmenuItemsHilite[j] = document.layers['wmenu'+i+'x'+j+'hilite'];
		
	}
	
	else if (document.getElementById)
	{
		wmenuItems[j] = document.getElementById('wmenu'+i+'x'+j).style;
	}
	
	//wmenus[i][j].zIndex = 100;
	} // loop through the items
	wmenus[i] = wmenuItems;
	wmenuItems = new Array();
	if (document.layers)
		{
		wmenusHilite[i] = wmenuItemsHilite;
		wmenuItemsHilite = new Array();
		}
	} // loop through the wmenus
	
}

function HiliteWMenu(whichWMenu, whichItem)
{
	clearTimeout(wmenuhidetimeout[whichWMenu]);
	
	if (!(document.layers))
	{
		wmenus[whichWMenu][whichItem].backgroundColor= wmenuBackgroundHLColor;
		wmenus[whichWMenu][whichItem].color= wmenuFontHLColor;
	}
	else
	{
		wmenusHilite[whichWMenu][whichItem].visibility = visible;
		wmenus[whichWMenu][whichItem].visibility = hidden;
	}
	
}

function UnHiliteWMenu(whichWMenu, whichItem)
{
	
	wmenuhidetimeout[whichWMenu] = setTimeout("HideWMenu("+whichWMenu+");",wmenuTimeout);
	
	if (!(document.layers))
	{
		wmenus[whichWMenu][whichItem].backgroundColor= "#DDDDDD";
		wmenus[whichWMenu][whichItem].color= "Black";
	}
	else
	{
		wmenus[whichWMenu][whichItem].visibility = visible;
		wmenusHilite[whichWMenu][whichItem].visibility = hidden;
	}

}

function ShowWMenu (whichWMenu)
{
	clearTimeout(wmenuhidetimeout[whichWMenu]);
	wmenuhidetimeout[whichWMenu] = setTimeout("HideWMenu("+whichWMenu+");",wmenuTimeout);
	for (var thewmenuItem in wmenus[whichWMenu])
	{
		wmenus[whichWMenu][thewmenuItem].visibility = visible;
	}
}

function HideWMenu (whichWMenu)
{
	for (var thewmenuItem in wmenus[whichWMenu])
	{
		wmenus[whichWMenu][thewmenuItem].visibility = hidden;
		if (document.layers) {wmenusHilite[whichWMenu][thewmenuItem].visibility = hidden;}
	}
}


function InitSPWWMenu ()
{
	
	ReferenceWMenu();
	
}

function InitSPWWMenuBody ()
{
	
	document.writeln(InsertWMenuLayers());
	
}

function InsertWMenuLayers ()
{
	var theLayertag;
	var theLayersHTML;
	var menIdx;
	var	menItemIdx;
		
	if (document.layers)
	{
	//theLayertag = "layer";
	theLayertag = "div";
	}
	else
	{
	theLayertag = "div";
	}
	
	theLayersHTML = "";
	
	for (var i = 0; i < wmenuCount.length; i ++)
	{
	theLayersHTML = theLayersHTML + '<' + theLayertag;
	theLayersHTML = theLayersHTML + ' id=\"' + 'wmenuheader'+i+'\"';
	//theLayersHTML = theLayersHTML + ' onClick=\"ShowWMenu('+i+')\;\"';
	theLayersHTML = theLayersHTML + ' onMouseOver=\"ShowWMenu('+i+')\;\"';
	theLayersHTML = theLayersHTML + '>';
	if (document.layers) 
		{
		theLayersHTML = theLayersHTML + '<a href=\"##\" onClick=\"ShowWMenu('+i+')\;\" onmouseOver=\"ShowWMenu('+i+')\;\"';
		theLayersHTML = theLayersHTML + '>';
		}
	theLayersHTML = theLayersHTML + wmenuTitles[i];
	if (document.layers) 
		{
		theLayersHTML = theLayersHTML + '</a>';
		}
	theLayersHTML = theLayersHTML + '</'+theLayertag+'>\n';
	
	for (var j = 0; j < wmenuCount[i]; j++)
	{
	menIdx = i+1;
	menItemIdx = j+1;
	theLayersHTML = theLayersHTML + '<' + theLayertag;
	theLayersHTML = theLayersHTML + ' id=\"' + 'wmenu'+i+'x'+j+ '\"';
	theLayersHTML = theLayersHTML + ' onClick=\"'+onClickWrapperStart+eval("allWMenuLinks ['"+menIdx+'x'+menItemIdx+"']")+onClickWrapperEnd+';return false;\"';
	theLayersHTML = theLayersHTML + ' onMouseOver=\"HiliteWMenu('+i+','+j+')\;\"';
	theLayersHTML = theLayersHTML + ' onMouseOut=\"UnHiliteWMenu('+i+','+j+')\;\"';
	theLayersHTML = theLayersHTML + '>';
	if (document.layers) 
		{
		theLayersHTML = theLayersHTML + '<a href=\"##\"';
		theLayersHTML = theLayersHTML + ' onClick=\"'+onClickWrapperStart+eval("allWMenuLinks ['"+menIdx+'x'+menItemIdx+"']")+onClickWrapperEnd+';return false;\"';
		theLayersHTML = theLayersHTML + ' onMouseOver=\"HiliteWMenu('+i+','+j+')\;\"';
		theLayersHTML = theLayersHTML + ' onMouseOut=\"UnHiliteWMenu('+i+','+j+')\;\"';
		theLayersHTML = theLayersHTML + '>';
		}
	theLayersHTML = theLayersHTML + eval("allWMenus ['"+menIdx+'x'+menItemIdx+"']");
	if (document.layers) 
		{
		theLayersHTML = theLayersHTML + '</a>';
		}
	theLayersHTML = theLayersHTML + '</'+theLayertag+'>\n';
	if (document.layers)
		{
		theLayersHTML = theLayersHTML + '<' + theLayertag;
		theLayersHTML = theLayersHTML + ' id=\"' + 'wmenu'+i+'x'+j+'hilite' + '\"';
		theLayersHTML = theLayersHTML + ' onMouseOver=\"HiliteWMenu('+i+','+j+')\;\"';
		theLayersHTML = theLayersHTML + ' onMouseOut=\"UnHiliteWMenu('+i+','+j+')\;\"';
		theLayersHTML = theLayersHTML + '>';
		theLayersHTML = theLayersHTML + '<a href=\"##\"';
		theLayersHTML = theLayersHTML + ' onClick=\"'+onClickWrapperStart+eval("allWMenuLinks ['"+menIdx+'x'+menItemIdx+"']")+onClickWrapperEnd+';return false;\"';
		theLayersHTML = theLayersHTML + ' onMouseOver=\"HiliteWMenu('+i+','+j+')\;\"';
		theLayersHTML = theLayersHTML + ' onMouseOut=\"UnHiliteWMenu('+i+','+j+')\;\"';
		theLayersHTML = theLayersHTML + '>';
		theLayersHTML = theLayersHTML + eval("allWMenus ['"+menIdx+'x'+menItemIdx+"']");
		theLayersHTML = theLayersHTML + '</a>';
		theLayersHTML = theLayersHTML + '</'+theLayertag+'>\n';
		}
	} // loop through items END
	} // loop through wmenus END
	
	return theLayersHTML;
}

// to use the wmenus, insert onload="InitSPWWMenu();" into the body tag
// and a javascript containing
// InitSPWWMenuBody();
// into the body itself */

// @ SPW 2002 - All Rights Reserved
// You may not use this script or any part of it
// on any web site without
// proper license from SPW GmbH. 
// Email info@spw.info
// for purchase and licensing details.
