From http://stackoverflow.com/questions/143847/best-way-to-find-an-item-in-a-javascript-array