I have this code on our high school website that displays the day of the cycle, for example "Today is day 3". On the weekends it will say "Monday is day 4". We are changing from an 8 day cycle to a 4 day cycle. What do I need to edit on the code below to switch it from an 8 day to a 4 day cycle? Thanks!

function cycleday(last, day){

day = day-1;

//Set the two dates

var lday = last;

today=new Date();

//Get 1 day in milliseconds

var one_day=1000*60*60*24;

//how far from the end of the week that day was

offset = lday.getDay();

//get how many weekends since then

ends = Math.ceil((today.getTime()-lday.getTime())/(one_day));

ends += offset;

ends = Math.floor(ends/7);

//Calculate difference btw the two dates, and convert to days

d = Math.ceil((today.getTime()-lday.getTime())/(one_day));

//subtract the weekends

d = d + day - 1 - ends*2;

//how many days of the cycle

d = d%4;

if (today.getDay() == 0 || today.getDay() == 6){

d += 2;

return "Monday is Day " + d;}

else{

d += 1;

return "Today is Day " + d;}

}

function cycle(){

//update if the counter is off

var lastday = new Date(2010, 4-1, 16); //yyyy, mm-1, dd

var thatday = 2; //the day of the cycle it was

document.write("<span class='cycle'>");

document.write(cycleday(lastday, thatday));

document.write("</div><br><br>");

}

function cycleday(last, day){

day = day-1;

//Set the two dates

var lday = last;

today=new Date();

//Get 1 day in milliseconds

var one_day=1000*60*60*24;

//how far from the end of the week that day was

offset = lday.getDay();

//get how many weekends since then

ends = Math.ceil((today.getTime()-lday.getTime())/(one_day));

ends += offset;

ends = Math.floor(ends/7);

//Calculate difference btw the two dates, and convert to days

d = Math.ceil((today.getTime()-lday.getTime())/(one_day));

//subtract the weekends

d = d + day - 1 - ends*2;

//how many days of the cycle

d = d%4;

if (today.getDay() == 0 || today.getDay() == 6){

d += 2;

return "Monday is Day " + d;}

else{

d += 1;

return "Today is Day " + d;}

}

function cycle(){

//update if the counter is off

var lastday = new Date(2010, 4-1, 16); //yyyy, mm-1, dd

var thatday = 2; //the day of the cycle it was

document.write("<span class='cycle'>");

document.write(cycleday(lastday, thatday));

document.write("</div><br><br>");

}

## Comment