function array_equal ( a, b ) { if ( a.length != b.length ) return false; a.sort(); b.sort(); for ( var i in a ) { if ( a[i] != b[i] ) return false; } return true; };