var layerDropDownIdCheck = null;
var layerDropDownArray = new Array();

function LayerDropDown(layer, elementType, content, newClass, collapseOldElement, href, swapIco, show) {
	
	// layer				= Element welches aufgeklappt werden soll
	// elementType			= Typ für das Titelelement ("div" , "h1"...)
	// content				= Text welcher im Titelelement stehen soll
	// newClass				= css Klasse für das Titelelement
	// collapseOldElement	= wenn true, wird ein geöffnetes Element geschlossen wenn ein anders angeklickt wird
	// href					= wenn true, wird Text in Titelelement als link behandelt
	// swapIco				= Bildwechsel backgroundImage (true || false)
	// show					= Blendet Container ein.
	
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	
	// Constructor
	
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	
	var href1					= (href)?"<a href='#' onclick='return false;'>":"";
	var href2					= (href)?"</a>":"";
	var imgActive				= "_active.gif";
	var imgInactive			= "_inactive.gif";
	
	this.layer					= document.getElementById(layer);
	this.layer.style.display	= "none";
	//this.layer.style.display	= "none";
	layerDropDownArray.push(this.layer);
	
	this.balken					= document.createElement(elementType);
	this.balken.style.cursor	= "pointer";
	this.balken.className		= (newClass)?newClass:null;
	this.balken.innerHTML		= href1 + content + href2;
	this.balken.layer			= this.layer;
	this.balken.root			= this;
	this.layer.parentNode.insertBefore(this.balken, this.layer);
	
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	
	// Methoden
	
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.expandLayer = function() {
		this.layer.style.display = "block";
	}
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.hideLayer = function() {
		this.layer.style.display = "none";
	}
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.collapseOldLayer = function() {
		if (collapseOldElement) {
			if (layerDropDownIdCheck != this.layer && layerDropDownIdCheck) {
				if(swapIco && layerDropDownIdCheck.style.display != "none") this.swapIcon(layerDropDownIdCheck.previousSibling);
				layerDropDownIdCheck.style.display = "none";
			}
			layerDropDownIdCheck = this.layer;
		}
		else { return; }
	}
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.check = function() {
		if(this.layer.style.display == "none") {
			this.root.expandLayer();
			this.root.collapseOldLayer();
		}
		else { this.root.hideLayer(); }
		if(swapIco) this.root.swapIcon(this);
		// SPEZIAL //
	}
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.camelCase = function(str) { return str.replace(/-\D/g, function(match) { return match.charAt(1).toUpperCase(); }) }
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.getStyle = function(obj, stil)
	{
		if(document.getElementById(obj)) obj = document.getElementById(obj);
		
		if(window.getComputedStyle)	return window.getComputedStyle(obj,"" ).getPropertyValue(stil);
		else if (document.defaultView) return document.defaultView.getComputedStyle(obj, null).getPropertyValue(stil);
		else if(obj.currentStyle) return obj.currentStyle[this.camelCase(stil)];
		else if(document.ids) return document.layers[obj.id][this.camelCase(stil)];
		else if(document.all) return document.all[obj.id].style[this.camelCase(stil)];
	}
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.swapIcon = function(obj) {
		var bgImg = this.getStyle(obj, "background-image");
		if(!bgImg) return;
		if(bgImg.indexOf(imgInactive) > -1) obj.style.backgroundImage = bgImg.replace(imgInactive,imgActive);
		else if(bgImg.indexOf(imgActive) > -1) obj.style.backgroundImage = bgImg.replace(imgActive,imgInactive);
	}
	//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	this.balken.onclick = this.check;
	if(show) { this.balken.onclick(); }
}


//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

// Zusatz (alle Layers anzeigen oder ausblenden)

//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
function ld_expandAll() {
	for(var i=0;i<layerDropDownArray.length;i++) { layerDropDownArray[i].style.display = "block"; }
}
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
function ld_collapseAll() {
	for(var i=0;i<layerDropDownArray.length;i++) { layerDropDownArray[i].style.display = "none"; }
}
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
function ld_print() {
	ld_expandAll();
	window.print();
	ld_collapseAll();
}
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
