window.addEvent('domready', function() {
	resize();
	
	window.addEvent('resize', function(){
		resize();
	});
});

function resize() {
	var x = window.getWidth();
	var y = window.getHeight();
	var ratio = x / y;
	var theWidth = 0, theHeight = 0;
	var imgRatio = 1.42857142857;	

	if(ratio > imgRatio){
		theWidth = x + 'px';
		theHeight = x / imgRatio + 'px';
	}else{
		theWidth = y*imgRatio + 'px';
		theHeight = y + 'px';
	}
	
	$('pics').style.width = theWidth;
	$('texture').style.width = theWidth;
	$('pics').style.height = theHeight;
	$('texture').style.height = theHeight;
}