Issue with conditional javascript related to #14