jquery and javascript component interdependence