function img_old(imgf, tit){
	rand_id = 'image' + (Math.round(Math.random() * 1000));
	outf = 
		"<html>" 
		+ "<head>" 
		+ "<title>" + tit + "</title>" 
		+ "<style type=\"text/css\">body {margin: 0; padding: 0;}</style>" 
		+ "</head>" 
		+ "<" + "body" + ">" 
		+ "<img src=\"" + imgf + "\">";
	iopen = "iwin = self.open('" + imgf + "', '" + rand_id + "', 'width = ' + (img1.width) + ', height = ' + (img1.height) + ',top = 20, left = 5, scrollbars = no, resizable = no');"
	    + "iwin.document.write('" + outf + "');"
	    + "iwin.focus();";
	
	img1 = new Image();
	img1.src = imgf;
	
	if(img1.width != 0){
		eval(iopen);
	}
	else
	{
		iwin = self.open('about:blank', 'f' + rand_id, 'width = 100, height = 100, top = 0, left = 0');
		iwin.document.write(
		"<html>" 
		+ "<" + "body" + ">" 
		+ "<" + "script>" 
		+ "function imo(img1){" +iopen 
		+ "self.close();"
		+ "}<" + "/script>" 
		+ "<img src='" + imgf + "' onload='imo(this);'>");
	  }
}


function img(imgf, tit){
	
	document.getElementById('fon').style.display = "block";
	//document.getElementById('fon').style.width = document.getElementById('container').clientWidth + 'px';
	document.getElementById('fon').style.height = document.getElementById('container').clientHeight + 'px';
	var el_div = document.getElementById("for_image");
	el_div.style.top = 10 + (document.documentElement.scrollTop || document.body.scrollTop) + 'px';
	//alert("Ya" + el_div);
	el_div.innerHTML = "<img src='" + imgf + "' onclick='img_close();' title='Закрыть'>"
}

function img_close(){
	document.getElementById("for_image").innerHTML="";
	document.getElementById('fon').style.display = "none";
}