/*
SW-Handel Menu-Steuerung
--------------------------
[15.04.2006]
Autor: Christian Rüggeberg
http://www.sinus-medien.de
*/
printWIN = null;
function printPage(id) {
	strURL = 'index.php?id=' + id + '&type=98';
    printWIN = window.open(strURL,'Preview','width=675,height=600,left=0,top=0,scrollbars=yes');
    printWIN.focus();
	}

function showLegal() {
    var w2 = window.open('http://www.schwartauer-werke.de/legaldisclaimer/index.php','Impressum','width=500,height=550,left=0,top=0,scrollbars=yes');
    w2.focus();
	}

function getElById(idVal) {
    return (document.getElementById) ? document.getElementById(idVal) : (document.all)?document.all[idVal] : null;
	}

function absLeft(el) {
	return (el.offsetParent) ? el.offsetLeft + absLeft(el.offsetParent) : el.offsetLeft;
	}

function absTop(el) {
	return (el.offsetParent) ? el.offsetTop + absTop(el.offsetParent) : el.offsetTop;
	}

// MenuContainer einblenden
function showMenu(idVal, oObj) {
    if(mcObj = getElById(idVal)) {
		unfoldMenu(mcObj.parentNode);
        mcObj.style.left = absLeft(oObj) + (oObj.offsetWidth-1) + 'px';
        mcObj.style.top = absTop(oObj) + 'px';
        mcObj.style.visibility = 'visible';
        oObj.className = 'act';
	    foldMenuTree(mcObj);
        }
	}

// MenuContainer ausblenden
menuTimer = null;
menuObj = null;
function hideMenu(oObj) {
//	menuObj = oObj;
//	if(menuTimer) window.clearTimeout(menuTimer);
//	menuTimer = window.setTimeout("menuObj.style.visibility='hidden'", 1000);
	}

// MenuContainer aufklappen
function foldMenu(idVal, oObj) {
    if(mcObj = getElById(idVal)) {
		unfoldMenu();
	    mcObj.style['display'] = 'block';
        oObj.className = 'act';
	    foldMenuTree(mcObj);
        }
	}

function foldMenuTree(mcObj){
	mcObj.style.display = 'block';
//	mcObj.previousSibling.childNodes[0].className = 'act';
	mcObj.previousSibling.className = 'act';
	if(mcObj.parentNode != getElById('menue')) foldMenuTree(mcObj.parentNode);
	}

function unfoldMenu(mcObj) {
	if(!mcObj) mcObj = getElById('menue');
	if(mcObj.childNodes.length != 0) {
		for (var i=0; i < mcObj.childNodes.length; i++) {
		var childObj = mcObj.childNodes[i];
			if(childObj.className == 'act') childObj.className = 'no';
			if((childObj.style != null) && (childObj.style.display == 'block')) {
				childObj.style.display = 'none';
				}
			if(childObj.childNodes.length != 0) unfoldMenu(childObj);
			}
		}
	}
