window.onload = load;
window.onresize = resize;

function load()
{
	resize();
}

function resize()
{
	$(document).ready(function(){
		if ($("#news").length == 1)
		{
			text_id = "#news";
		}
		if ($("#news_sub").length == 1)
		{
			text_id = "#news_sub";
			$("#scroller").css('width',$(window).width()-240+'px');
		}

		var max=0;

		$(text_id+" .text").each(
			function(){
				if (max<$(this).height())
				{
					max = $(this).height();
				}
			}
		);

		if (max<$("#news_menu").height())
		{
			max = $("#news_menu").height();
		}

		max -= 50;

		if ($(window).height()>max+294)
		{
			$("#scroller").css('height',$(window).height()-206+'px');
			$("#wrapper").css('height',$(window).height()-206+'px');
			$("#news").css('height',$(window).height()-231+'px');
			$("#news_sub").css('height',$(window).height()-231+'px');
		} else {
			$("#wrapper").css('height',max+291+'px');
			$("#scroller").css('height',max+91+'px');
			$("#news").css('height',max+60+'px');
			$("#news_sub").css('height',max+60+'px');
		}
	});	
}
