var subdir = "history";
dir = document.location.href;
dir = dir.substring(0,dir.lastIndexOf(subdir)+subdir.length+1);
var subdir = dir.substring(0,dir.lastIndexOf(subdir));

var NS4 = false;
var NS6 = false;
var newWin = null;
if (!document.all && document.getElementById) NS6 = true;
if (navigator.appName == "Netscape" && document.getElementById == undefined) NS4 = true;
var layerRef,layerLeft;
if (NS4 || NS6){
	if (NS4){
		layerRef = "document.layers[";
		layerLeft = "].left";
		layerVis = "].visibility";
	} else {
		layerRef = "document.getElementById(";	
		layerLeft = ").style.left";
		layerVis = ").style.visibility";		
	}
}else{
	layerRef = "document.all[";
	layerLeft = "].style.pixelLeft";	
	layerVis = "].style.visibility";	
	
}

Array.prototype.name = "";
var aLeft = new Array(18,170,253,335,423,513,30,130,249,308,380,467);
var aSubLeft = new Array(18,170,253,335,423,513,30,130,249,308,380,467);

var menu0 = new Array(5);
menu0.img = "<img border=\"0\" src=\""+dir+"btn1_1.gif\" width=\"134\" height=\"17\">";
menu0[0] = new classLink("Строительство института (часть 1)",dir+"part22/part22_1.html");
menu0[1] = new classLink("Строительство института (часть 2)",dir+"part22/part22_2.html");
menu0[2] = new classLink("Строительство института (часть 3)",dir+"part22/part22_3.html");
menu0[3] = new classLink("Формирования органов<br> управления",dir+"part3/part3.html");
menu0[4] = new classLink("Открытие института",dir+"part1/part1.html");


var menu1 = new Array(7);
menu1.img = "<img border=\"0\" src=\""+dir+"btn1_2.gif\" width=\"65\" height=\"17\">";

menu1[0] = new classLink("События 1905 года",dir+"part2/part2.html");
menu1[1] = new classLink("Восстановление учебного процесса",dir+"part4/part4.html");
menu1[2] = new classLink("Первая мировая война",dir+"part5/part5.html");
menu1[3] = new classLink("После двух революций",dir+"part6/part6.html");
menu1[4] = new classLink("Участие в разработке и воплощении<br>планов ГОЭЛРО",dir+"part7/part7.html");
menu1[5] = new classLink("Рабфак",dir+"part8/part8.html");
menu1[6] = new classLink("Окончание гражданской войны",dir+"part9/part9.html");

var menu2 = new Array(4);
menu2.img = "<img border=\"0\" src=\""+dir+"btn1_3.gif\" width=\"64\" height=\"17\">";

menu2[0] = new classLink("20-е годы",dir+"part16/part16.html");
menu2[1] = new classLink("Создание на базе ЛПИ отраслевых институтов",dir+"part21/part21.html");
menu2[2] = new classLink("Образование Ленинградского индустриального института",dir+"part17/part17.html");
menu2[3] = new classLink("Политехнический институт имени М.И. Калинина",dir+"part18/part18.html")
 
var menu3 = new Array(7);
menu3.img = "<img border=\"0\" src=\""+dir+"btn1_4.gif\" width=\"67\" height=\"17\">";
menu3[0] = new classLink("Великая Отечественная война",dir+"part19/part19.html");
menu3[1] = new classLink("Фронт был рядом",dir+"1941-1945/page4.html");
menu3[2] = new classLink("Институт защищался и работал",dir+"1941-1945/page1.html");
menu3[3] = new classLink("На фронтах",dir+"1941-1945/page3.html");
menu3[4] = new classLink("Победа ",dir+"1941-1945/page2.html");
menu3[5] = new classLink("Герои ",dir+"1941-1945/page6.html");
menu3[6] = new classLink("Ветераны",dir+"1941-1945/page5.html");
menu3[7] = new classLink("Книга памяти","http://comtext.net.ru/museum");

var menu4 = new Array(1);
menu4.img = "<img border=\"0\" src=\""+dir+"btn1_5.gif\" width=\"70\" height=\"17\">";
menu4[0] = new classLink("Начало мирной жизни",dir+"part20/part20.html");

var menu5 = new Array(1);
menu5.img = "<img border=\"0\" src=\""+dir+"btn1_6.gif\" width=\"71\" height=\"17\">";
menu5[0] = new classLink("ЛПИ в 60-е, 70-е годы",dir+"part14/part14.html");

