function PopupFlaer(src, width, height, alt){
	var scroll = "no";
	var top=0, left=0;
	height = height*1+20;
	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
	width = Math.min(width, screen.width-10);
	height = Math.min(height, screen.height-28);
	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
	wnd.document.write(
		"<html><head>"+
		"<title>"+(alt == ""? "Флаер":alt)+"</title>"+
		"<link rel='stylesheet' type='text/css' href='/bitrix/templates/Main/template_styles.css' />"+
		
		"<"+"style type=\"text/css\" media=\"print\">"+
			".print_print {visibility: hidden}"+
			".print_close {visibility: hidden}"+
			"body.print {margin:0;}"+
		"</" + "style>"+
		
		"<"+"script type=\"text/javascript\">"+
		"function KeyPress()"+
		"{"+
		"	if(window.event.keyCode == 27) "+
		"		window.close();"+
		"}"+
		"</"+"script>"+
		
		"</"+"head>"+
		"<body style='margin:0;padding:0;' onKeyPress=\"KeyPress()\">"+
		"<div class='print_links'>"+
			"<a class='print_close' onclick='javascript:window.close();return false' href='#'>закрыть</a>"+
			"<a class='print_print' onclick='javascript:window.print();return false' href='#'>распечатать</a>"+
		"</"+"div>"+
		"<img src=\""+src+"\" />"+
		"</body></html>"
	);
	wnd.document.close();
}

function ImgShw(SRC, width, height, alt)
{
	var scroll = "no";
	var top=0, left=0;
	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
	width = Math.min(width, screen.width-10);
	height = Math.min(height, screen.height-28);
	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
	wnd.document.write(
		"<html><head>"+
		"<"+"script type=\"text/javascript\">"+
		"function KeyPress()"+
		"{"+
		"	if(window.event.keyCode == 27) "+
		"		window.close();"+
		"}"+
		"</"+"script>"+
		"<title>"+(alt == ""? "Картинка":alt)+"</title></head>"+
		"<body style='margin:0;padding:0;' onKeyPress=\"KeyPress()\">"+
		"<img src=\""+SRC+"\" border=\"0\" alt=\""+alt+"\" />"+
		"</body></html>"
	);
	wnd.document.close();
}

function myLoadFoto(id){
	$.get("/bitrix/templates/Main/inlude_files/foto_detail.php",{r:Math.random(999),ID:id}, function(data){
		$("#DETAIL_IMAGES").html(data);
	});
}

function myLoadVideo(id){
	$.get("/bitrix/templates/Main/inlude_files/video.php",{r:Math.random(999),ID:id}, function(data){
		$("#VIDEO").html(data);
	});	
}