pics = new Array();
var objCount = 0; // количество изображений на web-странице
var result;

function preload(name, first, second)
{
	// предварительная загрузка изображений и размещение их в массиве
	pics[objCount] = new Array(3);
	pics[objCount][0] = new Image();
	pics[objCount][0].src = first;
	pics[objCount][1] = new Image();
	pics[objCount][1].src = second;
	pics[objCount][2] = name;
	objCount++;
}

function on(name)
{
	for (i = 0; i < objCount; i++)
	{
		if (document.images[pics[i][2]] != null)
			if (name != pics[i][2])
			{
				// вернуть в исходное систояние все другие изображения
				document.images[pics[i][2]].src = pics[i][0].src;
			}else{
				// показывать вторую картинку, поскольку курсор пересекает данное изображение
				document.images[pics[i][2]].src = pics[i][1].src;
			}
	}
}

function off()
{
	for (i = 0; i < objCount; i++)
	{
		// вернуть в исходное систояние все изображения
		if (document.images[pics[i][2]] != null)
			document.images[pics[i][2]].src = pics[i][0].src;
	}
}

var result = null;

function view(typa, name)
{
	window_width = 400;
	window_height = 560;

	left_pos = (screen.width - window_width)/2;
	top_pos = (screen.height - window_height - 30)/2 - 10;
	set_scrollbars = "no";

	window_add_width = 0;
	if (left_pos < 40) {
		left_pos = 40;
		window_width = screen.width - 80;
		set_scrollbars = "yes";
	};
	
	tt_win_w = window_width + 10;
	if (top_pos < 40) {
		top_pos = 20;
		window_height = screen.height - 80;
		if (set_scrollbars == "no") tt_win_w += 18;
		set_scrollbars = "yes";
	};
	
	doc_text = "<HTML><HEAD><LINK REL=stylesheet TITLE=\"text style\" HREF=\"/styles/main.css\" TYPE=\"text/css\"><TITLE>ООО \"Новатра\"</TITLE></HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 RIGHTMARGIN=0 TOPMARGIN=5 BGCOLOR=white onunload='opener.on_close_win()'>";
	doc_text += "<div align=center><img width=\"390\" src=\"/img/sertificates/" + name + "\" border=0></div><div align=center class=text><a href=\"javascript:\" style=\"font-size:12px;color:#000000;text-decoration:underline;\" onclick=\"window.close();\">Закрыть окно</a></div>";
	doc_text += "</BODY></HTML>";

	result = open("", "displayWindow","width=" + tt_win_w + ",height=" + (window_height + 30) + ",left=" + left_pos + ",top=" + top_pos + ",resizable=yes,status=no,toolbar=no,menubar=no,scrollbars=" + set_scrollbars);
	result.document.open();
	result.document.write(doc_text);
	result.document.close();
	result.focus();
}