// base.js

// CONTENT-BOX
function resizeBox() {
	if($('#box')) {
		var boxHeight = $('#box').height();
		var winHeight = $(window).height();
		var maxHeight = winHeight - 280;
		var minHeight = 220;
		var contHeight = $('#content').height();
		
		if(maxHeight < minHeight) {
			maxHeight = minHeight;
		}
		if(contHeight > maxHeight) {
			contHeight = maxHeight;
		} else if(contHeight < minHeight) {
			contHeight = minHeight;
		} else if(contHeight < boxHeight) {
			contHeight = boxHeight;
		}
		
		if($('#box').height() >= maxHeight) {
			$('#box').height(maxHeight);
		} else {
			$('#box').height(contHeight);
		}
		
		jScrollHeight = $('#box').height() + 20;
		
		//$('.jScrollPaneContainer').height(jScrollHeight);
	}
}


// TOGGLER
function toggleHide() {
	$("#box").css("min-height","30px");
	$("#box").stop().animate({ height: 30}, { "duration": "slow"} );
	
	$('#content').css("display","none");
	$('.toggler').removeClass('contentShown');
	$('.toggler').addClass('contentHidden');
	
	//$('.headline').css("display","block");
	
	$(".toggler img").attr({src: "/fileadmin/web/images/toggle_up.gif"});
	
	//$("#box").removeClass('boxShown');
	//$("#box").addClass('boxHidden');
}

function toggleShow() {
	$("#box").css("min-height","30px");
	$("#box").css("height","30px");
	
	$('#content').css("display","block");
	
	$('.toggler').removeClass('contentHidden');
	$('.toggler').addClass('contentShown');
	
	//$('.headline').css("display","none");
	
	$(".toggler img").attr({src: "/fileadmin/web/images/toggle_down.gif"});
	
	$("#box").stop().animate({ height: fullHeight}, { "duration": "slow"} );
	$("#box").removeClass('boxHidden');
	$("#box").addClass('boxShown');
}


// Flashes fokussieren
$(document).ready(function() {
	if ($('#box').is('.boxShown')) {
		resizeBox();
	} else return false;
});



