function wh()
{
	var height, width;
	if( document.layers )
	{
		height = window.innerHeight;
		width = window.innerWidth;
	}
	else
	{
		height = document.body.offsetHeight;
		width = document.body.offsetWidth;
	}

	return { 'width': parseInt( $( 'menu' ).getWidth() ), 'height': parseInt( height ) };
}

function on_resize( minus )
{
	if( undefined != $( 'header' ) )
	{
		minus	= parseInt( minus );
		if( isNaN( minus ) )
		{
			minus	= 0;
		}

		window.layoutWidth	= $( 'header' ).getWidth() - minus;
		window.blockWidth	= Math.floor( window.layoutWidth / 2 ) - 6;
	}
	else
	{
		window.layoutWidth	= null;
		window.blockWidth	= null;
	}

	window.iterator	= 0;
	window.el	= null;

	window.news.each(
		function( s )
		{
			obj	= $( s );

			if( wh().width < 1100 )
			{
				obj.setStyle({
					'float':		'none',
					'width':		'100%',
					'marginRight':	'0px'
				});
				totop	= 1;

				if( 0 == window.iterator % 2 )
				{
					obj.addClassName( 'block-grey' );
					obj.removeClassName( 'block-white' );
				}
				else
				{
					obj.addClassName( 'block-white' );
					obj.removeClassName( 'block-grey' );
				}
			}
			else
			{
				obj.setStyle({
					'height':	'auto',
					'float':	1 == window.iterator % 2 ? 'right' : 'left',
					'width':	window.blockWidth
				});
				totop	= 2;

				if(
					0 == ( window.iterator - 3 ) % 4
					||
					0 == ( window.iterator - 4 ) % 4
				)
				{
					obj.addClassName( 'block-grey' );
					obj.removeClassName( 'block-white' );
				}
				else
				{
					obj.addClassName( 'block-white' );
					obj.removeClassName( 'block-grey' );
				}
			}

			if(
				window.iterator < totop
				&&
				'allnews' == obj.parentNode.id
			)
			{
				new Insertion.Bottom( 'header', obj );
			}

			if(
				true === window.removem12
				&&
				2 == totop
				&&
				(
					2 == window.iterator
					||
					3 == window.iterator
				)
			)
			{
				obj.removeClassName( 'mt12' );
			}

			if( 1 == totop )
			{
				if( 1 == window.iterator )
				{
					if( $( 'allnews' ) )
					{
						new Insertion.Top( 'allnews', obj );
					}
				}
				if(
					2 == window.iterator
					||
					3 == window.iterator
				)
				{
					obj.addClassName( 'mt12' );
				}
			}

			if( wh().width > 1100 )
			{
				if( null != window.el )
				{
					var tobj	= $( window.el );
					var h		= tobj.getHeight() > obj.getHeight() ? tobj.getHeight() : obj.getHeight();

					if( h % 2 )
					{
						h++;
					}

					tobj.setStyle({
						'height':	h
					});
					obj.setStyle({
						'height':	h
					});

					window.el	= null;
				}
				else
				{
					window.el	= s;
				}
			}

			window.iterator++;
		}
	);
}