moving = setTimeout('null',1);

function moveOut() {
if (( NS6 && parseInt(ssm.left) < 0 ) || ( IE && ssm.style.pixelLeft < 0 ) || ( NS && document.ssm.left < 0 )) {
clearTimeout(moving);
moving = setTimeout('moveOut()', slideSpeed);

if ( NS6 ) {
ssm.left = parseInt(ssm.left) + 10 +"px";
}

if ( IE ) {
ssm.style.pixelLeft += 10;
}

if ( NS ) {
document.ssm.left += 10;
}
} else {
clearTimeout(moving);
moving = setTimeout('null', 1);
}
}

function moveBack() {
clearTimeout(moving);
moving = setTimeout('moveBack1()', waitTime);
}

function moveBack1() {
if (( NS6 && parseInt( ssm.left ) > ( -menuWidth )) || ( IE && ssm.style.pixelLeft > ( -menuWidth )) || ( NS && document.ssm.left > ( -menuWidth ))) {
clearTimeout(moving);
moving = setTimeout('moveBack1()', slideSpeed);

if ( NS6 ) {
ssm.left = parseInt(ssm.left) - 10 +"px";
}

if ( IE ) {
ssm.style.pixelLeft -= 10;
}

if ( NS ) {
document.ssm.left -= 10;
}
} else {
clearTimeout(moving);
moving = setTimeout('null', 1);
}
}

lastY = 0;

function makeStatic()
{
	winY = getScrollPos("y");

	var NM = document.getElementById('ssm').style;

	if ( document.getElementById )
	{
		if ( winY != lastY&&winY > YOffset - staticYOffset )
		{
			smooth = .2 * ( winY - lastY - YOffset + staticYOffset );
		}
		else
			if ( YOffset - staticYOffset + lastY > YOffset - staticYOffset )
			{
				smooth = .2 * ( winY - lastY );
			}
			else
			{
				smooth = 0;
			}

		if ( smooth > 0 ) {
			smooth = Math.ceil(smooth);
		} else {
			smooth = Math.floor(smooth);
		}

		NM.top = String(staticYOffset+lastY+smooth) + "px";

		lastY = lastY+smooth;
		setTimeout('makeStatic()', 1);
	}
}

function getScrollPos(pos)
{
    var scrollX, scrollY;
    if (document.all)
    {
        if (!document.documentElement.scrollLeft)
            scrollX = document.body.scrollLeft;
        else
            scrollX = document.documentElement.scrollLeft;

        if (!document.documentElement.scrollTop)
            scrollY = document.body.scrollTop;
        else
            scrollY = document.documentElement.scrollTop;
    }
    else
    {
        scrollX = 0; //window.pageXOffset;
        scrollY = 0; // window.pageYOffset;
    }
    return pos=="x" ? scrollX : scrollY;
}


function init()
{
	if ( NS6 )
	{
		ssm = document.getElementById("ssm").style;
		ssm.visibility = "visible";
		ssm.left = -menuWidth;
	}
	else
		if ( IE )
		{
			ssm.style.visibility = "visible";
			ssm.style.pixelLeft = -menuWidth;
		}
		else
			if ( NS )
			{
				document.ssm.left = -menuWidth;
				document.ssm.visibility = "show";
			}

	showMenu();

	if ( menuIsStatic == "yes")
	{
		makeStatic();
	}
}


var actualItem = "";
var menuitem  = new Array();
var Item = new Array();

addItem                 = function(id, text, parent, link, target)
{
    text = text.replace("'", "&#39;");
    if(parent==0)
    {
        counter = menuitem.length;
        Item[id] = ""+counter;
        menuitem[counter] = new assignItem(id, text, parent, link, target);
    }
    else
    {
        structure = Item[parent].split(",");
        todo = "menuitem["+structure[0]+"]";
        for(i=1;i<structure.length;i++)
        {
            todo += ".menuitem["+structure[i]+"]";
        }
        todo1 = todo+".menuitem.length";
        counter = eval(todo1);
        Item[id] = Item[parent]+","+counter;
        todo1 = todo + ".menuitem["+counter+"] = new assignItem("+id+",'"+text+"',"+parent+",'"+link+"','"+target+"')";
        eval(todo1);
    }
}

// weist die Werte den einzelnen Men&uuml;elementen zu
assignItem              = function(id, text, parent, link, target)
{
    this.id         = id;
    this.text       = text;
    this.parent     = parent;
    this.link       = link;
    this.target     = target;
    this.collapse   = 1;
    this.menuitem   = new Array();
}

