
function testDate(day,month,year,field)
	{
	dayy = new String(day);
	monthh = new String(month);
	yearr = new String(year);

	if(isNaN(dayy) || isNaN(monthh) || isNaN(yearr))
	{
		return ("Enter valid " + field);
	}
	else if(dayy == "" || month == "" || yearr == "")
	{
		return ("Enter complete " + field);
	}
	var datee = new String(dayy + "/" + monthh + "/" + yearr);
	var monthDay = new Array([1,31],[2,28],[3,31],[4,30],[5,31],[6,30],[7,31],[8,31],[9,30],[10,31],[11,30],[12,31])

	if(month < 1 || month > 12)
	  {
	  return ("Invalid month selection for " + field + ".");
	  }
	 if(day > monthDay[month-1][1])
  	     {
  	       if(month == 2  && year%4 == 0 && day == 29)
		   {
			return("Valid");
		   }
		   else
    	   {
		  	return("Invalid days for the selected month in " + field + ".");
		   }
	    }
	  else
	    {
	    	return ("Valid");
	    }

	return("Valid");
}

function validate_form()
{
	var message = "The following information(s) is required/incorrect: \n";
	var dy = document.frm_quote_form.Birthday.value;
	var mn = document.frm_quote_form.BirthMonth.value;
	var yr = document.frm_quote_form.BirthYear.value;
	test_date_val = testDate(dy,mn,yr, "Date of Birth");
	if(test_date_val != "Valid")
	{
		message = message + " -" + test_date_val + "\n";
	}

	if(document.frm_quote_form.Weight.value == -1) {
		message = message + " -Select your weight.\n";
		document.frm_quote_form.Weight.focus();
	}
		
	var catg = document.frm_quote_form.Catagory.value;
		

	document.frm_quote_form.parm3.value = document.frm_quote_form.Weight.value;
	document.frm_quote_form.parm4.value = document.frm_quote_form.Feet.value;
	document.frm_quote_form.parm5.value = document.frm_quote_form.Inches.value;

	if(catg == "A")
		document.frm_quote_form.parm1.value = "5 Year";
	else if(catg == "B")
		document.frm_quote_form.parm1.value = "10 Year";
	else if(catg == "C")
		document.frm_quote_form.parm1.value = "15 Year";
	else if(catg == "D")
		document.frm_quote_form.parm1.value = "20 Year";
	else if(catg == "E")
		document.frm_quote_form.parm1.value = "25 Year";
	else if(catg == "F")
		document.frm_quote_form.parm1.value = "30 Year";

	if(message == "The following information(s) is required/incorrect: \n")
		return true;
	else
		alert (message);
	return false;
}