
function checkDate(pDate)
    
    dim status
    '
    dim arrDate
    ' isDate wouldn't catch a 3 digit year entered
    arrDate = Split(pDate.value,"/")
    if UBound(arrDate) = 2 Then
        if Len(arrDate(2)) = 3 Then
            msgbox("Please enter valid date")
            pDate.focus()
            pDate.select()
            checkDate = false
            exit function
        end if
    end if
    '
    ' Needed to check length because for some reason
    ' isDate function thinks 12.28 is a valid date??????
    ' Don't allow 12.28.07
    if not isDate(pDate.value) or Len(pDate.value) < 5 or (instr(1,pDate.value,".") > 0) then
        if (pDate.id = "ctl00_ContentPlaceHolder1_txtIrpExpirationDate") then
            msgbox("Please enter valid date or PERMANENT")
        elseif (pDate.id = "ctl00_ContentPlaceHolder1_txtPhysicalDamageExpirationDate" or pDate.id = "ctl00_ContentPlaceHolder1_txtBobtailInsuranceExpirationDate") then
            msgbox("Please enter valid date or CUC(Continuous Until Cancelled)")
        else
            msgbox("Please enter valid date")
        end if
        pDate.focus()
        pDate.select()
        status = false
    else
        status = true
    end if
    
    checkDate = status
    
end function
    
function checkDateValues(oStartDate, oEndDate)

    dim status
    
    status = true
    
    if cdate(oStartDate.value) > cdate(oEndDate.value) then
        msgbox("Please enter start date equal to or less then end date")
        oStartDate.focus()
        oStartDate.select()
        status = false
    end if
    
    checkDateValues = status
    
end function        