	function drawPanel(pe, sidePx) {
		peh = "<table align=\"right\">";
		for (xi = 0; xi < panelX; xi++) {
			peh += "<tr height=" + sidePx + ">";
			for (yi = 0; yi < panelY; yi++) {
				peh += "<td bgcolor=FFFFFF width=" + sidePx + " id=\"cell" + ((xi * panelY) + yi) + "\"></td>";
			}
			peh += "</tr>";
		}
		peh += "</table>";
		pe.innerHTML = peh;
	}

	function fillPanel() {
		for (xi = 0; xi < panelX; xi++) {
			for (yi = 0; yi < panelY; yi++) {
				randomlyChangeCell(xi, yi);
			}
		}
	}

	function randomlyChangeCell(xi, yi) {
		cellEl = getCell(xi, yi);
		fId = getRandomPicture();
		cellEl.innerHTML = "<img src=\"pan/fotopanel" + + fId + ".jpg\">";
	}

	function getRandomCell() {
		xi = Math.floor(Math.random() * panelX);
		yi = Math.floor(Math.random() * panelY);
		return getCell(xi, yi);
	}

	function getCell(xi, yi) {
		cellId = "cell" + ((xi * panelY) + yi);
		return document.getElementById(cellId);
	}

	function animatePanel() {
		timeTillNext = Math.round(100 + 2000 * Math.sqrt(Math.random()));
		cellEl = getRandomCell();
		newPicture = "<img src=\"pan/fotopanel" + + getRandomPicture() + ".jpg\">";
		cellEl.innerHTML = newPicture;
		setTimeout('animatePanel()', timeTillNext);
	}

	function getRandomPicture() {
		return Math.ceil(Math.random() * fotos);
	}


