
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 _communiacs_getDirectChildrenByTagName(p_source, p_tag) {
	var ret = new Array();
	for(var i = 0; i < p_source.childNodes.length; i++) {
		if(p_source.childNodes[i].nodeType == 1 && p_source.childNodes[i].nodeName.toLowerCase() == p_tag.toLowerCase()) {
			ret[ret.length] = p_source.childNodes[i];
		}
	}
	return ret;
}

function _communiacs_getElementsByTagAndClass(p_source, p_tag, p_class, p_direct_child) {
	var t_return = new Array();
	if(!p_direct_child) {
		var t_elements = p_source.getElementsByTagName(p_tag);
	}
	else {
		var t_elements = _communiacs_getDirectChildrenByTagName(p_source, p_tag);
	}
	for(var i = 0; i < t_elements.length; i++) {
		if(t_elements[i].className.indexOf(p_class) > -1) {
			t_return[t_return.length] = t_elements[i];
		}
	}
	return t_return;
}

function openPreviousLink(elem) {
	elem.parentNode.parentNode.getElementsByTagName('a')[0].onclick();
}

/**************************************************/
/******** CUFON-LINE-HEIGHT-ANPASSUNG *************/
/**************************************************/

// function cm_onload_handler() {
	// cm_browser_os_switch();
// }

// if (document.addEventListener) {
  // document.addEventListener("DOMContentLoaded", cm_onload_handler, false);
// }
// else if(window.attachEvent) {
	// window.attachEvent('onload', cm_onload_handler);
// }
// else {
	// var onload_old = window.onload;
	// window.onload = function() {
		// if(onload_old) {
			// onload_old();
		// }
		// cm_onload_handler();
	// }
// }

// function cm_browser_os_switch() {
	// var t_os = '';
	// var t_browser = '';
	// var t_browser_version = '';
	// var t_engine = '';
	
	// // check for OS
	// if(navigator.userAgent.toLowerCase().indexOf('windows') >= 0) t_os = 'Win';
	// if(navigator.userAgent.toLowerCase().indexOf('macintosh') >= 0) t_os = 'Mac';
	// if(navigator.userAgent.toLowerCase().indexOf('iphone') >= 0) t_os = 'iPhone'; // Muss hinter der Abfrage für Mac stehen !!!
	
	// // Check for Browser and Version
	// if(navigator.userAgent.toLowerCase().indexOf('msie') >= 0) {
		// t_browser = 'IE';
		// var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
		// if(IE6) { t_browser_version = '6'; }
		// else if(navigator.userAgent.toLowerCase().indexOf('msie 7') >= 0) { t_browser_version = '7'; }
		// else if(navigator.userAgent.toLowerCase().indexOf('msie 8') >= 0) { t_browser_version = '8'; }
	// }
	// if(navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) t_browser = 'Firefox';
	// if(navigator.userAgent.toLowerCase().indexOf('opera') >= 0) t_browser = 'Opera';
	// if(navigator.userAgent.toLowerCase().indexOf('safari') >= 0) t_browser = 'Safari';
	// if(navigator.userAgent.toLowerCase().indexOf('chrome') >= 0) t_browser = 'Chrome'; // Muss hinter der Abfrage für Safari stehen !!!
	
	// //Check for Browser-Engine
	// if(t_browser == 'IE') t_engine = 'IE'; // IE
	// if(navigator.userAgent.toLowerCase().indexOf('presto') >= 0) t_engine = 'Presto'; // Opera
	// if(navigator.userAgent.toLowerCase().indexOf('gecko') >= 0) t_engine = 'Gecko'; // Firefox
	// if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) t_engine = 'WebKit'; // Safari, Chrome (Muss hinter der Abfrage für Gecko stehen !!!)
	
	
	
	// // ########## Weichenspezifischer-code ########## //
	// if(t_browser == 'IE' && t_browser_version != '6') {
	
		// var t_elems = _communiacs_getElementsByTagAndClass(document.getElementById('menu'),'a','');
		// for(var i = 0; i < t_elems.length; i++){
			// if(window.getComputedStyle) {
				// var t_padtop = parseInt(window.getComputedStyle(t_elems[i],"").getPropertyValue('padding-top'));
				// var t_height = parseInt(window.getComputedStyle(t_elems[i],"").getPropertyValue('height'));
			// }
			// else {
				// var t_padtop = parseInt(t_elems[i].currentStyle.paddingTop);
				// var t_height = parseInt(t_elems[i].currentStyle.height);
			// }
			// t_elems[i].style.paddingTop = (t_padtop + 2) + 'px';
			// t_elems[i].style.height = (t_height - 2) + 'px';
		// }
	// }
