
function delClassName(objElement, strClass) {
	if (objElement.className) {
		var arrList = objElement.className.split(' ');
		var strClassUpper = strClass.toUpperCase();
		for ( var i = 0; i < arrList.length; i++) {
			if (arrList[i].toUpperCase() == strClassUpper) {
				arrList.splice(i, 1);
				i--;
			}
		}
		objElement.className = arrList.join(' ');
	}
}

function addClassName(objElement, strClass, blnMayAlreadyExist) {
	if (objElement.className) {
		var arrList = objElement.className.split(' ');
		if (blnMayAlreadyExist) {
			var strClassUpper = strClass.toUpperCase();
			for ( var i = 0; i < arrList.length; i++) {
				if (arrList[i].toUpperCase() == strClassUpper) {
					arrList.splice(i, 1);
					i--;
				}
			}
		}
		arrList[arrList.length] = strClass;
		objElement.className = arrList.join(' ');
	}
	else {
		objElement.className = strClass;
	}

}


//function toggleVisual() {
//
//	vis = document.getElementById('visual');
//	hvis = document.getElementById('hidevisual');
//	anchors = hvis.getElementsByTagName('a');
//
//	anc = anchors[0];
//
//	if (vis.clientHeight === 300) {
//		vis.style.height = 0;
//		//hvis.style.width = '100%';
//		els = document.getElementsByTagName('body');
//		if (els[0].id == 'index') {
//			hvis.style.width = '320px';
//		} else {
//			hvis.style.width = '226px';
//		}
//		anc.firstChild.data = 'Bild einblenden';
//		anc.style.backgroundImage = 'url(/fileadmin/_img/ico/ico_showvis_12x13.png)';
//	} else {
//		vis.style.height = '300px';
//
//		els = document.getElementsByTagName('body');
//		if (els[0].id == 'index') {
//			hvis.style.width = '320px';
//		} else {
//			hvis.style.width = '226px';
//		}
//		anc.firstChild.data = 'Bild ausblenden';
//		anc.style.backgroundImage = 'url(/fileadmin/_img/ico/ico_hidevis_12x13.png)';
//	}
//}

function toggleVisual() {
	vis = document.getElementById('visual');
	var state;
	if(vis.style.display == "") {
		state = vis.clientHeight == 0;
	}
	else {
		state = vis.style.display == 'none' ? 1 : 0;
	}
	vis.style.display = state ? 'block' : 'none';	
	vistop = document.getElementById('hidevisual');
	vistop.innerHTML = '<a class="' + (state ? 'close' : 'open') + '" href="javascript:toggleVisual()">Bild ' + (state ? 'ausblenden' : 'einblenden') + '</a>';
}

function subShow(el) {
	el.parentNode.lastChild.style.display = 'block';
}

function subHide(el) {
	el.parentNode.lastChild.style.display = 'none';
}

function divShow(el) {
	addClassName(el.parentNode, 'active');
	el.style.display = 'block';
}

function divHide(el) {
	el.style.display = 'none';
	delClassName(el.parentNode, 'active');
}

