function isDateValid(myDate)
{
    var IsoDateRe = new RegExp("^([0-9]{4})-([0-9]{2})-([0-9]{2})$");
    var matches = IsoDateRe.exec(myDate);
    if (!matches) return false;

    var composedDate = new Date(matches[1], (matches[2] - 1), matches[3]);
    return ((composedDate.getMonth() == (matches[2] - 1)) && (composedDate.getDate() == matches[3]) && (composedDate.getFullYear() == matches[1]));
}
