function vAge(birthMM,birthDD,birthYYYY,targetAge) { if (!testAge(birthMM,birthDD,birthYYYY,13)) { document.cookie = "underage=true; path=/; domain=.milb.com"; //alert("You are ineligible to complete this form."); setTimeout('document.location.replace("http://www.milb.com/tickets/ineligible.jsp");',1000); } return testAge(birthMM,birthDD,birthYYYY,targetAge); } function testAge(birthMM,birthDD,birthYYYY,targetAge) { var thisMM=10, thisDD=17, thisYYYY=(2017-targetAge); if (birthYYYY > thisYYYY) { return false; } else if (birthYYYY == thisYYYY) { if (birthMM > thisMM) { return false; } else if (thisMM == birthMM) { if (birthDD > thisDD) return false; } } return true; }