// }

/**************************************************/
				/*** FONT-SIZER ***/
/**************************************************/
// //standardgroesse
// var communiacs_fontSize = 0.81;
// var communiacs_defaultFontSize = 0.81;

// if(document.cookie) {
	// var t_cookies = document.cookie.split(';');
	// var t_cook_len = t_cookies.length;
	// for(var i = 0; i < t_cook_len; i++) {
		// t_cookie = t_cookies[i];
		// // trim
		// t_cookie = t_cookie.replace( /^\s+/g,'').replace(/\s+$/g,'');
		// // split name/value
		// t_cook = t_cookie.split('=');
		// if(t_cook[0] == 'font_sizer') {
			// communiacs_fontSize = parseFloat(t_cook[1]);
		// }
	// }
// }

// //schrift verkleinern
// function _font_smaller() {
	// communiacs_fontSize -= 0.0625;
	// if(communiacs_fontSize < 0.375)
		// communiacs_fontSize = 0.375;
	// _font_set();
	// document.cookie = 'font_sizer='+communiacs_fontSize+';';
// }

// //schrift vergroessern
// function _font_bigger() {
	// communiacs_fontSize = parseFloat(communiacs_fontSize) + 0.0625;
	// if(communiacs_fontSize > 1.5)
		// communiacs_fontSize = 1.5;
	// _font_set();
	// document.cookie = 'font_sizer='+communiacs_fontSize+';';
// }

// //schrift auf standardgroesse setzen
// function _font_normal() {
	// communiacs_fontSize = communiacs_defaultFontSize;
	// _font_set();
	// document.cookie = 'font_sizer='+communiacs_fontSize+';';
// }

// //schrift auf aktuelle groesse setzen
// function _font_set() {
	// var cont = document.getElementById("content");
	// var subcont = document.getElementById("subcontent");
	// cont.style.fontSize = communiacs_fontSize + 'em';
	// subcont.style.fontSize = communiacs_fontSize + 'em';
	// //communiacs_dynamic_height_reinit();
	// //communiacs_dynamic_height();
// }


//standardgroesse
var communiacs_fontSize = 0.81;
var communiacs_defaultFontSize = 0.81;

if(document.cookie) {
	var t_cookies = document.cookie.split(';');
	var t_cook_len = t_cookies.length;
	for(var i = 0; i < t_cook_len; i++) {
		t_cookie = t_cookies[i];
		// trim
		t_cookie = t_cookie.replace( /^\s+/g,'').replace(/\s+$/g,'');
		// split name/value
		t_cook = t_cookie.split('=');
		if(t_cook[0] == 'font_sizer') {
			communiacs_fontSize = parseFloat(t_cook[1]);
		}
	}
}

//schrift verkleinern
function _font_big() {
	communiacs_fontSize = 1;
	_font_set();
	document.cookie = 'font_sizer='+communiacs_fontSize+';';
}

//schrift vergroessern
function _font_bigger() {
	communiacs_fontSize = 1.375;
	_font_set();
	document.cookie = 'font_sizer='+communiacs_fontSize+';';
}

//schrift auf standardgroesse setzen
function _font_normal() {
	communiacs_fontSize = communiacs_defaultFontSize;
	_font_set();
	document.cookie = 'font_sizer='+communiacs_fontSize+';';
}

//schrift auf aktuelle groesse setzen
function _font_set() {
	var cont = document.getElementById("content");
	var subcont = document.getElementById("subcontent");
	cont.style.fontSize = communiacs_fontSize + 'em';
	subcont.style.fontSize = communiacs_fontSize + 'em';
	//communiacs_dynamic_height_reinit();
	//communiacs_dynamic_height();
}
