function draw()
{
	for (i = 0; i < 10; i++)
	{
		var x = Math.floor(Math.random() * 22) * 20;
		var y = Math.floor(Math.random() * 12) * 20;
		var size = 20 + Math.floor(Math.random() * 12) * 20;
		var line = document.createElement('div');
		var horizontal = Math.random() < 0.5;

		if (!horizontal && x > 200)
			if (size + y > 120)
				size = 120 - y;
		if (horizontal && y > 140)
			if (size + x > 240)
				size = 120 - x;


		if (horizontal)
		{
			line.setAttribute('class', 'hline');
			line.style.width = size + "px";
		}
		else
		{
			line.setAttribute('class', 'vline');
			line.style.height = size + "px";
		}

		if (Math.random() < 0.2)
			x += Math.random() * 5 - 2;
		if (Math.random() < 0.2)
			y += Math.random() * 5 - 2;

		line.style.left = x + "px";
		line.style.top = y + "px";
		document.body.appendChild(line);
	}
}

window.onload = draw;

