<?php

if (! defined ( 'BLOCK_FILE' )) {
	if (function_exists ( "location" ))
		location ( "../index.php" );
	else
		die ();
	exit ();
}
global $tracker_lang;
$blocktitle = $tracker_lang ["calendar"];
$content = ReadCache ( 'calendar', true );
if (! $content) {
	$res = sql_query ( "SELECT UNIX_TIMESTAMP(added) FROM users WHERE id='1' LIMIT 1" ) or sqlerr ( __LINE__, __FILE__ );
	$row = mysql_fetch_array ( $res );
	$sitedate = get_elapsed_time ( $row ["UNIX_TIMESTAMP(added)"] );
	$content = "<center>Нашему сайту $sitedate</center>";
	$content .= <<<BLOCKHTML
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var Today=new Date();
var ThisDay=Today.getDay();
var ThisDate=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();  
function DayTxt (DayNumber) {
var Day=new Array();
Day[0]="Воскресенье";
Day[1]="Понедельник";
Day[2]="Вторник";
Day[3]="Среда";
Day[4]="Четверг";
Day[5]="Пятница";
Day[6]="Суббота";
return Day[DayNumber];
}
var DayName=DayTxt(ThisDay);
function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="Январь";
Month[2]="Февраль";
Month[3]="Март";
Month[4]="Апрель";
Month[5]="Май";
Month[6]="Июнь";
Month[7]="Июль";
Month[8]="Август";
Month[9]="Сентябрь";
Month[10]="Октябрь";
Month[11]="Ноябрь";
Month[12]="Декабрь";
return Month[MonthNumber];
}
var MonthName=MonthTxt(ThisMonth);
var d = new Date();
var h = d.getHours();
document.write("<TABLE BORDER=3 BGCOLOR=WHITE  WIDTH=75 HEIGHT=85 align=left>"+"<TD>"+"<p align=center>"+"<font size=-2 >"+DayName+"<br>"+"<font color=orangered size=+3 >"+ThisDate+"</font>"+"<br>"+MonthName+"<br>"+"</b>"+"</font>"+"</p>"+"</TD>"+"</TR>"+"</TABLE>");
if (h < 2) document.write("<P ALIGN=center>"+"<b>"+"Доброе утро!"+"</b>"+"</P>");
else if (h < 3) document.write("<P ALIGN=center>"+"<b>"+""+"</b>"+"</P>");
else if (h < 7) document.write("<P ALIGN=center>"+"<b>"+""+"</b>"+"</P>");
else if (h < 12) document.write("<P ALIGN=center>"+"<b>"+"Всем сетянам Доброе утро!"+"</b>"+"</P>");
else if (h < 17) document.write("<P ALIGN=center>"+"<b>"+"Добрый день и хорошего настроения!"+"</b>"+"</P>");
else if (h < 23) document.write("<P ALIGN=center>"+"<b>"+"Добрый вечер!"+"</b>"+"</P>");
else document.write("<P ALIGN=center>"+"<b>"+""+"</b>"+"</P>");
//  End -->
</script>
BLOCKHTML;
	$content = WriteCache ( $content );
}
?>