Replaced getBBQStateLength with jQuery function