Never ever use == or != in js. Use === or !== instead. Read Crockford's The Good Parts for an adequate explanation.