/* Functions that manipulate copy go here */
function copyHideShow(element,useMarker) {
	var useMarker = (useMarker == null) ? false : useMarker;
	
	$(element+' h3+div').not((':first')).css("display", "none");
	$(element+' h3').not((':first')).prepend("<span class='marker'></span>");
	if ( useMarker ) {
		$(element+' h3:first').prepend("<span class='marker-active'></span>");
	}
	$(element+' h3').addClass('clickable').click(function() {
		var hMargin = $(this).css("margin-bottom");
		if ( hMargin != '0px' ) {
			var oldMargin = $("+ * > *",this).css("margin-top");
			//The sliding fx will cause a layout so we remove the first child elements top margin
			var mar = parseFloat(oldMargin) - parseFloat(hMargin);
			if ( mar > 0 ) {
				$("+ * > *",this).css("margin-top",mar);
			} else {
				$("+ * > *",this).css("margin-top","0");
			}
		} else {
			var oldMargin = null;
		}
		//$("+ * > *",this).css("margin-top","0");
		$(this).next().slideToggle('normal',function() {
			if ( oldMargin != null ) {
				$("> *",this).css("margin-top",oldMargin);
			}
		});
		
		if ( $("span",this).hasClass("marker") ) {
			$("span.marker",this).addClass("marker-active").removeClass("marker");
		} else {
			$("span.marker-active",this).addClass("marker").removeClass("marker-active");
		}
		
	});
};
