// toggle_archive
function toggle_div ( targetId )
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
		if (target.style.display == "none")
		{
			window.setTimeout("Effect.BlindDown('" + targetId + "', {duration:0.5})", 500);
		}
		else
		{
			window.setTimeout("Effect.BlindUp('" + targetId + "', {duration:0.5})", 500);
		}
	} // endif
} // endfunction

function toggle_submenu( targetId , headId, wrapperId, content, webcode, headline )
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
		head = document.getElementById( headId );
		// Durchlaufe alle divs im Wrapper und setze Sie auf unsichtbar, außer target - der soll getoggled werden
		var divs = document.getElementById( wrapperId ).getElementsByTagName("div"); // alle divs im Wrapper
		for (var i = 0; i < divs.length; i++)
		{
			// Ausnahme: Klasse archive_head
			if(divs[i].className != "submenu_head" && divs[i].className != "submenu_distance")
			{
				if(divs[i].id == target.id)
				{
					if (target.style.display == "none")
					{
						target.style.display = "";
						window.setTimeout("set_content('"+targetId+"', '" + content + "', '" + webcode + "', '" + headline + "')", 500); // Gefaketen Loader abwarten
					}
					else 
					{
						target.style.display = "none";
						divs[i].innerHTML = '<img src="../grafik/design/indicator_green.gif" style="margin: 0 auto; padding-bottom: 5px;" />'; // Gefaketen Loader einbauen
					} // endif
				}
				else
				{
					divs[i].style.display = "none";
					divs[i].innerHTML = '<img src="../grafik/design/indicator_green.gif" style="margin: 0 auto; padding-bottom: 5px;" />'; // Gefaketen Loader einbauen
				}
			}
			else if(divs[i].className == "submenu_head")
			{
				if(divs[i].id == head.id)
				{
					if(head.style.backgroundPosition == "443px 0px")
					{
						divs[i].style.color = "#00a8b6";
						head.style.backgroundPosition = "443px -25px";
					}
					else
					{
						divs[i].style.color = "#9c9c9c";
						head.style.backgroundPosition = "443px 0px";
					}
				}
				else
				{
					divs[i].style.color = "#9c9c9c";
					divs[i].style.backgroundPosition = "443px 0px";
				}
			} // endif
		} // endfor
	} // endif
} // endfunction

function set_content( targetId , content, webcode, headline)
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
		target.innerHTML = content + "<br><a href=\"?webcode=" + webcode + "\" title=\"" + headline + "\">mehr Informationen</a>";
	} // endif
} // endfunction

function slide_submenu( targetId , headId, wrapperId )
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
		head = document.getElementById( headId );
		// Durchlaufe alle divs im Wrapper und setze Sie auf unsichtbar, außer target - der soll getoggled werden
		var divs = document.getElementById( wrapperId ).getElementsByTagName("div"); // alle divs im Wrapper
		for (var i = 0; i < divs.length; i++)
		{
			// Ausnahme: Klasse submenu_head
			if(divs[i].className != "submenu_head" && divs[i].className != "submenu_distance")
			{
				if(divs[i].id == target.id)
				{
					if (target.style.display == "none")
					{
						divs[i].style.color = "#00a8b6";
						window.setTimeout("Effect.BlindDown('" + divs[i].id + "', {duration:0.5})", 500);
						// Effect.BlindDown(divs[i].id, {duration:0.5});
					}
					else 
					{
						divs[i].style.color = "#9c9c9c";
						window.setTimeout("Effect.BlindUp('" + divs[i].id + "', {duration:0.5})", 500);
						// Effect.BlindUp(divs[i].id, {duration:0.5});
					} // endif
				}
				else
				{
					divs[i].style.color = "#9c9c9c";
					window.setTimeout("Effect.BlindUp('" + divs[i].id + "', {duration:0.5})", 500);
					// Effect.BlindUp(divs[i].id, {duration:0.5});
				} // endif
			}
			else if(divs[i].className == "submenu_head")
			{
				if(divs[i].id == head.id)
				{
					if(head.style.backgroundPosition == "443px 0px")
					{
						divs[i].style.color = "#00a8b6";
						head.style.backgroundPosition = "443px -25px";
					}
					else
					{
						divs[i].style.color = "#9c9c9c";
						head.style.backgroundPosition = "443px 0px";
					} // endif
				}
				else
				{
					divs[i].style.color = "#9c9c9c";
					divs[i].style.backgroundPosition = "443px 0px";
				}
			} // endif
		} // endfor
	} // endif
} // endfunction

function toggle_sliding( targetId )
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
		if (target.style.display == "none")
		{
			window.setTimeout("Effect.BlindDown('" + targetId + "', {duration:0.5})", 500);
		}
		else
		{
			window.setTimeout("Effect.BlindUp('" + targetId + "', {duration:0.5})", 500);
		} // endif
	} // endif
} // endfunction

// Tooltip
var tooltip=function(){
	var id = 'tt';
	var top = 6;
	var left = 6;
	var maxw = 400;
	// Für den lausigen IE
	if (navigator.appName.indexOf("Explorer") != -1)
		var speed = 100;
	else
		var speed = 5; // für die anderen, guten Browser
	var timer = 1;
	var endalpha = 100;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();
// Ende Tooltip