function monthRange() {
  now = new Date();
  thisMonth = now.getMonth() + 1; // Returned values are between 0 and 11
  year = now.getYear();
 
  // Check if it is Jan in which case the previous month is Dec and the
  // year is the previous one
  if (thisMonth == 1) {
        lastMonth = 12;
        year1 = year - 1;
  }
  else {
        lastMonth = thisMonth - 1;
        year1 = year;
  }

  // Need to differentiate between Netscape and IE because Netscape will return
  // the number of years elapsed from 1900 while IE does the current year.
  // in either case we need to construct the last two digits of the current year
  // Every browser but the IE is assumed to have Netscape/Unix behaviour
  if (navigator.appName != "Microsoft Internet Explorer") {
    year = year + 1900;
    year1 = year1 + 1900;
  }
  // Now that in either case we have the exact year, get the last two digits
  yearChar = year.toString(10); yearChar = yearChar.substring(2,4);
  year1Char = year1.toString(10); year1Char = year1Char.substring(2,4);
  
  // Both the month and the year need to be 2 digits, so, add a 0 in the
  // front if needed.
  if (thisMonth < 10) { thisMonth = "0"+thisMonth; }
  if (lastMonth < 10) { lastMonth = "0"+ lastMonth; }
 
  // the "" is necessary to have the year and month be treated as char's
 return ""+year1Char + lastMonth + "01-"+yearChar+thisMonth+"31";  //31 works for all of them

}

