function vAge(birthMM,birthDD,birthYYYY,targetAge) { if (!testAge(birthMM,birthDD,birthYYYY,13)) { document.cookie = "underage=true; path=/; domain=.mlb.com"; setTimeout('document.location.replace("/mlb/ineligibility.jsp?c_id=mlb");',2100); } 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; }