var menu6 = new Array(1);
menu6.img = "<img border=\"0\" src=\""+dir+"btn1_7.gif\" width=\"70\" height=\"17\">";
menu6[0] = new classLink("Последние десятилетия века",dir+"part15/part15.html");

var menu7 = new Array(2);
menu7.img = "<img border=\"0\" src=\""+dir+"btn1_8.gif\" width=\"89\" height=\"17\">";

menu7[0] = new classLink("СПбГТУ на пороге нового тысячелетия",dir+"part12/part12.html");
menu7[1] = new classLink("Празднование 100-летия СПбГТУ",dir+"part13/part13.html");

var menu8 = new Array(2);
menu8.img = "<img border=\"0\" src=\""+dir+"btn1_9.gif\" width=\"34\" height=\"17\">";

menu8[0] = new classLink("Студенты-политехники на целине",dir+"part10/part10.html");
menu8[1] = new classLink("На строительстве гиганта энергетики",dir+"part11/part11.html");


var menu9 = new Array(6);
menu9.img = "<img border=\"0\" src=\""+dir+"btn1_10.gif\" width=\"43\" height=\"17\">";

menu9[0] = new classLink("\"Держите себя с достоинством\" - речь кн. А.Г. Гагарина<BR>при открытии Политехнического института",dir+"archives/archives1.html");
menu9[1] = new classLink("\"Открытие С.-Петербургского политехникума\" -<BR>Биржевые ведомости. 1902 г. 2 октября",dir+"archives/archives2.html");
menu9[2] = new classLink("\"Описание форменной одежды студентов\" - Вестник финансов,<BR>промышленности и торговли.- 1902.- №44.",dir+"archives/archives3.html");
menu9[3] = new classLink("\"Наш князь\" - Е. Вечорин",dir+"archives/archives4.html");
menu9[4] = new classLink("Первые годы  (1902-1907гг.) - Е. Вечорин - Юбилейный сборник,<BR>Париж, 1952г.",dir+"archives/archives5.html");
menu9[5] = new classLink("Новый 1941 год",dir+"ny_1941/ny_1941.html");



var menu10 = new Array(2);
menu10.img = "<img border=\"0\" src=\""+dir+"btn1_11.gif\" width=\"60\" height=\"17\">";

menu10[0] = new classLink("Ректоры университета",dir+"rectors/rectors.html");
menu10[1] = new classLink("А.Г. Гагарин - первый директор",dir+"rectors/gagarin/page1.html");

var menu11 = new Array(2);
menu11.img = "<img border=\"0\" src=\""+dir+"btn1_12.gif\" width=\"101\" height=\"17\">";
menu11[0] = new classLink("Ксенофонт Иванович Руберовский",dir+"times_and_lives/ruberovskiy_k_i/ruberovskiy.html");
menu11[1] = new classLink("Василий Тимофеевич Струнников",dir+"times_and_lives/strunnikov_v_t/page1.html");

var centerUp = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
centerUp += "<tr>";
centerUp += "<td width=\"1\" bgcolor=\"#583B21\"><img border=\"0\" src=\""+dir+"zero.gif\" width=\"1\" height=\"1\"></td>";
centerUp += "<td bgcolor=\"#FAF7EF\">";
centerUp += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
centerUp += "<tr>";
centerUp += "<td width=\"5\" bgcolor=\"#FAF7EF\"></td>";		
centerUp += "<td bgcolor=\"#FAF7EF\"><p class=\"topmenu\">";

var centerDown = "</p></td>";
centerDown += "<td width=\"5\" bgcolor=\"#FAF7EF\"></td>";			
centerDown += "</tr>";
centerDown += "<tr><td colspan=\"3\" bgcolor=\"#FAF7EF\"><img border=\"0\" src=\""+dir+"zero.gif\" width=\"1\" height=\"3\"</td></tr>";	
centerDown += "</table></td>";
centerDown += "<td bgcolor=\"#583B21\" width=\"1\"><img border=\"0\" src=\""+dir+"zero.gif\" width=\"1\" height=\"1\"></td>";
centerDown += "</tr>";
centerDown += "<tr>";
centerDown += "<td colspan=\"3\" bgcolor=\"#583B21\"><img border=\"0\" src=\""+dir+"zero.gif\" width=\"10\" height=\"1\"></td>";
centerDown += "</tr>";
centerDown += "</table>";			

