var current;
var last;
var ptimer;
function show_image_preview(img) {
	w = 200; h = 150;
	
	if ((last != img) && (last != null)) {
		hide_image_preview(last);
	}
	last = img;
	
	thumb = document.getElementById("img_" + img)		
	obj = document.getElementById("img_preview_" + img);
	obj.src = thumb.src
	obj.src = thumb.src.replace(/thumb_/i, "preview_");
	if (thumb.width >= thumb.height) {
		obj.width = w;
		obj.height = w / thumb.width * thumb.height;
	} else {
		obj.width = h / thumb.height * thumb.width;
		obj.height = h;
	}

	obj.style.display = "";
}

function hide_image_preview(img) {
	obj = document.getElementById("img_preview_" + img);
	obj.style.display='none'; 
	obj.width=''; obj.height='';
}