function toggleNewsEntryExpansionState(id) {
	var height = $(id).style.height;
	var id2 = id + '2';
	var id3 = id + '3';
	//alert(id);
	if (height != '') {
		$(id).style.height = '';
		$(id2).style.display = 'none';
		$(id3).style.height = '';
		//$(id).childNodes[9].childNodes[1].setAttribute("style","");
		//$(id).parentNode.childNodes[9].setAttribute("style","position:relative; left:1px; top:0px; width:767px; height:16px; background:url(img/news/ArrowExpand.gif); display:none");
	} else {
		$(id).style.height = '70px';
		$(id2).style.display = 'block';
		$(id3).style.height = '59px';
		//$(id).childNodes[9].childNodes[1].setAttribute("style","height:59px; overflow:hidden");
		//$(id).parentNode.childNodes[9].setAttribute("style","position:relative; left:1px; top:0px; width:767px; height:16px; background:url(img/news/ArrowExpand.gif); display:block");
	}
	// update slider position
	newsboxUpdatePosition();
}

function newsboxUpdatePosition() {
	var newsboxOverflowDifference = $('newsboxWrapper').getHeight() - 249;
	var newsboxWrapperTop = $('newsboxWrapper').style.top;
	newsboxWrapperTop = newsboxWrapperTop.split("p");
	newsboxWrapperTop = newsboxWrapperTop[0];
	var actualSliderPositonPercent = (-1*parseInt(100*(newsboxWrapperTop/newsboxOverflowDifference)))/100;
	sliderNews.setValue(actualSliderPositonPercent);
	// if collapsing a news entry leaves a gap at the bottom in newsbox window, slide content so the bottom of the last entry lines up with the bottom border of the window
	if (actualSliderPositonPercent > 1) {
		new Effect.Morph('newsboxWrapper',{ style:{ top: -1*newsboxOverflowDifference + 'px' }, duration: .3 });
	}
}

// this function updates the position via morph on mouse up only to not interfere with the slide related updating
function newsboxUpdatePositionOnMouseUp(speed) {
	var value = sliderNews.value;
	var newsboxOverflowDifference = $('newsboxWrapper').getHeight() - 249;
	new Effect.Morph('newsboxWrapper',{ style:{ top: -1*parseInt(value*newsboxOverflowDifference) + "px" }, duration: speed });
}

function decryptAndMailto(i) {
	var emailDecrypted = AESDecryptCtr(globalEmailEncrypted[i], globalKey, 256);
	window.location = "mailto:" + emailDecrypted + "?subject=Anfrage von www.margret-eicher.de";
}