javascript fork from the coffee script version from fuseelements.