/*Это скрипт, открывающий крупное фото в новом окне*/
function open_photo_window(url) {
	try {
		var title_el = url.parentNode.parentNode.parentNode.getElementsByTagName('h2');
		var title_text = (title_el[0]) ? title_el[0].innerHTML : '';
		var top = Math.ceil((screen.height-480)/2), left = Math.ceil((screen.width-640)/2);
		var properties = 'location=no,menubar=no,resizeble=no,scrollbars=no,status=no,toolbar=no,height=480,width=640,top='+top+',left='+left+'';
		var photo_win = window.open('','',properties)
		with (photo_win.document) {
			writeln('<html><head>');
			writeln('<title>'+title_text+'</title>');
			writeln('<style type="text/css">* {margin:0; paddimg:0} html, body {height:100%} #center {position:absolute; top:50%; left:50%; height:0; width:0} #preloader {position:relative; top:-50px; left:-50px}</style>');
			writeln('<scr'+'ipt type="text/javascript">');
			writeln('function img_loaded(obj) {');
			writeln('var new_height = obj.height - 480;');
			writeln('var new_width = obj.width - 640;');
			writeln('window.resizeBy(new_width, new_height);');
			writeln('var new_top = Math.ceil((screen.height-obj.height)/2), new_left = Math.ceil((screen.width-obj.width)/2);');
			writeln('window.moveTo(new_left, new_top);');
			writeln('document.getElementById(\'center\').style.display = \'none\';');
			writeln('obj.style.visibility = \'visible\';');
			writeln('}');
			writeln('</scr'+'ipt>');
			writeln('</head><body onload="self.focus()">');
			writeln('<div id="center"><img id="preloader" src="/images/loading.gif" width="100" height="100"></div>');
			writeln('<img src="'+url+'" onload="img_loaded(this)" style="visibility:hidden">');
			writeln('</body></html>');
			close();
		}
		return false;
	}
	catch(e) {return true}
	return true;
}