﻿// First display the Hebrew date
var now = new Date;
var tday = now.getDate();
var tmonth = now.getMonth() + 1;
var tyear = now.getYear();
if(tyear < 1900)
// if date from Netscape, then add 1900
  tyear += 1900;
var hebDate = civ2heb(tday, tmonth, tyear);
var hmS = hebDate.substring(hebDate.indexOf(' ')+1, hebDate.length);
var	hDay = eval(hebDate.substring(0, hebDate.indexOf(' ')));
var hMonth = eval(hmS.substring(0, hmS.indexOf(' ')));
var hYear = hmS.substring(hmS.indexOf(' ')+1, hmS.length);
if(hMonth != 12 & hMonth != 13)
  document.write('Сегодня ' + hDay + ' <a href="./?topic=calendar&id=' + (hMonth + 1) + '">' + hebMonth[hMonth+1] + '</a> ' + hYear + ' г.<br />');
else
  document.write('Сегодня ' + hDay + ' <a href="./?topic=calendar&id=' + hMonth + '">' + hebMonth[hMonth+1] + '</a> ' + hYear + ' г.<br />');

// Then display the corresponding civil dates
var day, month, year;
var today = new Date;
var yesterday = new Date(today.getTime() - 86400000);
day   = yesterday.getDate();
month = yesterday.getMonth() + 1;
year  = yesterday.getYear();
if(year < 1900)
  year += 1900; // if date from Netscape, then add 1900
document.write(day + ' ' + civMonth[month] + ' (вечер) - ');
day   = today.getDate();
month = today.getMonth() + 1;
year  = today.getYear();
if(year < 1900)
  year += 1900; // if date from Netscape, then add 1900
document.write(day + ' ' + civMonth[month] + ' ' + year + ' г.');