// baut die Anzeige zusammen
showMenu                            = function()
{
	menuitem  = new Array();
 	Item = new Array();
 	setItems();
    if( Item[ actualItem])
    {
        struc = Item[ actualItem].split(",");
        if( struc.length)
        {
            todo = "menuitem["+struc[0]+"]";
            eval( todo+".collapse = 0");
            for(i=1;i<struc.length;i++)
            {
                todo += ".menuitem["+struc[i]+"]";
                eval( todo + ".collapse = 0");
            }
        }
    }
    var text = '<table border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="'+ hdrBGColor +'"><table border="0" cellspacing="1" cellpadding="0" width="'+ menuWidth +'">';
    level = new Array();
    depth = 0;
    level[0] = 0;
    while(depth > -1)
    {
        quest = "";
        for(i=0; i<depth; i++)
        {
            quest += "menuitem["+level[i]+"].";
        }
        quest1 = quest + "menuitem.length";
        if((level[depth] < eval(quest1)))
        {
            tabs = "";
            for(i=1; i<=depth; i++)
            {
                quest6 = "";
                for(j=0;j<(i-1);j++)
                {
                    quest6 += "menuitem["+level[j]+"].";
                }
                quest6 += "menuitem.length";
            }
            quest2 = quest + "menuitem["+level[depth]+"].text";
            quest3 = quest + "menuitem["+level[depth]+"].id";
            quest4 = quest + "menuitem["+level[depth]+"].menuitem.length";
            quest5 = quest + "menuitem["+level[depth]+"].link";
            quest7 = quest + "menuitem["+level[depth]+"].target";
            quest8 = quest + "menuitem["+level[depth]+"].collapse";
            linkText = eval( quest2);
            if( eval( quest4) > 0 || depth==0)
            	linkText = '<strong>'+linkText+'</strong>';
			if( eval(quest5+".length"))
            {
                tabs += '&nbsp;<a href="'+ eval(quest5) +'&actualItem=' + eval(quest3) + '"' + ( eval(quest7) == "_self" ? '' : ' target="' + eval( quest7) +'"') + ' onfocus="this.blur()"><font color="#006699">'+ linkText +'</font></a>';
            }
            else
            {
                tabs += '&nbsp;<a href="javascript:actualItem=' + eval(quest3) + '; showMenu();" onfocus="this.blur()"><font color="#006699">'+ linkText +'</font></a>';
            }
            if( depth == 0)
            {
            	if( eval( quest8) == 0)
            	{
            		text += '<tr><td bgcolor="'+ linkBGColor +'" onmouseover="bgColor=\''+ linkOverBGColor +'\'" onmouseout="bgColor=\''+ linkBGColor +'\'">' + tabs + '</td></tr>'
				}
				else
				{
					text += '<tr><td bgcolor="'+ linkOverBGColor +'" onmouseover="bgColor=\''+ linkBGColor +'\'" onmouseout="bgColor=\''+ linkOverBGColor +'\'">'+ tabs + '</td></tr>'
                }
            }
            else
            {
            	if( eval( quest8) == 0)
            	{
                	text += '<tr><td bgcolor="'+ linkBGColor +'" onmouseover="bgColor=\''+ linkOverBGColor +'\'" onmouseout="bgColor=\''+ linkBGColor +'\'"><table border="0" cellpadding="0" cellspacing="0"><tr>';
                }
                else
                {
					text += '<tr><td bgcolor="'+ linkOverBGColor +'" onmouseover="bgColor=\''+ linkBGColor +'\'" onmouseout="bgColor=\''+ linkOverBGColor +'\'"><table border="0" cellpadding="0" cellspacing="0"><tr>';
				}
                text += '<td width="' + (5*depth) + '"><img src="images/transparent.gif" width="' + (5*depth) + '" border="0"></td>';
                text += '<td width="' + (menuWidth-(5*depth)) + '">' + tabs + '</a></td></tr></table></td></tr>';
            }

            if((eval(quest4) > 0) && (eval(quest8)==0))
            {
                depth++;
                level[depth]=-1;
            }
        }
        else
        {
            depth--;
        }
        level[depth]++;
    }
    text += '</td></tr></table></td><td valign="bottom" bgcolor="'+ hdrBGColor +'"><img src="./images/menu.gif" border="0" width="15"></td></tr>';
    text += '<tr><td bgcolor="'+ hdrBGColor +'"><img src="./images/transparent.gif" border="0" width="1" height="1"></td><td bgcolor="'+ hdrBGColor +'"><img src="./images/transparent.gif" border="0" width="15" height="15"></td></tr></table>';
    if(document.getElementById("ssm"))
    {
        document.getElementById("ssm").innerHTML = text;
    }
    else
    {
        document["ssm"].document.open();
        document["ssm"].document.write(text);
        document["ssm"].document.close();
    }
}

function OpenWindow(strZiel, strName, intWidth)
{
   	// If txteintag has a value, the lookup window starts in month of the date
   	var test = strZiel;
	var result = test.match( /toform=[^&]+/)
	var result1 = (test+'&').match( /toelm=[^&]+/)
	var formname = "";
	var elementname = "";
	if( result.length > 0)
	{
		parts = result[0].split( '=');
		if( parts.length > 1)
		{
			formname = parts[1];
		}
	}
	if( result1.length > 0)
	{
		parts1 = result1[0].split( '=');
		if( parts1.length > 1)
		{
			elementname = parts1[1];
		}
	}
	if( formname.length > 0 && elementname.length > 0 && document.forms[ formname].elements[ elementname])
	{
		if ( document.forms[ formname].elements[ elementname].value.length > 0)
   		{
   			try
   			{
	      		var elemente = document.forms[ formname].elements[ elementname].value.split(".");
    	  		var intMonth = elemente[1];
      			var intYear = elemente[2];
      			strZiel = strZiel + "&year=" + intYear + "&month=" + intMonth;
      		}
      		catch( e) { alert(e.message);}
   		}
   	}
   	Test = window.open(strZiel, strName, 'width='+intWidth+',height=175,scrollbars=no');
   	Test.focus();
}

setImage = function( val, formfield)
{
	t = formfield.split( ",");
	document.forms[ t[ 0]].elements[ t[ 1]].value = val;
	if( document.images[ t[ 1]])
	{
		document.images[ t[ 1]].src = val;
		document.images['del_logo'].src = './images/DeleteRow.gif';
	}
}