This is the simplest and fastest way of finding the maximum value in a JavaScript array:
var the_max_value = Math.max.apply(Math,someArray);