//------------------------- CONFIG und INFO
// wichtig!: Include und onmousemove='blende();' im Body-tag nicht vergessen!
// Aufruf im ImageTag!!!(nicht Link und OHNE Sel oder Desel!): onmouseover='showDiv("submenue2",this,"topW",0,2);' onmouseout='ausblenden("submenue",this);'


// Klassendefinition fŸr layeraufrufende Zellen

if(typeof cssnormal == 'undefined')
{
	cssnormal = "subm-container";
}

if(typeof cssselected == 'undefined')
{
	cssselected = "subm-container-sel";
}

//------------------------- ENDE


window.aktDiv = new Array();
window.aktMen = new Array();

function showDiv(ziel,ausloeser,xposition,padX,padY)
{	
	newLayer = document.getElementById(ziel);
	
	///////////// Positionierung
	
	ausloeserX = getLeft(ausloeser);
	ausloeserY = getTop(ausloeser);
	ausloeserW = ausloeserX + ausloeser.offsetWidth;
	ausloeserH = ausloeserY + ausloeser.offsetHeight;
	
	//newLayer.style.position = "absolute";
	
	if (xposition == "topW")
	{
		newLayer.style.left = ausloeserW + padX;
		newLayer.style.top = ausloeserY + padY;
	}
	else if (xposition == "bottomX")
	{
		newLayer.style.left = ausloeserX + padX;
		newLayer.style.top = ausloeserH + padY;
	}
	else
	{
		alert("divDirection ungŸltig");
	}
	
	//////////// Zu weit rechts?
	
	if (getLeft(newLayer)+newLayer.offsetWidth >= document.body.offsetWidth)
	{
		newLayer.style.left = ausloeserW - newLayer.offsetWidth;
	}
	
	//////////// Zu weit rechts? ENDE
	
	///////////// Positionierung Ende
	
	newLayer.style.visibility = "visible";
	
	
	
	////////// Sel-DeSel-Effekt bei Menuepunkten
	
	if (ausloeser.name)
	{
		Sel(ausloeser.name);
	}
	
	///////// Sel-DeSel Ende
	
	window.aktMen[window.aktMen.length] = ausloeser;
	
	if (ausloeser.className == cssnormal)
	{
		csswechsel(ausloeser,cssselected);
	}
}

function ausblenden(ziel, ausloeser)
{
	newLayer = document.getElementById(ziel);
	
	if (testMousepos(ziel) == true)
	{
		window.aktDiv[window.aktDiv.length] = ziel;
	}
	else
	{
		//alert("nope1");
		newLayer.style.visibility = "hidden";
		
		/// CSS
		cssreload();
		
		
		////////// Sel-DeSel-Effekt bei Menuepunkten
	
		if (ausloeser.name)
		{
			Desel(ausloeser.name);
		}
	
		///////// Sel-DeSel Ende
	}
}

function blende()
{
	if (window.aktDiv.length >0)
	{
		i = window.aktDiv.length-1;
		ziel = window.aktDiv[i];
		
		i = window.aktMen.length-1;
		ausloeser = window.aktMen[i];
		
		if(!testMousepos(ziel) && !testMousepos(ausloeser))
		{
			newLayer = document.getElementById(ziel);
			newLayer.style.visibility = "hidden";
	
			window.aktDiv.length=window.aktDiv.length-1.
			
			/// CSS
			cssreload();
			
			////////// Sel-DeSel-Effekt bei Menuepunkten
	
			if (ausloeser.name)
			{
				Desel(ausloeser.name);
			}
	
			///////// Sel-DeSel Ende
		}
	}
}

function cssreload()
{
	
	i = window.aktMen.length-1;
	ausloeser = window.aktMen[i];
			
	if (ausloeser.className == cssselected)
	{
		csswechsel(ausloeser,cssnormal);
		window.aktMen.length=window.aktMen.length-1.
	}	
}

function csswechsel(ziel,cssneu)
{
	ziel.className = cssneu;
}