function engine(element, reaction_rate_function) { var e = {}; // the engine object! e.container = $(element); var q = {}; e.quantities = q; q.temperature = { "update": function () { var old_value = this.value; this.value += reaction_rate_function(q)*timestep/1000 if (this.value < 0) { this.value = 0; } if (old_value != this.value) { return true; } }, "out": function () { e.container.find('.temp-out').html(this.value.toFixed(2)); if (this.value > q.damage_threshhold.value) { e.container.find('.damage').show();} else { e.container.find('.damage').hide(); } if (this.value < q.ignition_threshhold.value) { e.container.find('.noignition').show(); } else { e.container.find('.noignition').hide(); } for (var i=0; i