rewriting disciplines js to work with newer jquery