
/*
demo.js
Copyright: Siegfried Mairböck, 2011
Juni 2011
Famlienheim und Garten:
Aufklappen der Rubrikenboxen, damit alle Inhalte gelesen werden können.
*/

var $aktuell = null;

$(function() {
	$(".Rubrik")
		.mouseenter(function () {
			copyRubrik(this);
		})
});


function copyRubrik (obj) {
	var $o = $(obj).clone();

	removeRubrik();
	
	$o
		.mouseleave(function () {
			removeRubrik();
		})
		.addClass("RubrikHover")
		.css({ 
			left: $(obj).position().left,
			top: $(obj).position().top - 2,
			display: "none"
		});
	
	
	$(".RubrikInhalt",$o).css({
		height: "auto"
	});
	$aktuell = $o;
	$o.appendTo("#MAIN-BODY"); // document.body);
	
	$o.fadeIn("fast");
}

function removeRubrik () {
	if ($aktuell) {
		$aktuell.fadeOut("normal",function () { $(this).remove(); });
		$aktuell = null;
	}
}
