
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_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;
}

function _communiacs_trim(p_str) {
	return (p_str.replace(/\s+$/,"").replace(/^\s+/,""));
};

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


function communiacs_icon_parser() {
	var t_hotel_icon_boxes = _communiacs_getElementsByTagAndClass(document,'div','hotel_icons');
	for(var i = 0; i < t_hotel_icon_boxes.length; i++) {
		var t_icons = t_hotel_icon_boxes[i].innerHTML.split(',');
		var t_html = '';
		for(var j = 0; j < t_icons.length; j++) {
			switch(_communiacs_trim(t_icons[j]).toLowerCase()) {
				case 'p':
					var t_icon = 'parkplatz';
					var t_alt = 'mit Parkplatz';
					break;
				case 'pu':
					var t_icon = 'parkplatz_ueberdacht';
					var t_alt = 'mit &uuml;berdachtem Parkplatz';
					break;
				case 'tv':
					var t_icon = 'tv';
					var t_alt = 'mit Fernseher';
					break;
				case 'wc':
					var t_icon = 'wc';
					var t_alt = 'mit WC';
					break;
				case 'ba':
					var t_icon = 'behinderten';
					var t_alt = 'Behindertengerecht';
					break;
				case 'du':
					var t_icon = 'dusche';
					var t_alt = 'mit Dusche';
					break;
				case 'tel':
					var t_icon = 'telefon';
					var t_alt = 'mit Telefon';
					break;
				case 'rad':
					var t_icon = 'fahrrad';
					var t_alt = 'mit Fahrrad(verleih)';
					break;
				default:
					var t_icon = '';
					var t_alt = '';
					break;
			}
			if(t_icon != '') {
				t_html += '<img src="/fileadmin/templates/images/icons/' + t_icon + '.gif" alt="' + t_alt + '" title="' + t_alt + '" />'; //live
				// t_html += '<img src="../images/icons/' + t_icon + '.gif" alt="' + t_alt + '" />'; //local
			}
		}
		if(t_html == '') {
			t_html = '&nbsp;';
		}
		t_hotel_icon_boxes[i].innerHTML = t_html;
		
		/* Positionierung der Icons an den unteren Rand */
		var t_image_height = _communiacs_getElementsByTagAndClass(t_hotel_icon_boxes[i].parentNode.parentNode,'div','hotel_image')[0].offsetHeight;
		var t_contact_height = _communiacs_getElementsByTagAndClass(t_hotel_icon_boxes[i].parentNode.parentNode,'div','hotel_contact')[0].offsetHeight;
		var t_data_height = _communiacs_getElementsByTagAndClass(t_hotel_icon_boxes[i].parentNode.parentNode,'div','hotel_data')[0].offsetHeight;
		var t_box_height = (t_image_height > t_contact_height ? t_image_height : t_contact_height);
		var t_icon_box_top = t_hotel_icon_boxes[i].offsetTop;
		var t_icon_box_height = t_hotel_icon_boxes[i].offsetHeight;
		var t_box_diff = t_box_height - (t_icon_box_top + t_icon_box_height) - 1;
		if(t_box_diff > 0) {
			t_hotel_icon_boxes[i].style.marginTop = t_box_diff + 'px';
			var t_button_box = _communiacs_getElementsByTagAndClass(t_hotel_icon_boxes[i].parentNode,'div','hotel_button_box');
			t_button_box[0].style.marginTop = t_box_diff + 'px';
		}
	}
}

