function open_img(title,path,size_x,size_y) {
	txt="";
	txt+="<html><head><style>body {margin:0;padding:0}\n .main_link {font-family:Microsoft sans serif,sans serif,arial;color:#3399CC;font-weight:normal;font-size:8pt;text-decoration:underline;}</style><title>"+title+"</title></head>";
	txt+="<body><img src=\""+path+"\" width="+((size_x)?size_x:500)+" height="+((size_y)?size_y:375)+" border=0 alt=\"\">";
	txt+="<br><br><center><a href='javascript:window.close();' class='main_link'><b>Закрыть окно</b></a></center><br><br></body></html>";
	win=window.open("","","width=500,height=415,status=no,toolbar=no,scrollbars=yes");
	if (!size_x && !size_y) {	
		win.moveTo(screen.width/2-510/2,screen.height/2-380/2);
		}
	else {
		win.resizeTo(size_x,size_y);
		win.moveTo(screen.width/2-(size_x+10)/2,screen.height/2-(size_y+30)/2);
		}
	win.document.write(txt);
}

width_padding = 0;
height_padding = 10;

function move_resize_wnd(win,width,height) {
	if (width > screen.width) {
		moveX = 0;
		width = screen.width;
	}
	else moveX = screen.width/2-(width+10)/2;
	if (height > screen.height) {
		moveY = 0;
		height = screen.height;
	}
	else moveY = screen.height/2-(height+30)/2
	win.resizeTo(width+width_padding,height+height_padding);
	win.moveTo(moveX, moveY);
}

function open_img2(page_url,width,height) {
	win=window.open(page_url,"","width="+(width+width_padding)+",height="+(height+height_padding)+",status=no,toolbar=no,scrollbars=yes");
	if (!width && !height) {	
		win.moveTo(screen.width/2-510/2,screen.height/2-380/2);
	}
	else {
		//win.resizeTo(width+width_padding,height+height_padding);
		//win.moveTo(screen.width/2-(width+10)/2,screen.height/2-(height+30)/2);
		move_resize_wnd(win,width,height);
	}
}

