function vAge(birthMM,birthDD,birthYYYY,targetAge) { if (!testAge(birthMM,birthDD,birthYYYY,13)) { document.cookie = "underage=true; path=/; domain=.camelbackranchbaseball.com"; setTimeout('document.location.replace("/ineligibility.jsp");',1000); } return testAge(birthMM,birthDD,birthYYYY,targetAge); } function testAge(birthMM,birthDD,birthYYYY,targetAge) { var thisMM=12, thisDD=16, 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; }