var mainWidth = -1;
var mainHeight = -1;
var aspectRatio = -1;

function layout()
{
	if( aspectRatio == -1 )
	{
		var im = document.getElementById( "idbgimg" );
		aspectRatio = im.width / im.height;
		var d = document.getElementById( "idloading" );
		d.style.display = "none";
		d = document.getElementById( "idlyricdiv" );
		d.style.display = "block";
	}

	var b = document.getElementById("idbody");
	if( b.offsetWidth != mainWidth || b.offsetHeight != mainHeight )
	{
		mainWidth = b.offsetWidth;
		mainHeight = b.offsetHeight;
		var im = document.getElementById( "idbgimg" );
		im.width = Math.floor(mainWidth * 9 / 10);
		im.height = Math.floor( im.width / aspectRatio);
		im = document.getElementById( "idimgdiv" );
		im.style.top = "10px";
		im.style.left = Math.floor(mainWidth / 20) + "px";
		im = document.getElementById( "idlyricdiv" );
		im.style.top = "10px";
		im.style.left = Math.floor( mainWidth / 10 ) + "px";
		im.style.width = Math.floor( mainWidth * 4 / 5 ) + "px";
	}
	setTimeout( "layout()", 2000 );
}


