function print_version(type)
{
	var divs = getElementsByClassName("printable", "div");
	if (divs.length > 0)
	{
		var now = new Date();
		hwnd = window.open('', 'print'+now.getTime(), '');
		hwnd.document.open();
		hwnd.document.writeln('<html><head>');
		hwnd.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />');
		hwnd.document.writeln('<title>' + document.title + ' - Версия для печати</title>');
		hwnd.document.writeln('<link href="/styles/style47.css" rel="stylesheet" type="text/css" />');
		hwnd.document.writeln('<link href="/styles/basic.css" rel="stylesheet" type="text/css" />');
		hwnd.document.writeln('<link href="/styles/visual_int.css" rel="stylesheet" type="text/css" />');
		hwnd.document.writeln('<link href="/styles/layout_int.css" rel="stylesheet" type="text/css" />');
		hwnd.document.writeln('<link href="/styles/print.css" rel="stylesheet" type="text/css" />');
		hwnd.document.writeln('</head>');
		hwnd.document.writeln('<body>');
		if ("anketa" == type)
		{
			hwnd.document.writeln('<div id="print_version">');
			hwnd.document.writeln('<a href="#">');
			hwnd.document.writeln('<img src="/images/printver.gif" alt="начать печать" border="0" />');
			hwnd.document.writeln('</a>');
			hwnd.document.writeln('</div><div id="preview_zone">');
		}
		for (var i = 0; i < divs.length; i++)
		{
			hwnd.document.writeln('<div id="' + divs[i].id + '">');
			hwnd.document.writeln(divs[i].innerHTML);
			hwnd.document.writeln('</div>');
		}
		hwnd.document.writeln('</body></html>');
		hwnd.document.close();
		hwnd.document.getElementById("print_version").firstChild.href = "javascript:window.print()";
		if (window.focus) { hwnd.focus(); }
		return false;
	}
}

function init_printver()
{
	if ($('print_version') && $('print_version').firstChild)
		addEvent($('print_version').firstChild, 'click', print_version, false);
}

addEvent(window, 'load', init_printver, false);