I'm using inArray() to check an XML tag against an array called status[]. If the result != -1, then do one set of instructions, else, the item is 'available' so do another set of instructions.

Each entry of my XML document has a <status> tag, which will contain one of 3 values, or a 4th option 'available'. I have an array setup called status['sold', 'pending', 'reduced']. If the <status>.text() is one of these 3 values, then we'll get the array position, if it's 'available' we should get -1.


When I run this in Firefox (3.6) & IE (8.0 or Comp Mode) it works fine. However, when I run this in Safari (4 or 5) & Chrome, it returns the value -1 for each of the entries. The 3rd, 5th, & 7th entries are all set to <status> 'sold' and inArray() should be returning a 0.


Code:
<home id="" model="" vin="">
<status>available</status>
</home>

<home id="" model="" vin="">
<status>sold</status>
</home>

var status = ['sold', 'pending', 'reduced'];

$(xml).find("home").each(function(xml){
var statusVal = $(this).find("status").text();
var statusN = ($.inArray(statusVal, status));
});


Can someone explain why this happens? How can I fix my page?