function over(x){
	document.images[x.name].src=img_path+x.name+"_.gif";
}
function out(x){
	document.images[x.name].src=img_path+x.name+".gif";
}
function menu_over(x){
	document.images[x].src=img_path+x+"_.jpg";
}
function menu_out(x){
	document.images[x].src=img_path+x+".jpg";
}

function over_app(x){
	document.images[x.name].src=img_path+x.name+"_.gif";
}
function out_app(x){
	document.images[x.name].src="i/p.gif";
}
// Выводит на экран меню выбора месяца римскими цифрами
function select_month(){
	name_of_month=new Array;
	name_of_month=["","january","february","march","april","may","june","july","august","september","october","november","december"];
	name_on_rus=["","январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"];

	set_event=" onMouseOver=\"over_app(this)\" onMouseOut=\"out_app(this)\"";
	space="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=1><br>";
	
	document.write("<table border=0 cellPadding=0 cellSpacing=0 height=516 width=26 background=\""+img_path+"pic1_2.gif\"><tr height=516 valign=top><td width=26>");
	for(i=1;i<13;i++)
		if(name_of_month[i]==key_month)
			document.write(space+"<img border=0 alt=\"\" src=\""+img_path+i+"r_.gif\" width=26 height=42>");
		else
			document.write(space+"<a alt=\"\" href=\""+name_of_month[i]+".html\"><img border=0 alt=\""+name_on_rus[i]+"\" src=\"i/p.gif\" width=26 height=42 "+set_event+" name="+i+"r></a>");

	document.write("</td></tr></table>");
}


//Последовательная смена месяцев
function change_month(){
	document.write("<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=11><br>");
	set_event=" onMouseOver=\"over(this)\" onMouseOut=\"out(this)\"";
	document.write("<a href=\""+months[key_month][2]+".html\"><img border=0 alt=\"\" src=\""+img_path+"m_left.gif\" name=\"m_left\" width=15 height=15"+set_event+"></a>");
	document.write("<img border=0 alt=\"\" src=\"i/"+months[key_month][1]+".gif\" width=134 height=15>");
	document.write("<a href=\""+months[key_month][3]+".html\"><img border=0 alt=\"\" src=\""+img_path+"m_right.gif\" name=\"m_right\" width=15 height=15"+set_event+"></a>");
}

//Выводит на экран событие месяца
function event_of_month(){
	if(key_month=='january')event_month=event_month_jan;
	if(key_month=='february')event_month=event_month_feb;
	if(key_month=='march')event_month=event_month_mar;
	if(key_month=='april')event_month=event_month_apr;
	if(key_month=='may')event_month=event_month_may;
	if(key_month=='june')event_month=event_month_jun;
	if(key_month=='july')event_month=event_month_jul;
	if(key_month=='august')event_month=event_month_aug;
	if(key_month=='september')event_month=event_month_sep;
	if(key_month=='october')event_month=event_month_oct;
	if(key_month=='november')event_month=event_month_nov;
	if(key_month=='december')event_month=event_month_dec;
	
	document.write("<table border=0 align=center cellPadding=0 cellSpacing=0 height=100% width=156><tr height=100% valign=top><td width=156>");
	for(i=0;i<event_month.length;i++)
		document.write("<p class=ev_m>"+event_month[i]+"</p>");
	document.write("</td></tr></table>");
}

//Меню "домой" "печать" "закрыть"
function sys_menu(){
	set_event="onMouseOver=\"over(this)\" onMouseOut=\"out(this)\"";
	img_home="<a href=\"calendar.html\" alt=\"\"><img border=0 alt=\"в начало\" src=\""+img_path+"home.gif\" width=31 height=31 hspace=5 vspace=10 "+set_event+" name=home></a>";
	img_print="<a href=\"\" alt=\"\"><img border=0 alt=\"печатать\" src=\""+img_path+"print.gif\" width=31 height=31 hspace=5 vspace=10 "+set_event+" name=print></a>";
	img_close="<a href=\"javascript:window.close()\" alt=\"\"><img border=0 alt=\"закрыть\" src=\""+img_path+"close.gif\" width=31 height=31 hspace=5 vspace=10 "+set_event+" name=close></a>";
	document.write(img_home+img_print+img_close+"<img border=0 alt=\"\" src=\"i/p.gif\" width=2 height=1>");
}
//Главное меню для перехода в основные приложения

