function showImage(img, w, h) {
	if(w == null) w = 200;
	if(h == null) h = 200;
	var win = window.open("about:blank", "_blank", "width=" + w + ",height=" + h + ",status=0,resizable=0");
	var doc = win.document;

	doc.write('<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Kép</title></head>');
	doc.write('<body style="margin: 0px;">');
	doc.write('<img src="' + img + '" alt="" onclick="window.close();" style="cursor: pointer;">');
	doc.write('</body>');
	doc.close();
}

function dropIn() {
	var box = document.getElementById('dropin');
/*	console.log(box);
	console.dir(box); */
	if(box == null) return;
	document.body.appendChild(box);

	box.insertBefore(jsonML([ 'h1', [ 'a', { 'onclick': close } ] ]), box.firstChild);

	var y = -box.offsetHeight;
	var ymax = Math.floor((document.body.offsetHeight - box.offsetHeight) / 2);

	box.style.left = Math.floor((document.body.offsetWidth - box.offsetWidth) / 2) + 'px';

	function close() {
		box.style.display = 'none';
		y = false;
	}

	function move() {
		if(y === false) return false;
		box.style.top = y + 'px';
		y = Math.round(y + Math.sqrt(Math.abs(ymax - y)) + 1);
		return y <= ymax;
	}

	function timer() {
		if(move()) setTimeout(timer, 25);
	}

	timer();
}

CaptureEvent(window, "load", function() { dropIn() }, true);

