RE: Option set with start date and end date field
There are many different ways to do this, but the following logic works pretty well. Of course you can make it better for your needs:
If you set the values of your option set to 1,2,3,4 corresponding to Q1, Q2, Q3, Q4, you can use the following:
var selectedQuarter = Xrm.Page.getAttribute("new_quartercode").getValue();
var startMonth = selectedQuarter * 3 - 2;
var endMonth = selectedQuarter * 3;
var lastDayOfMonth = 30;
if (selectedQuarter == 1 || selectedQuarter == 4)
lastDayOfMonth = 31;
var startDate = new Date(yearValue, startMonth -1, 1);
var endDate = new Date(yearValue, endMonth -1, lastDayOfMonth);
Xrm.Page.getAttribute("new_startdate").setValue(startDate);
Xrm.Page.getAttribute("new_enddate").setValue(endDate);
Hope this helps.