var isExtended = 0;
function slideSideBar()
{
	if(isExtended==0)
	{
		// navi reinfahren
		var right = $('content_right').getWidth() - 20;
		$('content_right').morph('right: -' + right + 'px;');
		if($('schablone_unten'))
		{
			$('schablone_unten').morph('right: -' + right + 'px;');
		}
		$('navi_reiter').addClassName('bt_reiter_aus');
		$('content').morph('width:'+ ($('content_inhalt').getWidth() - $('navi_reiter').getWidth() - 50) +'px;');
		isExtended++;
	}
	else{
		// navi rausfahren
		$('content_right').morph('right:-0px;');
		if($('schablone_unten'))
		{
			$('schablone_unten').morph('right:-0px;');
		}		
		$('content').morph('width:'+ ($('content_inhalt').getWidth() - $('content_right').getWidth()) +'px;');
		$('navi_reiter').removeClassName('bt_reiter_aus');
		isExtended=0;
	}
}
function resizeSidebar()
{
	var windowWidth, windowHeight;
	var age = navigator.userAgent;	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer
																					// 6
																					// Strict
																					// Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	
	var xScroll, yScroll;
	yScroll = 0;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all
																			// but
																			// Explorer
																			// Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla
				// and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight; 
	}
	
	if($('content_right'))
	{
		$('content').setStyle({width: ($('content_inhalt').getWidth() - $('content_right').getWidth()) + 'px'});
	}
	else
	{
		$('content').setStyle({width: ($('content_inhalt').getWidth() - 50) + 'px'});		
	}
	// $('scroll').setStyle({height: windowHeight - 155 +'px'});
	$('content_inhalt').setStyle({height: (windowHeight - 125 - 34) + 'px'});
	$('nav_scroll').setStyle({height: (windowHeight - 300) + 'px'});


	/*
	if(age.search("MSIE 6.0") != -1)
	{
		if($('content_right'))
		{		
			$('content_right').setStyle({height: (xScroll+xScroll+xScroll) + 'px'});
		}
	}
	*/
	/*
	 * if($('list')) { $('list').setStyle({height: (xScroll) + 'px'}); }
	 */
	if($('container_inhalt'))
	{
		$('content').setStyle({padding: '0'});
		$('content').setStyle({margin: '0 0 0 10px'});
		if($('container_inhalt').getHeight() < $('content_inhalt').getHeight())
		{
			$('container_inhalt').setStyle({height: ($('content_inhalt').getHeight()) + 'px'});		
		}
		else
		{
			$('container_inhalt').setStyle({height: ($('container_inhalt').getHeight()+100) + 'px'});	
		}
	}	
    
    
    position_footer_bg();
}

function IE6_init()
{
	/*
	 * var t = $('header_menu'); var b = $('abbinder'); var c =
	 * $('content_inhalt'); var view = document.viewport.getDimensions();
	 * //IE6_getPageSize(); var newCHeight = view.height - t.getHeight() -
	 * b.getHeight(); c.setStyle({height: newCHeight + 'px'});
	 * 
	 * if (self.innerHeight) { // all except Explorer
	 * if(document.documentElement.clientWidth){ windowWidth =
	 * document.documentElement.clientWidth; } else { windowWidth =
	 * self.innerWidth; } windowHeight = self.innerHeight; } else
	 */
	if (document.documentElement && document.documentElement.clientHeight) { // Explorer
																				// 6
																				// Strict
																				// Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	$('content_inhalt').setStyle({width: windowWidth + 'px'});
	$('content').setStyle({width: ($('content_inhalt').getWidth() - 420) + 'px'});
	$('content_right_ie6').setStyle({height: windowHeight - 155 +'px'});
	// $('scroll').setStyle({height: windowHeight - 155 +'px'});
	if(windowHeight<600)
	{
		$('ie6_schatten').setStyle({height: windowHeight + 200 +'px'});	
	}
	else
	{
		$('ie6_schatten').setStyle({height: 100 +'%'});	
	}
	$('content_inhalt').setStyle({height: (windowHeight - 125 - 34) + 'px'});
	
	/*
	 * if($('list')) { $('list').setStyle({height: (windowHeight - 90 - 34) +
	 * 'px'}); }
	 */
	if($('container_inhalt'))
	{
		$('content').setStyle({padding: '0'});
		$('content').setStyle({margin: '0 0 0 10px'});			
		if($('container_inhalt').getHeight() < $('content_inhalt').getHeight())
		{
			$('container_inhalt').setStyle({height: ($('content_inhalt').getHeight()) + 'px'});
		}	
	}
    
    position_footer_bg();
}

function position_footer_bg(){
    var dvd = document.viewport.getDimensions();
    var bgImgWidth = 1600;
    var delta = (bgImgWidth-dvd.width) * (-2/60);
    delta = Math.ceil(delta);
    delta = delta < 0 ? delta : 0;
    if($('#abbinder h1'))
	$$('#abbinder h1')[0].setStyle({backgroundPosition: "0 " + delta + "px"})
}

function init()
{
	resizeSidebar();
    position_footer_bg();
	Event.observe('navi_reiter', 'click', slideSideBar, true);
}

if (Prototype.Browser.IE && IE.version < 7)
{
	Event.observe(window, 'resize', IE6_init);
	document.observe("dom:loaded", IE6_init);
}
else
{
	Event.observe(window, 'load', init, true);
	Event.observe(window, 'resize', resizeSidebar);
}




