There is no PHP-like shuffle function in JavaScript, so you have to do it like this:
Code:
shuffle = function(myArray) {
for (var tmp, j, i = myArray.length; i; j = parseInt(Math.random()*i), tmp = myArray[--i], myArray[i] = myArray[j], myArray[j] = tmp);
return myArray;
};