function GetBusinessDays(startDate, endDate)
{
if (startDate != null && endDate != null)
{
var cycletime = (Math.abs(endDate - startDate) / 86400000) + 1;
var startday = startDate.getDay();
var x = startday; // day of the week
var y = 0; // number of business days for output
var z = 0; // augment up to the total number of days
while (z < cycletime) {
if (x > 0 && x < 6)
{
y++;
}
x++;
z++;
if (x > 6)
{
x = 0;
}
}
return y;
}
return null;
}