function formbuttonClassNew(obj, new_style) {
    obj.className = new_style;
}

function getValueIndex(formObj, objVal) {
  for (lcv=0;lcv < formObj.length;lcv++) {
    if (formObj.options[lcv].value == objVal) return lcv;
  }
  return 0;
}

function update_date (formObj) {
	timestamp1 = Date.UTC (formObj.cruise_year.value, formObj.cruise_month.value-1, formObj.cruise_day.value);
	timestamp2 = Date.UTC (formObj.cruise_year2.value, formObj.cruise_month2.value-1, formObj.cruise_day2.value);

	if (timestamp1 > timestamp2) {
    	newdate = new Date(formObj.cruise_year.value, formObj.cruise_month.value, formObj.cruise_day.value-1);
    	newYear = newdate.getYear()
    	if (newYear < 1900) {
      		newYear = newYear + 1900;
    	}
    	formObj.cruise_year2.selectedIndex  = getValueIndex(formObj.cruise_year2, newYear);
    	formObj.cruise_month2.selectedIndex = getValueIndex(formObj.cruise_month2, newdate.getMonth()+2);
    	formObj.cruise_day2.selectedIndex   = getValueIndex(formObj.cruise_day2, newdate.getDate());
  	}
}

function initial_date (formObj) {
	newdate = new Date();
	startyear = newdate.getYear();
	startmonth = newdate.getMonth()+3;
	if (startyear < 1900) {
		startyear = startyear + 1900;
	}
	if (startmonth > 12) { 
		startmonth = startmonth - 12;
		startyear = startyear + 1;
	}
	endyear = startyear;
	endmonth = startmonth + 1;
	if (endmonth > 12) {
		endmonth = endmonth - 12;
		endyear = endyear + 1;
	}
	formObj.cruise_year.selectedIndex = getValueIndex(formObj.cruise_year, startyear);
	formObj.cruise_month.selectedIndex = getValueIndex(formObj.cruise_month, startmonth);
	formObj.cruise_year2.selectedIndex = getValueIndex(formObj.cruise_year2, endyear);
	formObj.cruise_month2.selectedIndex = getValueIndex(formObj.cruise_month2, endmonth);
}