function findClosest(value,array) { closestDiff = null; closestPosition = null; for (var i=0;i