Refactored to jQuery.