function main_menu(){
	quad1="<td width=26><img border=0 alt=\"\" src=\""+img_path+"li1_.jpg\" width=14 height=13 hspace=6 vspace=8 name=li1></td>";
	quad2="<td width=26><img border=0 alt=\"\" src=\""+img_path+"li2.jpg\" width=14 height=13 hspace=6 vspace=8 name=li2></td>";
	quad4="<td width=26><img border=0 alt=\"\" src=\""+img_path+"li3.jpg\" width=14 height=13 hspace=6 vspace=8 name=li3></td>";

	head_menu="<table border=0 align=center cellPadding=0 cellSpacing=0 height=29 width=578><tr height=29 valign=middle>";

	punkt1="<td width=95><span class=menu_"+months[key_month][0]+">КАЛЕНДАРЬ</span></td>";
	punkt2="<td width=316><a class=menu_"+months[key_month][0]+" href=\""+key_month+"_I.html\" alt=\"\" onMouseOver=\"menu_over('li2')\" onMouseOut=\"menu_out('li2')\">ПАМЯТНЫЕ ДАТЫ И ЮБИЛЯРЫ МОСКВЫ</a></td>";
	punkt4="<td width=89><a class=menu_"+months[key_month][0]+" href=\"ukaz.html\" alt=\"\" onMouseOver=\"menu_over('li3')\" onMouseOut=\"menu_out('li3')\">УКАЗАТЕЛИ</a></td>";

	foot_menu="</tr></table>";

	document.write(head_menu+quad1+punkt1+quad2+punkt2+quad4+punkt4+foot_menu);

}




//Формирует и выводит на экран календарь на заданный месяц
function show_calendar(x){
	td="";
	for(i=0;i<7;i++)
		td=td+"<td width=22><img border=0 src=\""+img_path+days[i]+".gif\" width=22 height=27></td>"
	tr="<tr height=27>"+td+"</tr>";

	set_event="onMouseOver=\"over(this)\" onMouseOut=\"out(this)\"";
	for(i=0;i<42;i=i+7){
		td="";
		for(j=0;j<7;j++){
			if(full_months[i+j]=="")
				td=td+"<td width=22><img border=0 src=\"i/p.gif\" width=1 height=1></td>"
			else
				if(full_months[i+j]==x)
					td=td+"<td width=22><img border=0 src=\""+img_path+"day"+full_months[i+j]+"_.gif\" width=22 height=21></td>";
				else
					td=td+"<td width=22><a href=\"javascript:goto_day("+full_months[i+j]+")\"><img border=0 src=\""+img_path+"day"+full_months[i+j]+".gif\" "+set_event+" name=\"day"+full_months[i+j]+"\" width=22 height=21></a></td>";
		}
		tr=tr+"<tr height=21>"+td+"</tr>";
	}
	ins_txt="<table border=0 align=center cellPadding=0 cellSpacing=0 height=153 width=154>"+tr+"</table>";

	document.all['calend'].innerHTML=ins_txt;
}

