function dispDate(dateVal) 
{
DaystoAdd=dateVal
TodaysDate = new Date();
TodaysDay = new Array('יום ראשון', 'יום שני', 'יום שלישי','יום רביעי', 'יום חמישי', 'יום שישי', 'יום שבת');
TodaysMonth = new Array('ינואר', 'פברואר', 'מרץ','אפריל', 'מאי','יוני', 'יולי', 'אוגוסט', 'ספטמבר','אוקטובר', 'נובמבר', 'דצמבר');
DaysinMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
function LeapYearTest (Year) 
{
return (((Year % 400)==0) || (((Year % 100)!=0) && (Year % 4)==0));
}
CurrentYear = TodaysDate.getYear();
if (CurrentYear < 2000) 
CurrentYear = CurrentYear + 1900;

currentMonth = TodaysDate.getMonth();
DayOffset = TodaysDate.getDay();
currentDay = TodaysDate.getDate();
month = TodaysMonth[currentMonth];
if (month == 'פברואר') 
{
if (((CurrentYear % 4)==0) && ((CurrentYear % 100)!=0) || ((CurrentYear % 400)==0)) 
{DaysinMonth[1] = 29;}
else 
{DaysinMonth[1] = 28;}
}
days = DaysinMonth[currentMonth];
currentDay += DaystoAdd;
if (currentDay > days) 
{
if (currentMonth == 11) 
{
currentMonth = 0;
month = TodaysMonth[currentMonth];
CurrentYear = CurrentYear + 1
}
else 
{
month = TodaysMonth[currentMonth+1];
}
currentDay = currentDay - days;
}
DayOffset += DaystoAdd;

function offsettheDate (offsetCurrentDay) 
{
if (offsetCurrentDay > 6) 
{
offsetCurrentDay -= 6;
DayOffset = TodaysDay[offsetCurrentDay-1];
offsettheDate(offsetCurrentDay-1);
}
else 
{
DayOffset = TodaysDay[offsetCurrentDay];
return true;
}
}
offsettheDate(DayOffset);TheDate  = DayOffset + ' | ';
TheDate += currentDay + ' '; 
TheDate += month +  ' ';
if (CurrentYear<100) CurrentYear="19" + CurrentYear;
TheDate += CurrentYear + ' | ';
TheDate += TodaysDate.getHours() + ':' + TodaysDate.getMinutes()
document.write(' '+TheDate);
}
function DispDate() 
{
var myDays = new Array("ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת","ראשון");
var myMonths = new Array("ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");

var date = new Date;
var dHoure = date.getHours();
if (dHoure.toString().length == 1) 
{
dHoure = "0" + date.getHours();
}
var dMinutes = date.getMinutes();
if (dMinutes.toString().length == 1) 
{
dMinutes = "0" + date.getMinutes();
}
var day = date.getDay();
var dDate = date.toLocaleDateString();
document.getElementById("DateR").innerHTML = myDays[date.getDay()] + " | " +  date.getDate() + " ב" + myMonths[date.getMonth()];
document.getElementById("TimeR").innerHTML = " | " + dHoure + ":" + dMinutes
setTimeout('DispDate("TimeSpan")', 5000);
}
