function checkDates(form) {
	var now = new Date();
	var today_day = now.getDate();
	var today_month = now.getMonth();
	var today_year = now.getFullYear();
	var start_full = form.policyStartDate.value; 
	var start_day = start_full.substring(0,2);
	var start_month = start_full.substring(3,5);
	var start_year = start_full.substring(6,10);
	var end_full = form.policyEndDate.value; 
	var end_day = end_full.substring(0,2);
	var end_month = end_full.substring(3,5);
	var end_year = end_full.substring(6,10);
	var annual_end = "";
	
	//Annual Policies - Adds a year to give a full years cover
	if(start_year == '2009'){annual_end = "2010";}
	if(start_year == '2010'){annual_end = "2011";}
	if(start_year == '2011'){annual_end = "2012";}
	if(start_year == '2012'){annual_end = "2013";}
	if(start_year == '2013'){annual_end = "2014";}
	if(start_year == '2014'){annual_end = "2015";}
	if(start_year == '2015'){annual_end = "2016";}
	if(start_year == '2016'){annual_end = "2017";}
	if(start_year == '2017'){annual_end = "2018";}
	if(start_year == '2018'){annual_end = "2019";}
	
	if(start_month == '01'){start_month = "00";}
	if(start_month == '02'){start_month = "01";}				
	if(start_month == '03'){start_month = "02";}
	if(start_month == '04'){start_month = "03";}
	if(start_month == '05'){start_month = "04";}
	if(start_month == '06'){start_month = "05";}
	if(start_month == '07'){start_month = "06";}
	if(start_month == '08'){start_month = "07";}
	if(start_month == '09'){start_month = "08";}
	if(start_month == '10'){start_month = "09";}
	if(start_month == '11'){start_month = "10";}
	if(start_month == '12'){start_month = "11";}
	
	if(end_month == '01'){end_month = "00";}
	if(end_month == '02'){end_month = "01";}				
	if(end_month == '03'){end_month = "02";}
	if(end_month == '04'){end_month = "03";}
	if(end_month == '05'){end_month = "04";}
	if(end_month == '06'){end_month = "05";}
	if(end_month == '07'){end_month = "06";}
	if(end_month == '08'){end_month = "07";}
	if(end_month == '09'){end_month = "08";}
	if(end_month == '10'){end_month = "09";}
	if(end_month == '11'){end_month = "10";}
	if(end_month == '12'){end_month = "11";}
	
	var start_full1 = new Date(start_year,start_month,start_day,00,00,00);
	var annual1 = new Date(annual_end,start_month,start_day,00,00,00);
	var end_full1 = new Date(end_year,end_month,end_day,00,00,00);
	var today_full1 = new Date(today_year, today_month, today_day,00,00,00);

	//alert("START DATE: " + start_full1);
	//alert("Annual: " + annual1);
	//alert("END DATE: " + end_full1);
	//alert("TODAY: " + today_full1);
	
	if(start_full1 < today_full1) {
		alert("Policy start date must not be prior to today");
		return false;
	}else if(start_full1 > end_full1) {
		alert("Start date must be before end date.");
		return false;
	}else if(start_full1 <= end_full1) {
		form.dbStartDate.value = (start_year + "-" + start_month + "-" + start_day + " 00:00:00");
		form.dbEndDate.value = (end_year + "-" + end_month + "-" + end_day + " 00:00:00");
		return false;
	}else{
		alert("uncaught exception");
	}		
	return true;
}	

