w = self;
function makeArray() {
this[0] = makeArray.arguments.length;
for (i = 0; i<makeArray.arguments.length; i++)
this[i+1] = makeArray.arguments[i];
}

var accumulate = new makeArray( 0, 31, 59, 90,120,151,181,212,243,273,304,334);
var accumulateLY = new makeArray( 0, 31, 60, 91,121,152,182,213,244,274,305,335);

function LeapYear(year) {

quatre = false;
cent = false;
quatre_cent = false;

if ((year/4) == Math.floor(year/4)) quatre = true;

if ((year/100) == Math.floor(year/100)) cent = true;

if ((year/400) == Math.floor(year/400)) quatre_cent = true;

if((quatre)&&(cent)&&(!quatre_cent)) return true;
if((quatre)&&(!cent)) return true;

return false;

}

function getGregorian(day,month,year) {
if (LeapYear(year)) {
return (day + accumulateLY[month]);

}
else {
return (day + accumulate[month]);
}
}

var today = new Date();

document.write(+ getGregorian(today.getDate(),today.getMonth()+1,today.getYear()));