//Меню для последовательного переключения дней месяца
function insert_day(x,y){
	x1=Math.floor(x/10);	x2=x-x1*10;
	if(y=='b'){
		x_height=b_height;	x1_width=b_0_9[x1];	x2_width=b_0_9[x2];	v_space=0;
	}else{
		x_height=m_height;	x1_width=m_0_9[x1];	x2_width=m_0_9[x2];	v_space=12;
	}
	x_out="";
	if(x1!=0)
		x_out+="<img border=0 alt=\"\" src=\""+img_path+x1+y+".gif\" width="+x1_width+" height="+x_height+" vspace="+v_space+"><img border=0 alt=\"\" src=\"i/pw.gif\" width=4 height=10 vspace="+v_space+">";
	x_out+="<img border=0 alt=\"\" src=\""+img_path+x2+y+".gif\" width="+x2_width+" height="+x_height+" vspace="+v_space+">";
	return x_out;	
}
function change_day(x){
	set_event="onMouseOver=\"over(this)\" onMouseOut=\"out(this)\"";
	big_white="<img border=0 alt=\"\" src=\"i/pw.gif\" width=14 height=10>";
	
	if(x==1){
		day_left="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=1>";
		goto_left="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=1>";
	}
	else {
		goto_left="<a href=\"javascript:goto_day("+(x-1)+")\" alt=\"\"><img border=0 alt=\"\" src=\""+img_path+"d_left.gif\" width=19 height=14 "+set_event+" vspace=12 hspace=15 name=d_left></a>";
		day_left=insert_day(x-1,'m');
	}
	if(x==months[key_month][5]){
		day_right="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=1>";
		goto_right="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=1>";
	}
	else{
		goto_right="<a href=\"javascript:goto_day("+(x+1)+")\" alt=\"\"><img border=0 alt=\"\" src=\""+img_path+"d_right.gif\" width=19 height=14 "+set_event+" vspace=12 hspace=15 name=d_right></a>";
		day_right=insert_day(x+1,'m');
	}

	ins_txt="<table border=0 align=center cellPadding=0 cellSpacing=0 height=41 width=564><tr height=41 valign=bottom>";
	ins_txt+="<td width=39 align=left>"+day_left+"</td>";
	ins_txt+="<td width=49 align=left>"+goto_left+"</td>";
	ins_txt+="<td width=388 align=center>"+big_white+insert_day(x,'b')+big_white+"</td>";
	ins_txt+="<td width=49 align=right>"+goto_right+"</td>";
	ins_txt+="<td width=39 align=right>"+day_right+"</td>";
	ins_txt+="</tr></table>";
	document.all['days'].innerHTML=ins_txt;
}
//Выводит содержимое выбранного дня
function goto_day(x){
	show_calendar(x);
	change_day(x);
	content(x);
}
//Выводит содержимое календаря выбранного дня
function content(x){
	if(key_month=='january'){
		event_day=event_day_jan; event_rus=event_rus_jan; event_mos=event_mos_jan; event_born=event_born_jan;}
	if(key_month=='february'){
		event_day=event_day_feb; event_rus=event_rus_feb; event_mos=event_mos_feb; event_born=event_born_feb;}
	if(key_month=='march'){
		event_day=event_day_mar; event_rus=event_rus_mar; event_mos=event_mos_mar; event_born=event_born_mar;}
	if(key_month=='april'){
		event_day=event_day_apr; event_rus=event_rus_apr; event_mos=event_mos_apr; event_born=event_born_apr;}
	if(key_month=='may'){
		event_day=event_day_may; event_rus=event_rus_may; event_mos=event_mos_may; event_born=event_born_may;}
	if(key_month=='june'){
		event_day=event_day_jun; event_rus=event_rus_jun; event_mos=event_mos_jun; event_born=event_born_jun;}
	if(key_month=='july'){
		event_day=event_day_jul; event_rus=event_rus_jul; event_mos=event_mos_jul; event_born=event_born_jul;}
	if(key_month=='august'){
		event_day=event_day_aug; event_rus=event_rus_aug; event_mos=event_mos_aug; event_born=event_born_aug;}
	if(key_month=='september'){
		event_day=event_day_sep; event_rus=event_rus_sep; event_mos=event_mos_sep; event_born=event_born_sep;}
	if(key_month=='october'){
		event_day=event_day_oct; event_rus=event_rus_oct; event_mos=event_mos_oct; event_born=event_born_oct;}
	if(key_month=='november'){
		event_day=event_day_nov; event_rus=event_rus_nov; event_mos=event_mos_nov; event_born=event_born_nov;}
	if(key_month=='december'){
		event_day=event_day_dec; event_rus=event_rus_dec; event_mos=event_mos_dec; event_born=event_born_dec;}

	ins_txt="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=10><br>";
	ins_txt+="<table border=0 align=center cellPadding=0 cellSpacing=0 height=100% width=564><tr height=100% valign=top><td width=564>";
	if(event_day[x][0]!=="")
		for(i=0;i<event_day[x].length;i++)
			ins_txt+="<p class="+months[key_month][0]+">"+event_day[x][i]+"</p>";
	else ins_txt+="<img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=26>";

	if(event_rus[x][0]!==""){
		ins_txt+="<img border=0 alt=\"\" src=\""+img_path+"ev_rus.gif\" width=516 height=16 hspace=10><br>";
		for(i=0;i<event_rus[x].length;i++)
			ins_txt+="<p>"+event_rus[x][i]+"</p>";
	}
	if(event_mos[x][0]!==""){
		ins_txt+="<img border=0 alt=\"\" src=\""+img_path+"ev_mos.gif\" width=516 height=16 hspace=10><br>";
		for(i=0;i<event_mos[x].length;i++)
			ins_txt+="<p>"+event_mos[x][i]+"</p>";
	}
	if(event_born[x][0]!==""){
		ins_txt+="<img border=0 alt=\"\" src=\""+img_path+"ev_born.gif\" width=516 height=16 hspace=10><br>";
		for(i=0;i<event_born[x].length;i++)
			ins_txt+="<p>"+event_born[x][i]+"</p>";
	}
	ins_txt+="</td></tr><tr height=100%><td><img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=10></td></tr></table><br>";
	document.all['text'].innerHTML=ins_txt;
}

