var actCatID = 0;
var actCatsL2 = 0;

function showCatLayer2(catID, catHeight, actHeight) {
	if(catID != actCatID) {
		/*if(!actHeight) {
			// Neue Kategorie einfaerben
			js_showCat = document.getElementById('js_showCat_'+catID);
			js_showCat.style.className = 'leftCategorieL1_';
		}*/
		if(actCatID && !actHeight) {
			for(i = 0; i < actCatsL2; i++) {
				js_catL2 = document.getElementById('js_catL2_'+actCatID+'_'+i);
				js_catL2.style.visibility = 'hidden';
				js_catL2.style.display    = 'none';
			}
			js_catL1   = document.getElementById('js_cat_'+actCatID);
			//js_showCat = document.getElementById('js_showCat_'+actCatID);
			js_catDw   = document.getElementById('js_catDown_'+actCatID);
			// Alte Kategorie ausblenden
			js_catL1.style.height     = '0px';
			//js_showCat.className      = 'leftCategorieL1';
			js_catDw.style.visibility = 'hidden';
			js_catDw.style.display    = 'none';
		}
		if(catHeight-actHeight > 0) {
			// Neue Kategorie einblenden
			document.getElementById('js_cat_'+catID).style.height = actHeight+'px';
			if(actHeight) {
				js_catL2 = document.getElementById('js_catL2_'+catID+'_'+(actHeight/28-1));
				js_catL2.style.visibility = 'visible';
				js_catL2.style.display    = 'block';
			} else {
				ja_catDw = document.getElementById('js_catDown_'+catID);
				ja_catDw.style.visibility = 'visible';
				ja_catDw.style.display    = 'block';
			}
			setTimeout("showCatLayer2("+catID+", "+catHeight+", "+(actHeight+28)+");", 5);
		} else {
			actCatID  = catID;
			actCatsL2 = (catHeight-10)/28;
		}
	} else {
		for(i = 0; i < actCatsL2; i++) {
			js_catL2 = document.getElementById('js_catL2_'+actCatID+'_'+i);
			js_catL2.style.visibility = 'hidden';
			js_catL2.style.display    = 'none';
		}
		js_catL1   = document.getElementById('js_cat_'+actCatID);
		//js_showCat = document.getElementById('js_showCat_'+actCatID);
		js_catDw   = document.getElementById('js_catDown_'+actCatID);
		// Alte Kategorie ausblenden
		js_catL1.style.height     = '0px';
		//js_showCat.className      = 'leftCategorieL1';
		js_catDw.style.visibility = 'hidden';
		js_catDw.style.display    = 'none';
		actCatID  = 0;
		actCatsL2 = 0;
	}
}

function changeStatus(catid, nodeCat) {
	if( typeof(catStatus[catid]) == 'undefined' ) {catStatus[catid] = true;}
	else {catStatus[catid] = ~catStatus[catid];}
	var cssClass = 'leftCategorieL2';
	if(catStatus[catid] == true) {
		cssClass += '_';
		var nodeHaken = document.getElementById('tplCatSel').cloneNode(true);
		nodeHaken.id = 'js_catSel_'+catid;
		nodeHaken.style.visibility = 'visible';
		nodeHaken.style.display    = 'block';
		document.getElementById('js_td_'+catid).appendChild(nodeHaken);
	} else {
		var nodeTd = document.getElementById('js_td_'+catid);
		while(nodeTd.childNodes.length > 0) {
			nodeTd.removeChild(nodeTd.lastChild);
		}
	}
	nodeCat.className = cssClass;
	nodeCat.style.visibility = 'visible';
	nodeCat.style.display    = 'block';
	// Cookie setzen
	var cookieText = '';
	for(i=0;i<catStatus.length;i++) {
		if(catStatus[i] == true) {cookieText += i+',';}
	} cookieText = cookieText.slice(0, cookieText.length-1);
	//alert(cookieText);
	document.getElementById('js_cookieCats').value = cookieText;
	right_umkreis();
}
