/**
 * @author Phil Leggetter
 * Independent Software Solutions Ltd
 * http://independentsoftwaresolutions.com
 */

var BGResize = new Class(
{
	MIN_CONTENT_SIZE: 1007,
	MAX_CONTENT_SIZE: 1280,
	CONTENT_MARGIN: 0, // 25px either side
	
	/**
	 *
	 */
	initialize: function(sImageRootUrl, sOverlayParentId)
	{
		var oThis = this;
		window.addEvent('domready', function(){oThis.domReady();} );
		window.addEvent('resize', function(){oThis.windowResized();} );
	},
	
	/**
	 *
	 */
	domReady: function()
	{
		this.windowResized();
	},
	
	windowResized: function()
	{		
		var myEffects = new Fx.Morph('content', {duration: 250,transition: Fx.Transitions.linear});
		var width = window.getWidth();
		if( width < this.MIN_CONTENT_SIZE ) width = this.MIN_CONTENT_SIZE;
		else if( width > this.MAX_CONTENT_SIZE ) width = this.MAX_CONTENT_SIZE;
		myEffects.start({
    						'width': [(width - this.CONTENT_MARGIN)]
						});
	}
	
});
new BGResize();
