Event.observe(window,'load',function(evt)
{
	watchLayer();
	Event.observe(document.onresize ? document : window, "resize", function(evt)
	{
		watchLayer();
	});
});

function watchLayer()
{
	var minSize = 1150;
	var arrayPageSize = getPageSize();

	var newSize = arrayPageSize[0];
	if ( newSize < minSize ) newSize = minSize;

	$('img').style.width  = newSize +"px";
}

function getPageSize()
{
	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY)
	{
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	}
	// all but Explorer Mac
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	else
	{
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

	// all except Explorer
	if (self.innerHeight)
	{
		if(document.documentElement.clientWidth)
			windowWidth = document.documentElement.clientWidth;
		else
			windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	}
	// Explorer 6 Strict Mode
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	}
	// other Explorers
	else if (document.body)
	{
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
		pageHeight = windowHeight;
	else
		pageHeight = yScroll;

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth)
		pageWidth = xScroll;
	else
		pageWidth = windowWidth;

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)

	return arrayPageSize;
}