var ausblenden = false;
var aktiv = false;
var clicked = false;
function rl_showHideLayers(target,showhide,colorId) { 

	if(showhide == "hide") {
		
  		document.getElementById(target).style.display = "none";
	
		if(clicked) {
			
			document.getElementById(clicked).style.display = "block";
			aktiv = clicked;			
			
		} else {
			
			aktiv = false;
			
		}
		
  	} else {
		
		if(aktiv != false){document.getElementById(aktiv).style.display = "none";}

  		document.getElementById(target).style.display = "block";
		if(colorId) document.getElementById(colorId).style.color = "white";
		aktiv = target;
  	}
}
function rl_showLayers(target,colorId) {
	
	ausblenden = window.setTimeout("rl_showHideLayers('"+target+"','show','"+colorId+"')", 200);
	if(colorId) document.getElementById(colorId).style.color = "white";
	 
}
function rl_HideLayers(id,colorId) {
	
	ausblenden = window.setTimeout("rl_showHideLayers('"+id+"','hide','')", 500);
	if(colorId) document.getElementById(colorId).style.color = "#9AADB4";
	 
}
function rl_clearTimeout() {
	window.clearTimeout(ausblenden);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


var slideInUse = new Array();
var sitemapOpen = false;

function Slide(objId, options) {
	this.obj = document.getElementById(objId);
	this.duration = 1;
	this.height = parseInt(this.obj.style.height);

	if(typeof options != 'undefined') { this.options = options; } else { this.options = {}; }
	if(this.options.duration) { this.duration = this.options.duration; }
		
	this.up = function(box) {
		this.curHeight = this.height;
		this.newHeight = '0';
		if(slideInUse[objId] != true) {
			var finishTime = this.slide();
			
			/* MM_effectAppearFade greift auf /_css_js/SpryEffects.js zu */
			MM_effectAppearFade(box, 1000, 100, 0, false);
			
			window.setTimeout("Slide('"+objId+"').finishup("+this.height+");",finishTime);
		}
		sitemapOpen = false;
	}
	
	this.down = function(box) {
		this.newHeight = this.height;
		this.curHeight = '0';
		if(slideInUse[objId] != true) {
			this.obj.style.height = '.0em';
			
			/* MM_effectAppearFade greift auf /_css_js/SpryEffects.js zu */
			MM_effectAppearFade(box, 1000, 0, 100, false);
			
			this.slide();
			this.obj.style.display = 'block';
		}
		sitemapOpen = true;
		//
	}
	
	this.slide = function() {
		slideInUse[objId] = true;
		var frames = 30 * duration; // Running at 30 fps

		var tIncrement = (duration*500) / frames;
		// tIncrement = Math.round(tIncrement);
		var sIncrement = (this.curHeight-this.newHeight) / frames;

		var frameSizes = new Array();
		for(var i=0; i < frames; i++) {
			if(i < frames/2) {
				frameSizes[i] = (sIncrement * (i/frames))*4;
			} else {
				frameSizes[i] = (sIncrement * (1-(i/frames)))*4;
				
			}
		}
		
		for(var i=0; i < frames; i++) {
			this.curHeight = this.curHeight - frameSizes[i];
			window.setTimeout("document.getElementById('"+objId+"').style.height='"+this.curHeight+"em';",tIncrement * i);
		}
		
		window.setTimeout("delete(slideInUse['"+objId+"']);",tIncrement * i);
		
		if(this.options.onComplete) {
			window.setTimeout(this.options.onComplete, tIncrement * (i-2));
		}
		
		return tIncrement * i;
	}
	
	this.finishup = function(height) {
		this.obj.style.display = 'none';
		this.obj.style.height = height + 'em';
		
	}
	
	return this;
	
}

function divDisplay (sichtbar,unsichtbar) {
	document.getElementById(unsichtbar).style.zIndex='50';	
	document.getElementById(sichtbar).style.zIndex='100';	
	MM_effectAppearFade(unsichtbar, 500, 100, 0, false);
	MM_effectAppearFade(sichtbar, 500, 0, 100, false);

}
function sichtbar (sichtbar) {

	document.getElementById(sichtbar).style.display='block';

}
function unsichtbar (unsichtbar) {
	document.getElementById(unsichtbar).style.display='none';


}

function immoToggle (div1,div2,div3) {

	if(document.getElementById(div1).style.display == 'none') {

		document.getElementById(div1).style.display = 'block';
		
	} else {
		
		document.getElementById(div1).style.display = 'none';
		
	}

	if(document.getElementById(div2).style.display == 'none') {

		document.getElementById(div2).style.display = 'block';
		
	} else {
		
		document.getElementById(div2).style.display = 'none';
		
	}

	if(document.getElementById(div3).style.display == 'none') {

		document.getElementById(div3).style.display = 'block';
		
	} else {
		
		document.getElementById(div3).style.display = 'none';
		
	}

}

function hideSitemap() {

	if(sitemapOpen == true) {Slide('sitemapCol').up('sitemapCol');divDisplay('down01','up01');}

}

