var Layout = Class.create (
{
	initialize: function()
	{
		this.main	= $('main');
		this.footer = $('mainFooter');
		this.content = $('mainContent');
		this.viewportMinHeight = 610;
		/*this.viewportMinWidth = 1000;
		this.minHeaderHeight = 70;
		this.minFooterHeight = 70;*/
		this.redrawing = true;
		
		this.redraw();
		Event.observe(window, 'resize', this.onResize.bindAsEventListener(this));
	},
	
	onResize:function()	
	{
		if(!this.redrawing)
		{
			this.redrawing = true;
			setTimeout(this.redraw.bindAsEventListener(this), 5);		
		}
	},
	
	redraw:function()
	{

			vieportHeight = Math.max(document.viewport.getHeight(), this.viewportMinHeight);
			vieportWidth = document.viewport.getWidth();
		
			this.content.style.top = parseInt((vieportHeight - 440-170) / 2) + 'px';
			this.redrawing = false;
	}
	
});

var layout;
document.observe("dom:loaded", function() 
	{
		layout = new Layout();
	}
);		
Event.observe(window, 'load', function() 
{
		if ($('articleScrollContent'))
		{
			new Control.Scroller( 'articleScrollContent', 'infoScrollHandle', 'infoScrollTrack',{
				up: "button-up",
				visibleHeight: 240,
				down: "button-down"				
			});
		}
		
		if ($('infoScrollContent'))
		{
			new Control.Scroller( 'infoScrollContent', 'infoScrollHandle', 'infoScrollTrack',{
				up: "button-up",
				visibleHeight: 345,
				down: "button-down"				
			});
		}
		if ($('priceScrollContent'))
		{
			new Control.Scroller( 'priceScrollContent', 'priceScrollHandle', 'priceScrollTrack',{
				up: "button-up",
				visibleHeight: 312,
				down: "button-down"				
			});
		}
		
	}
);