function classLink(title, url) {
	this.name = title
	this.url = url
 }

function writeSupport(){
	document.write("<img border=\"0\" src=\""+dir+"support1.gif\" width=\"199\" height=\"17\"><a href=\"mailto:itt@spbstu.ru\" target=\"_blank\"><img border=\"0\" src=\""+dir+"support2.gif\" width=\"423\" height=\"17\"></a>");
}

function showSearchForm(){

}

function writeSearchForm(){
	var upText="",downText="",centerText="";
	if (NS4){
		upText = "<layer id=\"searchLayer\" Z-INDEX=1 TOP=226 VISIBILITY=HIDE>";
		downText= "</layer>";
	} else {
		upText	= "<div id=\"searchLayer\" style=\"position: absolute; top: 226; visibility:hidden; z-index:1;\">";
		downText= "</div>";	
	}
		
	centerText = "<table border=0 bgcolor=#583B21 cellspacing=0 cellpadding=5><tr><td><table border=0 cellpadding=3 cellspacing=1>";
	centerText += "<form method=\"POST\" action=\""+dir+"search_chronology.asp\" NAME=\"addForm\">";
	centerText += "<tr><td bgcolor=#E6D6AC align=center><b>Поиск</b></td></tr><tr>";
	centerText += "<td rowspan=2 bgcolor=#FFFFFF><table border=0 cellspacing=0 cellpadding=3><tr>";
	centerText += "<td align=right>Искать:</td>";
	centerText += "<td><INPUT type=\"text\" size=40 name=\"searchFor\" style=\"font-size: 8pt\"></td></tr>";
	centerText += "<tr><td>Искать в:</td><td><INPUT type=\"radio\" name=\"catalog\" value=\"1\">основных разделах сайта<BR>";
	centerText += "<INPUT type=\"radio\" name=\"catalog\" value=\"2\" checked>истории<BR>";
	centerText += "<INPUT type=\"radio\" name=\"catalog\" value=\"3\">периодических изданиях СПбГПУ</td>";
	centerText += "</tr><tr><td colspan=2 align=center><INPUT type=\"submit\" value=\"Найти\" style=\"font-size: 8pt; font-weight: bold\"><INPUT type=\"button\" onClick=\"hideLayer('searchLayer')\" value=\"Закрыть\" style=\"font-size: 8pt; font-weight: bold\">";
	centerText += "</td></tr></table></td></tr></form></table></td></tr></table>";
	document.write(upText+centerText+downText);
}

function createMenu(){
	var str,topMenu1=148,topMenu2=168;
	writeLayer(0,topMenu1,300);
	writeLayer(1,topMenu1,300);
	writeLayer(2,topMenu1,300);
	writeLayer(3,topMenu1,300);
	writeLayer(4,topMenu1,300);
	writeLayer(5,topMenu1,300);
	writeLayer(6,topMenu2,300);
	writeLayer(7,topMenu2,300);
	writeLayer(8,topMenu2,300);
	writeLayer(9,topMenu2,300);
	writeLayer(10,topMenu2,300);
	writeLayer(11,topMenu2,300);	
	str = "<table bordr =\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td nowrap><A href=\"javascript:showLayer('searchLayer')\"><img border=\"0\" src=\""+dir+"btn12_off.gif\" width=\"32\" height=\"15\"></a><img border=\"0\" src=\""+dir+"white_line.gif\" hspace=\"5\" width=\"1\" height=\"12\"><a href=\""+dir+"feedback_chronology.asp\"><img border=\"0\" src=\""+dir+"btn14_off.gif\" width=\"61\" height=\"15\"></a><img border=\"0\" src=\""+dir+"white_line.gif\" hspace=\"5\" width=\"1\" height=\"12\"><a href=\""+subdir +"home.html\"><img border=\"0\" src=\""+dir+"btn16_off.gif\" width=\"112\" height=\"15\"></td></tr></table></a>";	
	if (NS4){
		str	= "<layer id=\"menu_up\" VISIBILITY=HIDE Z-INDEX=3 LEFT=515 TOP=125>"+str+"</layer>";
	} else {
		str	= "<div id=\"menu_up\" style=\"position: absolute; visibility:hidden; left: 515; top: 127; z-index:3;\">"+str+"</div>";
	}	
	document.write(str);
	writeSearchForm();
	window.onresize = showCenter;
}

function showLayer(layerName){
	eval (layerRef+'"'+layerName+'"'+layerVis+' = "visible"');
}

