hi there.. you are making the comparations like there where strings, not dates..
i dont konw how to do it in script.. maybe you have datediff=???
or something like that to convert every to date???
other things i do is to format dates like yyyymmdd, and then compare them in string.. always work...