added javascript version of risk calc