function hideLayer(layerName){
	eval (layerRef+'"'+layerName+'"'+layerVis+' = "hidden"');
}

function writeLayer(num,top,width) {
	var upText="",downText="",centerText="",i;
	var aMenu= eval("menu"+num);
	if (NS4){
		upText = "<layer id=\"la"+ num +"\" Z-INDEX=1 VISIBILITY=HIDE LEFT="+ aLeft[num] +" TOP="+ top +" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\"><p class=\"menu\">"+aMenu.img+"</p></layer>";
		centerText	= "<layer id=\"subla"+ num +"\" VISIBILITY=HIDE Z-INDEX=2 LEFT="+ aSubLeft[num] +" TOP="+ (top+16) +" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\">";
		downText= "</layer>";
	} else {
		upText		= "<div id=\"la"+ num +"\" style=\"position: absolute; visibility:hidden; left: " + aLeft[num] + "; top: " + top + "; height:20; z-index:1;\" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\">"+aMenu.img+"</div>";
		centerText	= "<div id=\"subla"+ num +"\" style=\"position: absolute; visibility:hidden; left: " + aSubLeft[num] + "; top: " + (top+19) + "; z-index:2;\" onMouseover=\"showLayer('subla"+ num +"')\" onMouseout=\"hideLayer('subla"+ num +"')\">";
		downText	+="</div>";	
	}
	
	centerText += centerUp;

	for (i=0;i<aMenu.length;i++){
		centerText += "<A HREF=\""+aMenu[i].url+"\">"+aMenu[i].name+"</A><br>";		
	}	

	centerText += centerDown;
	
	document.write(upText+centerText+downText);
}

function showMenu(){
	var i;
	showCenter();
	showLayer("menu_up");
	for (i=0;i<aSubLeft.length;i++) showLayer("la"+ i);
}

function showCenter(){
	var i,left,objLayer;
	var w  = getWidth();
	if (w > 752){
		left = parseInt((w-752)/2)+518;
		if (NS4 || NS6) left -= 10;
		eval (layerRef+'"menu_up"'+layerLeft+' = '+left);
		left = parseInt((w-752)/2)+225;
		if (NS4 || NS6) left -= 10;
		eval (layerRef+'"searchLayer"'+layerLeft+' = '+left);
		for (i=0;i<aSubLeft.length;i++){
			left = parseInt((w-752)/2)+aLeft[i];
			if (NS4 || NS6) left -= 10;
			eval (layerRef+'"la'+i+'"'+layerLeft+' = '+left);
			left = parseInt((w-752)/2)+aSubLeft[i];
			if (NS4 || NS6) left -= 10;
			eval (layerRef+'"subla'+i+'"'+layerLeft+' = '+left);
		}
	} else {
		eval (layerRef+'"menu_up"'+layerLeft+' = '+518);
		eval (layerRef+'"searchLayer"'+layerLeft+' = '+225);
		for (i=0;i<aSubLeft.length;i++){
			eval (layerRef+'"la'+i+'"'+layerLeft+' = '+aLeft[i]);
			eval (layerRef+'"subla'+i+'"'+layerLeft+' = '+aSubLeft[i]);
		}	
	}
}	

function getWidth()
{
	var st="",name;
	for (name in document.body) st += name+", ";
	if (document.all == null) return window.innerWidth;
	else return document.body.clientWidth;
}

function showImage(im,w,h,nm){
	if(newWin!=null) if (!newWin.closed)newWin.close();
	var top = (screen.height-h)/2;
	var left = (screen.width-w)/2;
	var windstatus;
	windstatus='width='+w+',height='+h+',top='+top+',left='+left+',status=no,resizable=no,scrollbars=no';
	newWin=window.open('','',windstatus);
	newWin.document.open();
	newWin.document.writeln('<html>');
	newWin.document.writeln('<head>');
	newWin.document.writeln('<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">');
	if (navigator.appName.indexOf("Netscape")!= -1) newWin.document.writeln('<title></title>');
	else newWin.document.writeln('<title>'+nm+'</title>');
	newWin.document.writeln('</head>');
	newWin.document.writeln('<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">');
	newWin.document.writeln('<A HREF=\"javascript:close()\"><img border=\"0\" src=\"'+im+'\" width=\"'+w+'\" height=\"'+h+'\"></A>');
	newWin.document.writeln('</body>');
	newWin.document.writeln('</html>');
	newWin.document.close();
}
