function vAge(birthMM,birthDD,birthYYYY,targetAge) { if (!testAge(birthMM,birthDD,birthYYYY,13)) { document.cookie = "underage=true; path=/; domain=.theabl.com.au"; //alert("You are ineligible to complete this form."); document.location.replace("/forms/ineligible.jsp"); } return testAge(birthMM,birthDD,birthYYYY,targetAge); } function testAge(birthMM,birthDD,birthYYYY,targetAge) { var thisMM=9, thisDD=25, thisYYYY=(2018-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; }