/*
Script verschiebt die DIVs für die SUBMENU_ON_TOP, entsprechend der Bildschirmauflösung des besuchenden Rechners
*/

var posLeftIE=0;
var oldPosx;

function resetSubMenu(div,range, breitePage)
	{
	posLeftIE+=parseInt(range);
	
	var ua = window.navigator.userAgent
	var msie = ua.indexOf ( "MSIE " )

	var posx = document.getElementById('main'+div).offsetLeft;

	if (msie > 0)
		{
		posx=posLeftIE;
		}
	
	posx=posx / parseInt(div) + parseInt(range);

	//alert("POSxIE "+posx);

	if (msie > 0)
		{
		posx*=range;
		}

	if (div == 0)
		{
		posx=range*range;
		}
		
	if (breitePage == 0 && div != 0)
		{
		if (msie < 0)
			{
			//Firefox
				posx=posx^parseInt(div);
			}
		if (msie > 0)
			{
			posx=parseInt(posx)/parseInt(range);	
			posx=(parseInt(posx)/range)*55; //Die 55 sind ausgedacht, bzw.probiert
			//alert("posX backcalc "+posx);
			}
		}

	if (breitePage >= 0 && div != 0 && msie > 0)
		{
		posx=posx+parseInt(range) - (parseInt(breitePage)/3) - range/2;
		// Wenn das alte POSx kleiner ist, als das aktuelle, dann ist was nicht OK... :-(
		if(oldPosx > posx)
			{
			posx+=90;
			//alert(oldPosx +"<" + posx + "bei DIV "+div)  
			}
		}
		

	
	posx*=(-1);
//	alert(posx + "DIV: "+div + " ("+oldPosx+")");

	oldPosx = posx*(-1);

	
	//alert(posx + " für div: "+div + " mit Range: "+range);
	document.getElementById(div).style.marginLeft = posx+"px";
	
}