define(["jquery"], function ($) { "use strict"; var data; return { init: function(datapath){ $().ready(function(){ // hook into the on change events to update things when user input happens $("#temps input,#temps select").change(function(){ calc_dt(); populate_table(); }); $("#hc_product").change(function(){ draw_table(); populate_table(); check_scroll(); }); $("#filters").change(function(){ populate_table(); }); $("#right").click(function(event) { event.preventDefault(); $("#table_container").animate({ scrollLeft: "+=300px" }, "slow", function() { check_scroll(); }); }); $("#left").click(function(event) { event.preventDefault(); $("#table_container").animate({ scrollLeft: "-=300px" }, "slow", function() { check_scroll(); }); }); //calc the inital dt calc_dt(); //init the scroller icons check_scroll(); $(window).scroll(check_scroll); $("#table_container").scroll(check_scroll); $.getJSON(datapath, function(d) { data=d; // create the product switcher var sel=$("#hc_product"); // loop through the product names and create the options $.each(data, function(idx, obj) { sel.append( $("