var month_names = new Array(12);			// месяцы на русском
month_names[0] = new Months("Январь","января",31);
month_names[1] = new Months("Февраль","февраля",28);
month_names[2] = new Months("Март","марта",31);
month_names[3] = new Months("Апрель","апреля",30);
month_names[4] = new Months("Май","мая",31);
month_names[5] = new Months("Июнь","июня",30);
month_names[6] = new Months("Июль","июля",31);
month_names[7] = new Months("Август","августа",31);
month_names[8] = new Months("Сентябрь","сентября",30);
month_names[9] = new Months("Октябрь","октября",31);
month_names[10] = new Months("Ноябрь","ноября",30);
month_names[11] = new Months("Декабрь","декабря",31);

var day_names = new Array(7);				// дни недели на русском
day_names[1] = "Понедельник";
day_names[2] = "Вторник";
day_names[3] = "Среда";
day_names[4] = "Четверг";
day_names[5] = "Пятница";
day_names[6] = "Суббота";
day_names[7] = "Воскресение";

var Today = new Date();					// сегодняшняя дата:
var Tyear = Today.getFullYear();			// четырехзначный год
var T2year= Tyear-2000					// двузначный год
var Tmonth = Today.getMonth();				// месяц - от 0 до 11
var Tdate = Today.getDate();				// число - от 1 до 31
var Tday = Today.getDay();				// день недели - от 0 (вс) до 6 (сб)
if(Tday==0) Tday=7;					// корректировка воскресения с 0 на 7
if(!(Tyear%4)) month_names[1].Days++;			// корректировка дней в феврале в случае високосного года

// текущая дата в формате ДД.ММ.ГГ
var smDate = (Tdate<10?"0"+Tdate:Tdate)+'.'+(++Tmonth<9?"0"+Tmonth:Tmonth)+'.'+(T2year<10?"0"+T2year:T2year);	

// текущая дата в формате Д месяц ГГГГ
var lgDate = Tdate+'&nbsp;'+month_names[--Tmonth].Name2+'&nbsp;'+Tyear+' года';





function Months(Name, Name2, Days) {
/*****************************************************************
Заполнение массива месяцев
*****************************************************************/
	this.Name = Name;
	this.Name2 = Name2;
	this.Days = Days;
}





/////////////// работа с элементами меню  ////////////////////////
function change_style(elemId){
	if (document.getElementById(elemId).style.display == "none") document.getElementById(elemId).style.display = "block";
	else document.getElementById(elemId).style.display = "none";	
}

function show_details(elemId) { document.getElementById(elemId).style.visibility = "visible";}

function hide_details(elemId) { document.getElementById(elemId).style.visibility = "hidden"; }

function change_color(elemId) { document.getElementById(elemId).style.color = "#0D4A83"; }

function return_color(elemId) { document.getElementById(elemId).style.color = "#333333"; }
 
//////////////////////////////////////////////////////////////////





function tablo_open(fName){ 
/*****************************************************************
Открытие окна с авиарасписанием
 fName - имя ini-файла с данными по аэропорту
*****************************************************************/
	window.open('/schedule/index.aspx?fname='+fName,fName,"menubar,height=400,width=720,scrollbars,resizable=1") 
}



function photo_win(img_path,img_alt){
/*****************************************************************
Динамическое создание окна для отображения картинки
 img_path - имя картинки, img_alt - всплывающая подсказка
*****************************************************************/

var str, StrBody;

	str = 'resizable=yes,width=100,height=100,screenX=100,screenY=100,left=10,top=10';
	
	if (document.all){ 
		StrBody = '<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();" onresize="self.window.location.reload();">';
	} else {
		StrBody = '<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
	}
		
	var win_op = window.open('','show', str);
	win_op.document.open();
	win_op.document.writeln('<html>');
	win_op.document.writeln('<head> <link rel="shortcut icon" href="/img/favicon.ico">');
	win_op.document.writeln('<title>' + img_alt + '</title>');
	win_op.document.writeln('<script>');
	win_op.document.writeln('function resize_img() {');
	win_op.document.writeln('var width = document.image.width;');
	win_op.document.writeln('var height = document.image.height + 20;');
	win_op.document.writeln('if (!(document.all)){ self.resizeTo(width,height); } else { self.resizeTo((width+12),(height + 31));');
	win_op.document.writeln(' }');
	win_op.document.writeln('}');
	win_op.document.writeln('</script>');	
	win_op.document.writeln('</head>');
	win_op.document.writeln(StrBody);
	win_op.document.writeln('<img name="image" src='+ img_path + ' border=0 alt="'+img_alt+'" onload="resize_img();">');
	win_op.document.writeln('</body>');
	win_op.document.writeln('</html>');		
	win_op.document.close();
}
