
function _communiacs_show(element){
	element.className += " hover";
}

function _communiacs_hide(element){
	if(element.className == 'hover')
		element.className = '';
	else {
		element.className = element.className.replace(/ hover/g, "");
	}
}

function openPreviousLink(elem) {
	elem.parentNode.parentNode.getElementsByTagName('a')[0].onclick();
}

function communiacs_dynamic_height() {
	if(window.innerHeight)
		var t_client_height = window.innerHeight;
	else if(document.documentElement.clientHeight)
		var t_client_height = document.documentElement.clientHeight;
	else if(document.body.clientHeight)
		var t_client_height = document.body.clientHeight;
	var t_logos_height = document.getElementById('logos').offsetHeight;
	var t_mainmenu_wrapper_height = document.getElementById('mainmenu_wrapper').offsetHeight;
	var t_available_height = t_client_height - t_logos_height - 20;
	if(t_available_height < (t_mainmenu_wrapper_height + 47))
		t_available_height = (t_mainmenu_wrapper_height + 47);
	if(t_available_height > 795)
		t_available_height = 795;
	var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
	if(IE6) {
		t_available_height += 52;
	}
	var new_wrapper_height = t_available_height;
	document.getElementById('wrapper').style.height = new_wrapper_height + 'px';
	
	var t_base_height = document.getElementById('wrapper').offsetHeight - 52;
	var t_content_width = document.getElementById('content').offsetWidth;
	var t_header_height = document.getElementById('header').offsetHeight;
	var t_breadcrumbs_height = document.getElementById('content_path').offsetHeight;
	var t_mainmenufog_height = t_base_height - t_header_height - t_breadcrumbs_height;
	document.getElementById('mainmenu_fog').style.height = t_mainmenufog_height + 'px';
	document.getElementById('wrapper_back').style.height = (t_base_height - 47) + 'px';
	
	/* Content-Spalten auch anpassen, falls vorhanden */
	if(document.getElementById('fce_column')) {
		document.getElementById('fce_column').style.height = t_mainmenufog_height + 'px';
		if(document.getElementById('fce_column').offsetHeight > t_mainmenufog_height) {
			document.getElementById('fce_column').style.height = (t_mainmenufog_height - (document.getElementById('fce_column').offsetHeight - t_mainmenufog_height)) + 'px';
		}
	}
	
	/* Vertikale Positionierung der Bilder in der Logoleiste korrigieren und Logoleiste einblenden */
	var t_logos = document.getElementById('logos').getElementsByTagName('img');
	for(var i = 0; i < t_logos.length; i++) {
		t_logos[i].style.marginTop = Math.round((t_logos_height - t_logos[i].offsetHeight) / 2,0) + 'px';
	}
	document.getElementById('logos').style.visibility = 'visible';
	
	/* Content-Block unten auch anpassen, falls vorhanden */
	if(document.getElementById('fce_bottom')) {
		document.getElementById('fce_bottom').style.top = (t_mainmenufog_height - document.getElementById('fce_bottom').offsetHeight - 14) + 'px';
		document.getElementById('fce_bottom').style.width = (t_content_width - 34) + 'px';
		document.getElementById('fce_bottom_fog').style.top = (document.getElementById('fce_bottom').offsetTop - 9) + 'px';
		document.getElementById('fce_bottom_fog').style.width = (document.getElementById('fce_bottom').offsetWidth + 18) + 'px';
		document.getElementById('fce_bottom_fog').style.height = (document.getElementById('fce_bottom').offsetHeight + 18) + 'px';
	}
	
	/* Marken-Schatten links und höhe des linken Bereichs auch anpassen, falls vorhanden */
	if(document.getElementById('fce_marken_text_fog')) {
		if(document.getElementById('fce_marken_text').offsetHeight == 26) {
			document.getElementById('fce_marken_text_fog').style.height = '0px';
		}
		else {
			document.getElementById('fce_marken_text_fog').style.height = (document.getElementById('fce_marken_text').offsetHeight) + 'px';
		}
	}
	if(document.getElementById('fce_marken_left')) {
		document.getElementById('fce_marken_left').style.height = (t_mainmenufog_height - 18) + 'px';
	}
	
	/* Textbereich für komplette Seite auch anpassen, falls vorhanden */
	if(document.getElementById('fce_komplett_text')) {
		document.getElementById('fce_komplett_text').style.height = (t_mainmenufog_height - 62) + 'px';
		if(document.getElementById('fce_komplett_fog')) {
			document.getElementById('fce_komplett_fog').style.height = (t_mainmenufog_height - 27) + 'px';
		}
	}
	
	/* Bildergalerie auch anpassen, falls vorhanden */
	if(document.getElementById('fce_galerie')) {
		document.getElementById('fce_galerie').style.height = t_mainmenufog_height + 'px';
	}
}

