function dobcheck(){
var dob = document.input.dob.value;
var reg1 = /^(0[1-9]|[12][0-9]|3[01])[\- \/\.](0[1-9]|1[012])[\- \/\.](19|20)\d\d$/;
var out1 = "ouch";
if ( ! reg1.test(dob)){
out1 = "Not a date format";
}
else {
var dd = dob.substring(0,2);
var mm = dob.substring(3,5);
var yyyy = dob.substring(6,10);
var ok = "Good, " + dd + "/" + mm + "/" + yyyy + " is a real date";
if ( dd == "31"){
if ( mm == "02" || mm == "04" || mm == "06" || mm == "09" || mm == "11"){
out1 = "There are not 31 days in the month " + mm;
}
else{
out1 = ok;
}
}
else if ( mm == "02") {
var month = "Feb";
if (dd == "30"){
out1 = "There are not 30 days in the month " + month;
}
else if ( dd == "29"){
if ( (yyyy%4) != 0){
out1 = "This is not a leap year.";
}
else if ( ((yyyy%100) == 0)) && ((yyyy%1000) != 0)){
out1 = "This is not a leap year, it really isn't";
}
else {
out1 = ok;
}
}
else {
out1 = ok;
}
}
else {
out1 = ok;
}
}
return dob_error.innerHTML = out1;
}