function show_more(app,x1,x2){

	parameters="?app="+app+"&select_date="+x1+"&key_month="+key_month+"&n_event="+x2+"&";
	new_index=window.open("show_more.html"+parameters, "more", "top=0; titlebar=0, scrollbars=1, width=594, height="+user_screen);
	new_index.focus();
}
/*
function content_app(app,x1,x2){
	if(app==1){
		if(key_month=='january') event_day_I=jan_I;
		if(key_month=='february') event_day_I=feb_I;
		if(key_month=='march') event_day_I=mar_I;
		if(key_month=='april') event_day_I=apr_I;
		if(key_month=='may') event_day_I=may_I;
		if(key_month=='june') event_day_I=jun_I;
		if(key_month=='july') event_day_I=jul_I;
		if(key_month=='august') event_day_I=aug_I;
		if(key_month=='september') event_day_I=sep_I;
		if(key_month=='october') event_day_I=oct_I;
		if(key_month=='november') event_day_I=nov_I;
		if(key_month=='december') event_day_I=dec_I;

		ins_txt="<table border=0 class=moscow align=center cellPadding=0 cellSpacing=0 height=100% width=564>";
	}
	if(app==2){
		if(key_month=='january') event_day_II=jan_II;
		if(key_month=='february') event_day_II=feb_II;
		if(key_month=='march') event_day_II=mar_II;
		if(key_month=='april') event_day_II=apr_II;
		if(key_month=='may') event_day_II=may_II;
		if(key_month=='june') event_day_II=jun_II;
		if(key_month=='july') event_day_II=jul_II;
		if(key_month=='august') event_day_II=aug_II;
		if(key_month=='september') event_day_II=sep_II;
		if(key_month=='october') event_day_II=oct_II;
		if(key_month=='november') event_day_II=nov_II;
		if(key_month=='december') event_day_II=dec_II;

		ins_txt="<table border=0 class=jubilee align=center cellPadding=0 cellSpacing=0 height=100% width=564>";
	}
	ins_txt+="<tr height=10 valign=top><td width=564><img border=0 alt=\"\" src=\"i/p.gif\" width=1 height=10></td></tr>";
	ins_txt+="<tr height=100% valign=top><td width=564>";
	if(app==1)
		ins_txt+=event_day_I[x1][x2][0]+event_day_I[x1][x2][1]+event_day_I[x1][x2][2];
	if(app==2)
		ins_txt+=event_day_II[x1][x2][0]+event_day_II[x1][x2][1]+event_day_II[x1][x2][2];
	ins_txt+="</td></tr></table><br>";
	return ins_txt;
}*/