Clean up js syntax. Strange error with mouseup jQuery