The only time I find I run into that problem is that the variable is not a string or an array. These are the two most common causes to my knowledge. Try debuging the variable just before the if statement to check. You may also wish to re-code your if statement.
code:
(tehfiltabud.length >= 1000
return a boolean variable, if it is true then it equals 1 and false equals 0. I think you understand this by putting it in, but instead of having
code:
if ((tehfiltabud.length >= 1000) == 0){
you can have
code:
if (!(tehfiltabud.length >= 1000)){
as the ! turns false to true and true to false, but what would be even better is to do
code:
if (tehfiltabud.length < 1000){
which is just the opposite. I'm sure you will understand the logic behind that.
EDIT: Looks like I was a little slow, but maybe that extra info might help your code.