Просмотр файла pages/other/calendar.html

Размер файла: 4.11Kb
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<META HTTP-EQUIV='Content-Type' Content='text/html; Charset=UTF-8'>
<title>PWB mini</title>
<script language="JavaScript" src="/templates/style.js"></script>
</head>
<body>

<!-- Автор: Zm@ster
Сайт: http://pwb.net.ru
 e-mail: [email protected] //-->
<div class='up'>
<left><img src='/images/logo.png' alt='logo'></left>
</div>

<div class='razdel'>Календарь</div>
<div class='text'>
<Script Language="JavaScript">
  setCal()
  function getTime() {
    var now = new Date()
    var hour = now.getHours()
    var minute = now.getMinutes()
    now = null
    var ampm = "" 
      if (hour >= 12) {
	hour -= 12
	ampm = "PM"}
      else
        ampm = "AM"
      hour = (hour == 0) ? 12 : hour
      if (minute < 10)
    minute = "0" + minute
    return hour + ":" + minute + " " + ampm}

function leapYear(year) {
	if (year % 4 == 0)
	  return true
	return false}

function getDays(month, year) {
	var ar = new Array(12)
	ar[0] = 31
	ar[1] = (leapYear(year)) ? 29 : 28
	ar[2] = 31
	ar[3] = 30
	ar[4] = 31
	ar[5] = 30
	ar[6] = 31
	ar[7] = 31
	ar[8] = 30
	ar[9] = 31
	ar[10] = 30
	ar[11] = 31
	return ar[month]}

function getMonthName(month) {
	var ar = new Array(12)
	ar[0] = "Январь"
	ar[1] = "Февраль"
	ar[2] = "Март"
	ar[3] = "Апрель"
	ar[4] = "Май"
	ar[5] = "Июнь"
	ar[6] = "Июль"
	ar[7] = "Август"
	ar[8] = "Сентябрь"
	ar[9] = "Октябрь"
	ar[10] = "Ноябрь"
	ar[11] = "Декабрь"
	return ar[month]}

function setCal() {
	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth()
	var monthName = getMonthName(month)
	var date = now.getDate()
	now = null
	var firstDayInstance = new Date(year, month, 1)
	var firstDay = firstDayInstance.getDay()
	firstDayInstance = null
	var days = getDays(month, year)
	drawCal(firstDay + 1, days, date, monthName, year)}

function drawCal(firstDay, lastDate, date, monthName, year) {
	var headerHeight = 25
	var border = 2
	var cellspacing = 1
	var headerColor = "#005555"
	var headerSize = "3"
	var colWidth = 35
	var dayCellHeight = 25
	var dayColor = "#550055"
	var cellHeight = 20
	var todayColor = "#0000aa"
	var timeColor = "#aa0000"

	var text = ""
	text += '<TABLE BORDER=' + border + ' CELLSPACING=' + cellspacing + '>'
	text +=         '<TH COLSPAN=7 HEIGHT=' + headerHeight + '>'
	text +=                 '<FONT COLOR="' + headerColor + '" SIZE=' + headerSize + ' Face="Courier New">'
	text +=                         monthName + ' ' + year 
	text +=                 '</FONT>'
	text +=         '</TH>'

	var openCol = '<TD WIDTH=' + colWidth + ' HEIGHT=' + dayCellHeight + '>'
	  openCol += '<FONT COLOR="' + dayColor + '" Face="Courier New"><B>'
	var closeCol = '</FONT></TD>'

	var weekDay = new Array(7)
	weekDay[0] = "Вс"
	weekDay[1] = "Пн"
	weekDay[2] = "Вт"
	weekDay[3] = "Ср"
	weekDay[4] = "Чт"
	weekDay[5] = "Пт"
	weekDay[6] = "Сб"

	text += '<TR ALIGN="center" VALIGN="center">'
        for (var dayNum = 0; dayNum < 7; ++dayNum) {
	  text += openCol + weekDay[dayNum] + closeCol}
	text += '</TR>'
	var digit = 1
	var curCell = 1
	for (var row = 1; row <= Math.ceil((lastDate + firstDay - 1) / 7); ++row) {
	  text += '<TR ALIGN="right" VALIGN="top">'
	    for (var col = 1; col <= 7; ++col) {
		if (digit > lastDate)
		  break
		if (curCell < firstDay) {
		  text += '<TD></TD>'
		  curCell++}
		else{
		if (digit == date){
		  text += '<TD HEIGHT=' + cellHeight + '>'
		  text += '<FONT COLOR="' + todayColor + '" SIZE="2" Face="Courier New"><B>-'
		  text += digit
		  text += '</B>-</FONT>'
		  text += '</TD>'}
                else
		  text += '<TD HEIGHT=' + cellHeight + '><font size="2" Face="Courier New" color="#444444">-' + digit + '-</font></TD>'
		digit++}}
		text += '</TR>'}
	text += '</TABLE>'
	document.write(text)}
</Script>
-------------------------------
<br>

« <a href="/">Главная</a><br>
</div>
<script language="JavaScript" src="/templates/foot_copy.js"></script><br>
</body></html>