
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, "");
	}
}

/*** Box-Breiten-Hack für TT_NEWS ***/

function _communiacs_news_box_width() {
	/*** LIST ***/
	// News-Item ermitteln und durchlaufen
	var t_divs = _communiacs_getElementsByTagAndClass(document,'div','news_list_item');
	for(var i = 0; i < t_divs.length; i++) {
		var t_divs2 = _communiacs_getElementsByTagAndClass(t_divs[i],'div','news_list_image');
		// Prüfen, ob Image existiert
		if(t_divs2[0]) {
			if(t_divs2[0].getElementsByTagName('img').length == 0) {
				// News-Item-Tag mit zusätzlicher Klasse versehen
				t_divs[i].className = t_divs[i].className + ' news_list_item_noimage';
			}
		}
	}
	
	/*** SINGLE ***/
	// News-Item ermitteln und durchlaufen
	var t_divs = _communiacs_getElementsByTagAndClass(document,'div','news_single_item');
	for(var i = 0; i < t_divs.length; i++) {
		var t_divs2 = _communiacs_getElementsByTagAndClass(t_divs[i],'div','news_single_image');
		// Prüfen, ob Image existiert
		if(t_divs2[0]) {
			if(t_divs2[0].getElementsByTagName('img').length == 0) {
				// News-Item-Tag mit zusätzlicher Klasse versehen
				t_divs[i].className = t_divs[i].className + ' news_single_item_noimage';
			}
		}
	}
}

function _communiacs_getElementsByTagAndClass(p_source, p_tag, p_class) {
	var t_return = new Array();
	var t_elements = p_source.getElementsByTagName(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;
}

if (document.addEventListener) {
  document.addEventListener("DOMContentLoaded", _communiacs_news_box_width, false);
}
else if(window.attachEvent) {
	window.attachEvent('onload', _communiacs_news_box_width);
}
else {
	var onload_old = window.onload;
	window.onload = function() {
		if(onload_old) {
			onload_old();
		}
		_communiacs_news_box_width();
	}
}


/*** FONT-SIZER ***/

//standardgroesse
var communiacs_fontSize = 100;
var communiacs_defaultFontSize = 100;

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 = parseInt(t_cook[1]);
		}
	}
}

//schrift verkleinern
function _font_smaller() {
	communiacs_fontSize -= 10;
	if(communiacs_fontSize < 50)
		communiacs_fontSize = 50;
	_font_set();
	document.cookie = 'font_sizer='+communiacs_fontSize+';';
}

//schrift vergroessern
function _font_bigger() {
	communiacs_fontSize = parseInt(communiacs_fontSize) + 10;
	if(communiacs_fontSize > 200)
		communiacs_fontSize = 200;
	_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() {
	document.body.style.fontSize = (communiacs_fontSize/100)+'em';
}





//eventhandler fuer die tasten '+' und '-'
function _handle_keyPress(p_event) {
	// var t_key = (p_event.keyCode || p_event.which);
	// if(t_key == 43) { //'+'
		// _font_bigger();
	// }
	// if(t_key == 45) { //'-'
		// _font_smaller();
	// }
}