function communiacs_flexcroll_cycle(p_elem_id, p_old_height) {
	if(!p_old_height) {
		p_old_height = 0;
	}
	var t_height = 0;
	if(document.getElementById(p_elem_id + "_contentwrapper")) {
		t_height = document.getElementById(p_elem_id + "_contentwrapper").offsetHeight;
	}
	if(t_height != p_old_height) {
		CSBfleXcroll(p_elem_id);
	}
	setTimeout("communiacs_flexcroll_cycle('" + p_elem_id + "'," + t_height + ")",100);
}



/*
HTML-CODE fuer Fading der Startseite
----------------------------------------

<div id="home_dyn_box">
	<div id="home_dyn_kopf">&nbsp;</div>
	<div id="home_dyn_kochen" onMouseOver="_communiacs_show(this)" onMouseOut="_communiacs_hide(this)">
		<div class="home_dyn_back">&nbsp;</div>
		<div class="home_dyn_overlay">&nbsp;</div>
		<div class="home_dyn_text"><span class="hidden">KOCHEN mit Leidenschaft und den besten Kochwerkzeugen f&uuml;r Ihre K&uuml;che</span></div>
	</div>
	<div id="home_dyn_tafeln" onMouseOver="_communiacs_show(this)" onMouseOut="_communiacs_hide(this)">
		<div class="home_dyn_back">&nbsp;</div>
		<div class="home_dyn_overlay">&nbsp;</div>
		<div class="home_dyn_text"><span class="hidden">TAFELN mit Genuss aus den sch&ouml;nsten Gl&auml;sern - von den sch&ouml;nsten Tellern und Tassen und mit den herrlichen Bestecken von TAVOLI</span></div>
	</div>
	<div id="home_dyn_schenken" onMouseOver="_communiacs_show(this)" onMouseOut="_communiacs_hide(this)">
		<div class="home_dyn_back">&nbsp;</div>
		<div class="home_dyn_overlay">&nbsp;</div>
		<div class="home_dyn_text"><span class="hidden">SCHENKEN Sie Sch&ouml;nes f&uuml;r zu Hause - Praktisches f&uuml;r die K&uuml;che und tolles Porzellan f&uuml;r den gedeckten Tisch</span></div>
	</div>
	<script type="text/javascript">
		setTimeout("communiacs_fade('home_dyn_kochen', 0, 100)",500);
		setTimeout("communiacs_fade('home_dyn_tafeln', 0, 100)",2000);
		setTimeout("communiacs_fade('home_dyn_schenken', 0, 100)",3500);
	</script>
</div>

*/
var communiacs_fade_step_width = 3;
var communiacs_fade_cycle_delay = 30;
function communiacs_fade(p_elem, p_from, p_to, p_org_opacity, p_cur_opacity) {
	var t_elem = document.getElementById(p_elem);
	if(t_elem) {	
		if(window.getComputedStyle) {
			var t_cur_opacity = parseInt(window.getComputedStyle(t_elem,"").getPropertyValue('opacity'));
		}
		else {
			var t_cur_opacity = parseInt(t_elem.currentStyle.opacity);
		}
		if(typeof(p_org_opacity) == 'undefined') {
			p_org_opacity = t_cur_opacity;
		}
		if(p_from <= p_to) {
			if(typeof(p_cur_opacity) == 'undefined') {
				p_cur_opacity  = p_from;
			}
			else {
				p_cur_opacity += communiacs_fade_step_width;
			}
			if(p_cur_opacity > p_to) {
				p_cur_opacity = p_to;
			}
		}
		else {
			if(typeof(p_cur_opacity) == 'undefined') {
				p_cur_opacity  = p_from;
			}
			else {
				p_cur_opacity -= communiacs_fade_step_width;
			}
			if(p_cur_opacity < p_to) {
				p_cur_opacity = p_to;
			}
		}
		t_elem.style.opacity = "" + p_cur_opacity / 100;
		t_elem.style.mozOpacity = "" + p_cur_opacity / 100;
		t_elem.style.filter = 'Alpha(opacity=' + p_cur_opacity +')';
		t_elem.style.display = "block";
		if(p_cur_opacity != p_to) {
			setTimeout('communiacs_fade("' + p_elem + '","' + p_from + '","' + p_to + '",' + p_org_opacity + ',' + p_cur_opacity + ')',communiacs_fade_cycle_delay);
		}
	}
}

if (document.addEventListener) {
  document.addEventListener("DOMContentLoaded", communiacs_dynamic_height, false);
  window.addEventListener("resize", communiacs_dynamic_height, false);
}
else if(window.attachEvent) {
	window.attachEvent('onload', communiacs_dynamic_height);
	window.attachEvent('onresize', communiacs_dynamic_height);
}
else {
	var onload_old = window.onload;
	window.onload = function() {
		if(onload_old) {
			onload_old();
		}
		communiacs_dynamic_height();
	}
	var onresize_old = document.body.onresize;
	document.body.onresize = function() {
		if(onresize_old) {
			onresize_old();
		}
		communiacs_dynamic_height();
	}
}


