I'm trying to find the max value in an array and keep getting a value that isn't the max. Here's the function:

function maxValue(array) {
mxm = array[0];
for (i=0; i<array.length; i++) {
if (array[i]>mxm) {
mxm = array[i];
}
}
return mxm;
}

It's an array of about 15 values. The largest is 3984000, but the function returns 954000 as the max. In case it matters the array draws from an XML document. The only thing I can think of is that because 9>3 Flash sees the first integer and assumes that's the largest number, but it obviously isn't. Any ideas?

Thanks! Jared